[Nmrshiftdb-devel] CVS: nmrshiftdb/src/java/org/openscience/nmrshiftdb/om DBMolecule.java,1.12,1.13
Brought to you by:
steinbeck
|
From: Stefan K. <sh...@us...> - 2002-05-31 14:02:27
|
Update of /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/om
In directory usw-pr-cvs1:/tmp/cvs-serv666/src/java/org/openscience/nmrshiftdb/om
Modified Files:
DBMolecule.java DBMoleculeHyperlink.java DBSpectrum.java
DBSpectrumHyperlink.java
Log Message:
Added the links to submit and results
Index: DBMolecule.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/om/DBMolecule.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** DBMolecule.java 30 May 2002 09:48:55 -0000 1.12
--- DBMolecule.java 31 May 2002 14:02:20 -0000 1.13
***************
*** 171,174 ****
--- 171,187 ----
return v;
}
+
+
+ /**
+ *Gets the links of the DBMolecule object
+ *
+ * @return The links
+ * @exception Exception Database problems
+ */
+ public Vector getLinks() throws Exception {
+ Criteria crit = new Criteria();
+ crit.add(DBMoleculeHyperlinkPeer.MOLECULE_ID, this.getMoleculeId());
+ return (DBMoleculeHyperlinkPeer.doSelect(crit));
+ }
}
Index: DBMoleculeHyperlink.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/om/DBMoleculeHyperlink.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DBMoleculeHyperlink.java 30 May 2002 15:07:59 -0000 1.1
--- DBMoleculeHyperlink.java 31 May 2002 14:02:20 -0000 1.2
***************
*** 24,27 ****
--- 24,40 ----
implements Persistent
{
+ /**
+ *The equals method comparing by the Hyperlink fiels
+ *
+ * @param hl The DBMoleculeHyperlink to compare with
+ * @return false=unequal, true=equal
+ */
+ public boolean equals(DBMoleculeHyperlink hl) {
+ if (this.getHyperlink().equals(hl.getHyperlink())) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
Index: DBSpectrum.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/om/DBSpectrum.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** DBSpectrum.java 29 May 2002 14:11:55 -0000 1.26
--- DBSpectrum.java 31 May 2002 14:02:20 -0000 1.27
***************
*** 29,34 ****
public class DBSpectrum
extends org.openscience.nmrshiftdb.om.BaseDBSpectrum
! implements Persistent
! {
double similarity = -1;
--- 29,33 ----
public class DBSpectrum
extends org.openscience.nmrshiftdb.om.BaseDBSpectrum
! implements Persistent {
double similarity = -1;
***************
*** 42,47 ****
* @param v The new options value, a vector of string
*/
! public void setOptions(Vector v)
! {
options = v;
}
--- 41,45 ----
* @param v The new options value, a vector of string
*/
! public void setOptions(Vector v) {
options = v;
}
***************
*** 55,60 ****
*/
public String getConditionType()
! throws Exception
! {
Criteria crit = new Criteria();
crit.add(DBConditionTypePeer.CONDITION_TYPE_ID, ((DBCondition) this.getMeasurementConditions().get(0)).getConditionTypeId());
--- 53,57 ----
*/
public String getConditionType()
! throws Exception {
Criteria crit = new Criteria();
crit.add(DBConditionTypePeer.CONDITION_TYPE_ID, ((DBCondition) this.getMeasurementConditions().get(0)).getConditionTypeId());
***************
*** 65,74 ****
/**
*Returns the similarity in percent between this spectrum and another spectrum, set by initSimilarity
*
* @return A double from 0 to 100
*/
! public double getSimilarity()
! {
return (similarity);
}
--- 62,83 ----
/**
+ *Gets the links of the DBSpectrum object
+ *
+ * @return The links
+ * @exception Exception Database problems
+ */
+ public Vector getLinks() throws Exception {
+ Criteria crit = new Criteria();
+ crit.add(DBSpectrumHyperlinkPeer.SPECTRUM_ID, this.getSpectrumId());
+ return (DBSpectrumHyperlinkPeer.doSelect(crit));
+ }
+
+
+ /**
*Returns the similarity in percent between this spectrum and another spectrum, set by initSimilarity
*
* @return A double from 0 to 100
*/
! public double getSimilarity() {
return (similarity);
}
***************
*** 80,85 ****
* @return The options value, a vector of strings
*/
! public Vector getOptions()
! {
return (options);
}
--- 89,93 ----
* @return The options value, a vector of strings
*/
! public Vector getOptions() {
return (options);
}
***************
*** 93,98 ****
*/
public DBMolecule getMolecule()
! throws Exception
! {
Criteria crit = new Criteria();
crit.add(DBMoleculePeer.MOLECULE_ID, this.getMoleculeId());
--- 101,105 ----
*/
public DBMolecule getMolecule()
! throws Exception {
Criteria crit = new Criteria();
crit.add(DBMoleculePeer.MOLECULE_ID, this.getMoleculeId());
***************
*** 109,114 ****
*/
public Vector getMeasurementConditions()
! throws Exception
! {
Criteria crit = new Criteria();
crit.addJoin(DBSpectrumDBConditionPeer.CONDITION_ID, DBConditionPeer.CONDITION_ID);
--- 116,120 ----
*/
public Vector getMeasurementConditions()
! throws Exception {
Criteria crit = new Criteria();
crit.addJoin(DBSpectrumDBConditionPeer.CONDITION_ID, DBConditionPeer.CONDITION_ID);
***************
*** 125,130 ****
*/
public Vector getSignals()
! throws Exception
! {
DBConnection dbconn = null;
dbconn = TurbineDB.getConnection();
--- 131,135 ----
*/
public Vector getSignals()
! throws Exception {
DBConnection dbconn = null;
dbconn = TurbineDB.getConnection();
***************
*** 144,149 ****
* @return The specFile value
*/
! public String getSpectrumForApplet()
! {
return (new String(this.getSpecfile()));
}
--- 149,153 ----
* @return The specFile value
*/
! public String getSpectrumForApplet() {
return (new String(this.getSpecfile()));
}
***************
*** 157,162 ****
*/
public NmrshiftdbUser getContributor()
! throws Exception
! {
Criteria crit = new Criteria();
crit.add(NmrshiftdbUserPeer.USER_ID, this.getUserId());
--- 161,165 ----
*/
public NmrshiftdbUser getContributor()
! throws Exception {
Criteria crit = new Criteria();
crit.add(NmrshiftdbUserPeer.USER_ID, this.getUserId());
***************
*** 173,178 ****
*/
public String getSpectrumTypeName()
! throws Exception
! {
return this.getSpectrumType().getName();
}
--- 176,180 ----
*/
public String getSpectrumTypeName()
! throws Exception {
return this.getSpectrumType().getName();
}
***************
*** 186,191 ****
*/
public DBSpectrumType getSpectrumType()
! throws Exception
! {
Criteria crit = new Criteria();
crit.add(DBSpectrumTypePeer.SPECTRUM_TYPE_ID, this.getSpectrumTypeId());
--- 188,192 ----
*/
public DBSpectrumType getSpectrumType()
! throws Exception {
Criteria crit = new Criteria();
crit.add(DBSpectrumTypePeer.SPECTRUM_TYPE_ID, this.getSpectrumTypeId());
***************
*** 202,207 ****
*/
public void initSimilarity(DBSignal[] otherSignals)
! throws Exception
! {
double similarityPerSignal;
double maxSimilarity;
--- 203,207 ----
*/
public void initSimilarity(DBSignal[] otherSignals)
! throws Exception {
double similarityPerSignal;
double maxSimilarity;
***************
*** 211,219 ****
DBSignal[] smallerVector;
DBSignal[] greaterVector;
! Vector al=ParseUtils.parseSpectrumFromSpecFile(new String(this.getSpecfile()));
DBSignal[] signals = new DBSignal[al.size()];
! for(int i=0;i<al.size();i++){
! signals[i]=new DBSignal();
! ValueTriple vt=(ValueTriple)al.get(i);
signals[i].setIntensity(vt.value2);
signals[i].setDimensionality(1);
--- 211,219 ----
DBSignal[] smallerVector;
DBSignal[] greaterVector;
! Vector al = ParseUtils.parseSpectrumFromSpecFile(new String(this.getSpecfile()));
DBSignal[] signals = new DBSignal[al.size()];
! for (int i = 0; i < al.size(); i++) {
! signals[i] = new DBSignal();
! ValueTriple vt = (ValueTriple) al.get(i);
signals[i].setIntensity(vt.value2);
signals[i].setDimensionality(1);
***************
*** 223,236 ****
shifts[0].setValue(vt.value1);
signals[i].setDBShiftsArray(shifts);
! }
! if (signals.length > otherSignals.length)
! {
greaterNumber = signals.length;
smallerNumber = otherSignals.length;
smallerVector = otherSignals;
greaterVector = signals;
! }
! else
! {
greaterNumber = otherSignals.length;
smallerNumber = signals.length;
--- 223,233 ----
shifts[0].setValue(vt.value1);
signals[i].setDBShiftsArray(shifts);
! }
! if (signals.length > otherSignals.length) {
greaterNumber = signals.length;
smallerNumber = otherSignals.length;
smallerVector = otherSignals;
greaterVector = signals;
! } else {
greaterNumber = otherSignals.length;
smallerNumber = signals.length;
***************
*** 241,264 ****
similarityPerSignal = 100 / greaterNumber;
maxSimilarity = similarityPerSignal * smallerNumber;
! for (int i = 0; i < smallerVector.length; i++)
! {
int nearestSignal = 0;
double difference = Double.MAX_VALUE;
! for (int m = 0; m < greaterVector.length; m++)
! {
! if (java.lang.Math.abs(greaterVector[m].getDBShiftsArray()[0].getValue() - smallerVector[i].getDBShiftsArray()[0].getValue()) < difference && signalsUsed[m] == false)
! {
difference = java.lang.Math.abs(greaterVector[m].getDBShiftsArray()[0].getValue() - smallerVector[i].getDBShiftsArray()[0].getValue());
nearestSignal = m;
}
}
! if (difference < similarityPerSignal)
! {
! if (smallerVector[i].getIntensity() != 0 && greaterVector[nearestSignal].getIntensity() != 0)
! {
similarity += (similarityPerSignal - difference) * (java.lang.Math.min(smallerVector[i].getIntensity(), greaterVector[nearestSignal].getIntensity()) / java.lang.Math.max(smallerVector[i].getIntensity(), greaterVector[nearestSignal].getIntensity()));
! }
! else
! {
similarity += similarityPerSignal - difference;
}
--- 238,254 ----
similarityPerSignal = 100 / greaterNumber;
maxSimilarity = similarityPerSignal * smallerNumber;
! for (int i = 0; i < smallerVector.length; i++) {
int nearestSignal = 0;
double difference = Double.MAX_VALUE;
! for (int m = 0; m < greaterVector.length; m++) {
! if (java.lang.Math.abs(greaterVector[m].getDBShiftsArray()[0].getValue() - smallerVector[i].getDBShiftsArray()[0].getValue()) < difference && signalsUsed[m] == false) {
difference = java.lang.Math.abs(greaterVector[m].getDBShiftsArray()[0].getValue() - smallerVector[i].getDBShiftsArray()[0].getValue());
nearestSignal = m;
}
}
! if (difference < similarityPerSignal) {
! if (smallerVector[i].getIntensity() != 0 && greaterVector[nearestSignal].getIntensity() != 0) {
similarity += (similarityPerSignal - difference) * (java.lang.Math.min(smallerVector[i].getIntensity(), greaterVector[nearestSignal].getIntensity()) / java.lang.Math.max(smallerVector[i].getIntensity(), greaterVector[nearestSignal].getIntensity()));
! } else {
similarity += similarityPerSignal - difference;
}
Index: DBSpectrumHyperlink.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/om/DBSpectrumHyperlink.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DBSpectrumHyperlink.java 30 May 2002 15:07:59 -0000 1.1
--- DBSpectrumHyperlink.java 31 May 2002 14:02:20 -0000 1.2
***************
*** 1,5 ****
package org.openscience.nmrshiftdb.om;
-
// JDK classes
import java.util.*;
--- 1,4 ----
***************
*** 15,29 ****
import org.apache.turbine.util.db.pool.DBConnection;
! /**
! * You should add additional methods to this class to meet the
! * application requirements. This class will only be generated as
! * long as it does not already exist in the output directory.
! */
! public class DBSpectrumHyperlink
! extends org.openscience.nmrshiftdb.om.BaseDBSpectrumHyperlink
! implements Persistent
! {
}
-
--- 14,42 ----
import org.apache.turbine.util.db.pool.DBConnection;
! /**
! * You should add additional methods to this class to meet the
! * application requirements. This class will only be generated as
! * long as it does not already exist in the output directory.
! *
! * @author shk3
! * @created 31. Mai 2002
! */
! public class DBSpectrumHyperlink
! extends org.openscience.nmrshiftdb.om.BaseDBSpectrumHyperlink
! implements Persistent {
! /**
! *The equals method comparing by the Hyperlink fiels
! *
! * @param hl The DBSpectrumHyperlink to compare with
! * @return false=unequal, true=equal
! */
! public boolean equals(DBSpectrumHyperlink hl) {
! if (this.getHyperlink().equals(hl.getHyperlink())) {
! return true;
! } else {
! return false;
! }
! }
}
|