00001 package cedar.hepdata.model; 00002 00003 import cedar.hepdata.util.*; 00004 import javax.persistence.*; 00005 00012 @Entity 00013 @Table(name="BaseProperties") 00014 @Inheritance(strategy=InheritanceType.JOINED) 00015 public abstract class Property extends Storeable { 00017 @Id @GeneratedValue 00018 @Column(name="PROPERTY_ID") 00019 private Long _id = null; 00020 00022 @Column(name="Name", nullable=false) 00023 private String _name; 00024 00026 @Column(name="LowValue", nullable=false) 00027 private Double _lowValue; 00028 00030 @Column(name="HighValue", nullable=false) 00031 private Double _highValue; 00032 00034 @Column(name="Unit", nullable=false) 00035 @org.hibernate.annotations.Type(type="cedar.hepdata.db.UnitUserType") 00036 private Unit _unit = new Unit(); 00037 00038 00040 00041 00043 public Property() {} 00044 00046 public Property(String name) { 00047 setName(name); 00048 } 00049 00051 public Property(String name, Unit unit, Double lowValue, Double highValue) { 00052 setName(name); 00053 setValues(unit, lowValue, highValue); 00054 } 00055 00056 00058 00059 00061 public Property setValues(Unit unit, Double lowValue, Double highValue) { 00062 setUnit(unit); 00063 setLowValue(lowValue); 00064 setHighValue(highValue); 00065 return this; 00066 } 00067 00068 00070 00071 00073 public String getName() { 00074 return _name; 00075 } 00076 00078 public Property setName(String name) { 00079 _name = name; 00080 return this; 00081 } 00082 00083 00085 public Double getLowValue() { 00086 return _lowValue; 00087 } 00088 00090 public Property setLowValue(Double lowValue) { 00091 _lowValue = lowValue; 00092 return this; 00093 } 00094 00095 00097 public Double getHighValue() { 00098 return _highValue; 00099 } 00100 00102 public Property setHighValue(Double highValue) { 00103 _highValue = highValue; 00104 return this; 00105 } 00106 00107 00109 public Unit getUnit() { 00110 return _unit; 00111 } 00112 00114 public Property setUnit(Unit unit) { 00115 _unit = unit; 00116 return this; 00117 } 00118 00119 00121 00122 00124 public String toString() { 00125 StringBuffer s = new StringBuffer(); 00126 s.append("(" + getLowValue() + "-" + getHighValue() + ") " + getUnit().toString()); 00127 return s.toString(); 00128 } 00129 }