00001 package cedar.hepdata.model;
00002
00003 import java.util.Set;
00004 import java.util.HashSet;
00005
00006 import javax.persistence.*;
00007
00017 @Embeddable
00018 public class Experiment extends Storeable implements Comparable<Experiment> {
00020 @Column(name="ExptName", nullable=false)
00021 private String _name;
00022
00024 @Column(name="InformalName", nullable=true)
00025 private String _informalName;
00026
00029 @Column(name="Collider", nullable=true)
00030 private String _collider;
00031
00034 @Column(name="Lab", nullable=true)
00035 private String _laboratory;
00036
00038 @Column(name="ExptComment", nullable=true, length=10000)
00039 private String _comment = "";
00040
00041
00043
00044
00046 public Experiment() { }
00047
00048
00050 public Experiment(String name) {
00051 this();
00052 setName(name);
00053 }
00054
00055
00057 public Experiment(String name, String informalName) {
00058 this(name);
00059 setInformalName(informalName);
00060 }
00061
00062
00064
00065
00067 public String getName() {
00068 return _name;
00069 }
00071 public Experiment setName(String name) {
00072 _name = name;
00073 return this;
00074 }
00075
00076
00078 public String getInformalName() {
00079 return _informalName;
00080 }
00082 public Experiment setInformalName(String informalName) {
00083 _informalName = informalName;
00084 return this;
00085 }
00086
00087
00089 public String getCollider() {
00090 return _collider;
00091 }
00093 public Experiment setCollider(String collider) {
00094 _collider = collider;
00095 return this;
00096 }
00097
00098
00100 public String getLaboratory() {
00101 return _laboratory;
00102 }
00104 public Experiment setLaboratory(String laboratory) {
00105 _laboratory = laboratory;
00106 return this;
00107 }
00108
00109
00110
00111 public String getComment() {
00112 return _comment;
00113 }
00114 public Experiment setComment(String comment) {
00115 _comment = comment;
00116 return this;
00117 }
00118
00119
00121
00122
00123 public int compareTo(Experiment other) {
00124 log().debug("Comparing experiments...");
00125 return getName().compareTo(other.getName());
00126 }
00127
00128
00129 public boolean equals(Object other) {
00130 if (this == other) return true;
00131 if (! (other instanceof Experiment)) return false;
00132 return hashCode() == other.hashCode();
00133 }
00134
00135
00136 public int hashCode() {
00137 int code = 61;
00138 if (getName() != null) code ^= getName().hashCode();
00139 if (getInformalName() != null) code ^= getInformalName().hashCode();
00140 if (getCollider() != null) code ^= getCollider().hashCode();
00141 if (getLaboratory() != null) code ^= getLaboratory().hashCode();
00142 if (getComment() != null) code ^= getComment().hashCode();
00143 return code;
00144 }
00145
00146
00148
00149
00151 public String toString() {
00152 StringBuffer s = new StringBuffer();
00153 s.append("Experiment: " + getName() + "\n");
00154 s.append(" Comment: " + getComment() + "\n");
00155 return s.toString();
00156 }
00157
00158 }