Public Member Functions | |
Point () | |
No-arg constructor for Hibernate. | |
Point (Double value) | |
Constructor for a value. | |
Point (Double value, Relation relation, Double confidenceLevel) throws HDException | |
Constructor for a limit. | |
Point (YAxis yAxis) | |
Constructor binding to a particular axis. | |
Point (YAxis yAxis, Double value) | |
Constructor for a value, binding to a particular axis. | |
Point (YAxis yAxis, Double value, Relation relation, Double confidenceLevel) throws HDException | |
Constructor for a limit, binding to a particular axis. | |
Point | setLimit (Relation relation, Double value, Double confidenceLevel) throws HDException |
Integer | getId () |
Point | setId (Integer pointId) |
Double | getValue () |
Point | setValue (Double value) |
Relation | getRelation () |
Get Relation. | |
Point | setRelation (Relation relation) |
Double | getConfidenceLevel () |
Point | setConfidenceLevel (Double confidenceLevel) throws HDException |
SortedSet< PointError > | getErrors () |
Point | setErrors (SortedSet< PointError > errors) |
Point | setErrors (Collection< PointError > errors) |
Point | setErrors (PointError[] errors) |
Point | addError (PointError error) |
Point | removeError (PointError error) |
YAxis | getYAxis () |
Get containing y-axis. | |
Point | setYAxis (YAxis yAxis) |
Set containing y-axis. | |
Set< Uncertainty > | getDatasetErrors () |
Get errors from parent Dataset. | |
SortedSet< Uncertainty > | getAxisErrors () |
Get errors from parent YAxis. | |
Set< Uncertainty > | getPointErrors () |
Get errors from this point (as generic Errors). | |
SortedSet< Uncertainty > | getAllErrors () |
Get all the errors that apply to this point. | |
SortedSet< Bin > | getBins () |
Get the corresponding Bins from the x-axes in this Dataset. | |
SortedSet< Point > | getPoints () |
Get all the y-axis Points which are in the same row as this one (inclusive). | |
String | toString () |
String representation. | |
String | toString (Integer indentBy) |
String representation with indent. | |
boolean | equals (Object other) |
Override equals method with business key equality. | |
int | hashCode () |
Override hashcode method. | |
int | compareTo (Point other) |
Compare points by comparing central values. | |
Package Functions | |
.hibernate.annotations.CollectionOfElements.hibernate.annotations. | CollectionId (columns=@Column(name="PointErrorId"), type=@org.hibernate.annotations.Type(type="long"), generator="sequence")@org.hibernate.annotations.Sort(type |
Point errors. | |
Logger | log () |
Neat method to allow every class to get hold of a custom-named Logger. |
Definition at line 21 of file Point.java.
Point | ( | ) |
Point | ( | Double | value | ) |
Constructor for a value.
Definition at line 65 of file Point.java.
00065 { 00066 setValue(value); 00067 }
Constructor for a limit.
Definition at line 70 of file Point.java.
00070 { 00071 setLimit(relation, value, confidenceLevel); 00072 }
Constructor binding to a particular axis.
Definition at line 75 of file Point.java.
00075 { 00076 setYAxis(yAxis); 00077 }
Constructor for a value, binding to a particular axis.
Definition at line 80 of file Point.java.
00080 { 00081 this(yAxis); 00082 setValue(value); 00083 }
Constructor for a limit, binding to a particular axis.
Definition at line 86 of file Point.java.
00086 { 00087 this(yAxis); 00088 setLimit(relation, value, confidenceLevel); 00089 }
.hibernate.annotations.CollectionOfElements.hibernate.annotations. CollectionId | ( | columns | = @Column(name="PointErrorId") , |
|
type | = @org.hibernate.annotations.Type(type="long") , |
|||
generator | = "sequence" | |||
) | [package] |
Point errors.
Definition at line 95 of file Point.java.
00095 { 00096 setRelation(relation); // Need to do this first 00097 setValue(value); 00098 setConfidenceLevel(confidenceLevel); 00099 return this; 00100 }
Integer getId | ( | ) |
Point setId | ( | Integer | pointId | ) |
Double getValue | ( | ) |
Point setValue | ( | Double | value | ) |
Relation getRelation | ( | ) |
Get Relation.
Definition at line 129 of file Point.java.
Double getConfidenceLevel | ( | ) |
Point setConfidenceLevel | ( | Double | confidenceLevel | ) | throws HDException |
Definition at line 142 of file Point.java.
00142 { 00143 if (getRelation() != Relation.EQUALS) { 00144 _confidenceLevel = confidenceLevel; 00145 } else { 00146 _confidenceLevel = null; 00147 } 00148 return this; 00149 }
SortedSet<PointError> getErrors | ( | ) |
Point setErrors | ( | SortedSet< PointError > | errors | ) |
Definition at line 156 of file Point.java.
00156 { 00157 getErrors().clear(); 00158 for (PointError e : errors) addError(e); 00159 return this; 00160 }
Point setErrors | ( | Collection< PointError > | errors | ) |
Definition at line 161 of file Point.java.
00161 { 00162 log().debug("Calling setErrors(Collection<PointError>)"); 00163 getErrors().clear(); 00164 for (PointError e : errors) addError(e); 00165 return this; 00166 }
Point setErrors | ( | PointError[] | errors | ) |
Definition at line 167 of file Point.java.
00167 { 00168 setErrors(Arrays.asList(errors)); 00169 return this; 00170 }
Point addError | ( | PointError | error | ) |
Definition at line 171 of file Point.java.
References PointError.getId(), and PointError.setId().
00171 { 00172 if (error != null) { 00173 if (error.getId() == null) { 00174 int highestId = 0; 00175 if (getErrors().size() > 0) { 00176 highestId = getErrors().last().getId(); 00177 } 00178 log().debug("Incrementing point error ID: " + (highestId + 1)); 00179 error.setId(highestId + 1); 00180 } 00181 log().debug("Adding point error: ID = " + error.getId()); 00182 _errors.add(error); 00183 } else { 00184 log().warn("Tried to add a null point error to a point"); 00185 } 00186 return this; 00187 }
Point removeError | ( | PointError | error | ) |
Definition at line 188 of file Point.java.
00188 { 00189 if (error != null) { 00190 _errors.remove(error); 00191 } else { 00192 log().warn("Tried to remove a null point error from a point"); 00193 } 00194 return this; 00195 }
YAxis getYAxis | ( | ) |
Get containing y-axis.
Definition at line 199 of file Point.java.
Referenced by Point.compareTo(), and Point.equals().
Set containing y-axis.
Definition at line 203 of file Point.java.
References YAxis.getPoints().
Referenced by YAxis.addPoint(), and YAxis.removePoint().
00203 { 00204 _yAxis = yAxis; 00205 if (yAxis != null) yAxis.getPoints().add(this); 00206 return this; 00207 }
Set<Uncertainty> getDatasetErrors | ( | ) |
Get errors from parent Dataset.
Definition at line 214 of file Point.java.
00214 { 00215 if (getYAxis() != null) { 00216 return getYAxis().getDatasetErrors(); 00217 } else { 00218 return new HashSet<Uncertainty>(); 00219 } 00220 }
SortedSet<Uncertainty> getAxisErrors | ( | ) |
Set<Uncertainty> getPointErrors | ( | ) |
Get errors from this point (as generic Errors).
Definition at line 230 of file Point.java.
00230 { 00231 return new HashSet<Uncertainty>(getErrors()); 00232 }
SortedSet<Uncertainty> getAllErrors | ( | ) |
Get all the errors that apply to this point.
Definition at line 234 of file Point.java.
00234 { 00235 SortedSet<Uncertainty> allErrors = new TreeSet<Uncertainty>(); 00236 allErrors.addAll(getErrors()); 00237 allErrors.addAll(getAxisErrors()); 00238 allErrors.addAll(getDatasetErrors()); 00239 return allErrors; 00240 }
SortedSet<Bin> getBins | ( | ) |
Get the corresponding Bins from the x-axes in this Dataset.
Definition at line 247 of file Point.java.
References Dataset.getBins(), and YAxis.getDataset().
00247 { 00248 SortedSet<Bin> matchingBins = null; 00249 YAxis y = getYAxis(); 00250 if (y != null) { 00251 Dataset d = y.getDataset(); 00252 if (d != null) { 00253 matchingBins = d.getBins(getId()); 00254 } 00255 } 00256 return matchingBins; 00257 }
SortedSet<Point> getPoints | ( | ) |
Get all the y-axis Points which are in the same row as this one (inclusive).
Definition at line 260 of file Point.java.
References YAxis.getDataset(), and Dataset.getPoints().
00260 { 00261 SortedSet<Point> matchingPoints = null; 00262 YAxis y = getYAxis(); 00263 if (y != null) { 00264 Dataset d = y.getDataset(); 00265 if (d != null) { 00266 matchingPoints = d.getPoints(getId()); 00267 } 00268 } 00269 return matchingPoints; 00270 }
String toString | ( | ) |
String representation.
Reimplemented from Storeable.
Definition at line 277 of file Point.java.
00277 { 00278 return toString(0); 00279 }
String toString | ( | Integer | indentBy | ) |
String representation with indent.
Definition at line 282 of file Point.java.
00282 { 00283 log().debug("Writing out point as a string"); 00284 StringBuffer s = new StringBuffer(); 00285 String indent = ""; 00286 for (int i = 0; i < indentBy; ++i) indent += " "; 00287 00288 s.append(indent + "Point " + getId() + ": "); 00289 if (getAllErrors().size() > 0) s.append("( "); 00290 s.append(getValue()); 00291 for (Uncertainty e : getAllErrors()) { 00292 s.append(" " + e.toString()); 00293 } 00294 if (getAllErrors().size() > 0) s.append(" )"); 00295 if (getYAxis() != null) { 00296 s.append(" " + getYAxis().getUnit().toString()); 00297 } 00298 return s.toString(); 00299 }
boolean equals | ( | Object | other | ) |
Override equals method with business key equality.
Definition at line 306 of file Point.java.
References YAxis.equals(), Point.getValue(), and Point.getYAxis().
00306 { 00307 if (this == other) return true; 00308 if (! (other instanceof Point)) return false; 00309 00310 final Point test = (Point) other; 00311 if (test.getYAxis() != null && !test.getYAxis().equals(getYAxis()) ) return false; 00313 if (test.getValue() != null && getValue() != null && 00314 Math.abs((test.getValue() - getValue())/getValue()) > 1e-6 ) return false; 00315 00316 // If not proven guilty... 00317 return true; 00318 }
int hashCode | ( | ) |
int compareTo | ( | Point | other | ) |
Compare points by comparing central values.
Definition at line 334 of file Point.java.
References Point.getId(), and Point.getYAxis().
00334 { 00335 log().debug("Comparing points..."); 00336 if (getId() == null) { 00337 log().warn("Null Point ID"); 00338 return 1; // Sort null points at the end 00339 } else if (getId() > other.getId()) { 00340 log().debug("Greater than"); 00341 return 1; 00342 } else if (getId() < other.getId()) { 00343 log().debug("Less than"); 00344 return -1; 00345 } else { 00346 log().debug("Point IDs are equal"); 00347 if (getYAxis() != null && other.getYAxis() != null) { 00348 return getYAxis().compareTo(other.getYAxis()); 00349 } else { 00350 return 0; 00351 } 00352 } 00353 }
Logger log | ( | ) | [package, inherited] |
Neat method to allow every class to get hold of a custom-named Logger.
Definition at line 14 of file Storeable.java.
Referenced by Uncertainty.compareTo(), Reference.compareTo(), PointError.compareTo(), Modification.compareTo(), Experiment.compareTo(), DatasetError.compareTo(), AxisError.compareTo(), Data.makeExample(), Data.makeExampleDataset(), Data.makeExampleExperiment(), Data.makeExamplePaper(), Data.makeExampleXAxes(), Data.makeExampleYAxes(), DatasetError.setNormType(), and Uncertainty.toString().