Property.java

Go to the documentation of this file.
00001 package cedar.hepdata.model;
00002 
00003 import cedar.hepdata.util.*;
00004 
00005 import javax.persistence.*;
00006 
00013 @Entity
00014 @Table(name="BaseProperties")
00015 @Inheritance(strategy=InheritanceType.JOINED)
00016 public abstract class Property extends Storeable {
00018     @Id @GeneratedValue
00019     @Column(name="PROPERTY_ID")
00020     private Long _id = null;
00021 
00023     @Column(name="Name", nullable=false)
00024     private String _name;
00025 
00027     @Column(name="LowValue", nullable=false)
00028     private Double _lowValue;
00029 
00031     @Column(name="HighValue", nullable=false)
00032     private Double _highValue;
00033 
00035     @Column(name="Unit", nullable=false)
00036     @org.hibernate.annotations.Type(type="cedar.hepdata.db.UnitUserType")
00037     private Unit _unit = new Unit();
00038 
00039 
00041 
00042 
00044     public Property() {}
00045 
00047     public Property(String name) {
00048         setName(name);
00049     }
00050 
00052     public Property(String name, Unit unit, Double lowValue, Double highValue) {
00053         setName(name);
00054         setValues(unit, lowValue, highValue);
00055     }
00056 
00057 
00059 
00060 
00062     public Property setValues(Unit unit, Double lowValue, Double highValue) {
00063         setUnit(unit);
00064         setLowValue(lowValue);
00065         setHighValue(highValue);
00066         return this;
00067     }
00068 
00069 
00071 
00072 
00074     public String getName() {
00075         return _name;
00076     }
00077 
00079     public Property setName(String name) {
00080         _name = name;
00081         return this;
00082     }
00083 
00084 
00086     public Double getLowValue() {
00087         return _lowValue;
00088     }
00089 
00091     public Property setLowValue(Double lowValue) {
00092         _lowValue = lowValue;
00093         return this;
00094     }
00095 
00096 
00098     public Double getHighValue() {
00099         return _highValue;
00100     }
00101 
00103     public Property setHighValue(Double highValue) {
00104         _highValue = highValue;
00105         return this;
00106     }
00107 
00108 
00110     public Unit getUnit() {
00111         return _unit;
00112     }
00113 
00115     public Property setUnit(Unit unit) {
00116         _unit = unit;
00117         return this;
00118     }
00119 
00120 
00122 
00123 
00125     public String toString() {
00126         StringBuffer s = new StringBuffer();
00127         s.append("(" + getLowValue() + "-" + getHighValue() + ") " + getUnit().toString());
00128         return s.toString();
00129     }
00130 }

Generated on Thu Sep 20 11:41:37 2007 by  doxygen 1.5.3