|
[HepData-svn] r1719 - trunk/hepdata-model/src/main/java/cedar/hepdata/modelblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Dec 2 10:20:15 GMT 2013
Author: whalley Date: Mon Dec 2 10:20:15 2013 New Revision: 1719 Log: adding Systematic class Added: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Systematic.java Added: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Systematic.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Systematic.java Mon Dec 2 10:20:15 2013 (r1719) @@ -0,0 +1,239 @@ +package cedar.hepdata.model; + +import java.util.Set; +import java.util.HashSet; + +import javax.persistence.*; + +/** +* Derived from the old database, these are the systematics on a paper +* level. +* @author Mike Whalley +* @version $Date: 2012-12-11 15:44:34 +0100 (Tue, 25 Sep 2007) $ $Revision: 1077 $ +*/ + at Embeddable +public class Systematic extends Storeable implements Comparable<Systematic> { + /** The localId */ + @Column(name="LocalId", nullable=false) + private long _localId; + + /** The value itself */ + @Column(name="SysValue", nullable=true) + private String _value; + + /** folded or not folded already */ + @Column(name="Folded", nullable=true) + private String _folded; + + /** comment */ + @Column(name="Comment", nullable=true, length=10000) + private String _comment; + + /** correction */ + @Column(name="Corr", nullable=true, length=10000) + private String _correction; + + /** condition */ + @Column(name="Cond", nullable=true, length=10000) + private String _condition; + + /** SysName to which it applies*/ + @Column(name="SysName", nullable=true) + private String _name; + + /** First Qname to which it applies*/ + @Column(name="SysQN1", nullable=true) + private String _qname1; + + /** First Qvalue to which it applies*/ + @Column(name="SysQV1", nullable=true) + private String _qvalue1; + + /** Second Qname to which it applies*/ + @Column(name="SysQN2", nullable=true) + private String _qname2; + + /** Second Qvalue to which it applies*/ + @Column(name="SysQV2", nullable=true) + private String _qvalue2; + + + ///////////////////////////////////////////////////////// + + + /** Default constructor. */ + public Systematic() { } + + + /** Named constructor. */ + public Systematic(String value) { + this(); + setValue(value); + } + + + /** Constructor which specifies both the formal and informal expt names. */ + public Systematic(String value, Boolean folded) { + this(value); + setFolded(folded); + } + + + ///////////////////////////////////////////////////////// + + + /** Get the localId name */ + public Long getLocalId() { + return _localId; + } + /** Set the localId name */ + public Systematic setLocalId(Long localId) { + _localId = localId; + return this; + } + + /** Get the sys name */ + public String getName() { + return _name; + } + /** Set the sys value name */ + public Systematic setName(String name) { + _name = name; + return this; + } + + /** Get the sys value */ + public String getValue() { + return _value; + } + /** Set the sys value name */ + public Systematic setValue(String value) { + _value = value; + return this; + } + + /** Get the folded value */ + public Boolean getFolded() { + Boolean rtn = false; + if(_folded.equals("FOLDED")) {rtn = true;} + return rtn; + } + /** Set the folded value name */ + public Systematic setFolded(Boolean folded) { + _folded = ""; + if(folded) _folded = "FOLDED"; + return this; + } + + + /** Get the comment */ + public String getComment() { + return _comment; + } + /** Set the comment */ + public Systematic setComment(String comment) { + _comment = comment; + return this; + } + + /** Get the correction */ + public String getCorrection() { + return _correction; + } + /** Set the correction */ + public Systematic setCorrection(String correction) { + _correction = correction; + return this; + } + + /** Get the condition */ + public String getCondition() { + return _condition; + } + /** Set the correction */ + public Systematic setCondition(String condition) { + _condition = condition; + return this; + } + + /** Get the QN1 */ + public String getQName1() { + return _qname1; + } + /** Set the QN1 */ + public Systematic setQName1(String qname1) { + _qname1 = qname1; + return this; + } + /** Get the QN2 */ + public String getQName2() { + return _qname2; + } + /** Set the QN2 */ + public Systematic setQName2(String qname2) { + _qname2 = qname2; + return this; + } + + /** Get the QV1 */ + public String getQValue1() { + return _qvalue1; + } + /** Set the QV1 */ + public Systematic setQValue1(String qvalue1) { + _qvalue1 = qvalue1; + return this; + } + /** Get the QV2 */ + public String getQValue2() { + return _qvalue2; + } + /** Set the QV2 */ + public Systematic setQValue2(String qvalue2) { + _qvalue2 = qvalue2; + return this; + } + + + + + ////////////////////////////////////////////////////////// + + + public int compareTo(Systematic other) { + log().debug("Comparing systematics..."); + return getName().compareTo(other.getName()); + } + + + public boolean equals(Object other) { + if (this == other) return true; + if (! (other instanceof Systematic)) return false; + return hashCode() == other.hashCode(); + } + + + public int hashCode() { + int code = 61; + if (getName() != null) code ^= getName().hashCode(); + if (getValue() != null) code ^= getValue().hashCode(); + if (getComment() != null) code ^= getComment().hashCode(); + if (getQName1() != null) code ^= getQName1().hashCode(); + if (getQValue1() != null) code ^= getQValue1().hashCode(); + return code; + } + + + /////////////////////////////////////////////////////// + + + /** String representation. */ + public String toString() { + StringBuffer s = new StringBuffer(); + s.append("Systematic Name: " + getName() + "\n"); + s.append("Systematic Value: " + getValue() + "\n"); + s.append("Systematic Comment: " + getComment() + "\n"); + return s.toString(); + } + +}
More information about the HepData-svn mailing list |