Public Member Functions | |
Bin () | |
Default constructor. | |
Bin (Double centralValue) | |
Bin (Double lowValue, Double highValue) | |
Bin (Double lowValue, Double highValue, Double focus) | |
Bin (XAxis xAxis) | |
Bin (XAxis xAxis, Double centralValue) | |
Bin (XAxis xAxis, Double lowValue, Double highValue) | |
Bin (XAxis xAxis, Double lowValue, Double highValue, Double focus) | |
Integer | getId () |
Get bin ID. | |
Bin | setId (Integer binId) |
Set bin ID. | |
Double | getFocus () |
Get the nominal central value, not necessarily the gemetric centre. | |
Bin | setFocus (Double focus) |
Set the nominal "central point" of the bin - not necessarily the geometric centre. | |
Relation | getRelation () |
Get bin-edge Relation. | |
Bin | setRelation (Relation relation) |
Set the bin relation - see the get method for details. | |
Double | getLowValue () |
Get low edge value. | |
Bin | setLowValue (Double lowValue) |
Set low edge value. | |
Double | getHighValue () |
Get high edge value. | |
Bin | setHighValue (Double highValue) |
Set high edge value. | |
Double | getWidth () |
Get bin width. | |
Bin | setWidth (Double width) |
Set bin width. | |
XAxis | getXAxis () |
Get containing x-axis. | |
Bin | setXAxis (XAxis xAxis) |
Set containing x-axis. | |
SortedSet< Bin > | getBins () |
Get all the x-axis Bins which are in the same row as this one (inclusive). | |
SortedSet< Point > | getPoints () |
Get the corresponding Points from the y-axes in this Dataset. | |
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 (Bin other) |
Compare bins by comparing Ids. | |
Package Functions | |
Logger | log () |
Neat method to allow every class to get hold of a custom-named Logger. |
Definition at line 18 of file Bin.java.
Bin | ( | Double | centralValue | ) |
Bin | ( | Double | lowValue, | |
Double | highValue | |||
) |
Definition at line 67 of file Bin.java.
00067 { 00068 setLowValue(lowValue); 00069 setHighValue(highValue); 00070 }
Bin | ( | Double | lowValue, | |
Double | highValue, | |||
Double | focus | |||
) |
Integer getId | ( | ) |
Bin setId | ( | Integer | binId | ) |
Double getFocus | ( | ) |
Get the nominal central value, not necessarily the gemetric centre.
If the focus has not been defined, the geometric centre will be calculated.
Definition at line 113 of file Bin.java.
00113 { 00114 if (_focus != null) return _focus; 00115 00116 // Fall back to calculating the geometric centre 00117 log().debug("Asked for focus, but focus is null."); 00118 if (getLowValue() != null && getHighValue() != null) { 00119 log().info("Calculating central value from high and low edges"); 00120 return (getLowValue() + getHighValue()) / 2.0; 00121 } else { 00122 log().warn("Could neither retrieve nor calculate bin focus."); 00123 return null; 00124 } 00125 }
Bin setFocus | ( | Double | focus | ) |
Relation getRelation | ( | ) |
Get bin-edge Relation.
The relation can give different meanings to the bin edge values: the normal EQUALS relation means the bin edges should be taken as low and high limits as normal.
A "greater-type" relation means that the bin extends from its low edge upwards to infinity and a "less-type" relation will extend the bin from the high edge down to the negative limit. The "unused" edges can be used in these cases to specify a realistic upper or lower limit as appropriate.
Obviously, use of non-EQUALS relations should be restricted to the lowest and highest bins on the axis.
Definition at line 147 of file Bin.java.
Double getLowValue | ( | ) |
Bin setLowValue | ( | Double | lowValue | ) |
Double getHighValue | ( | ) |
Bin setHighValue | ( | Double | highValue | ) |
Double getWidth | ( | ) |
Get bin width.
Definition at line 182 of file Bin.java.
00182 { 00183 if (_width == null) { 00184 log().info("Asked for width, but Width is null."); 00185 if (getHighValue() != null && getLowValue() != null) { 00186 log().info("Calculating width from high and low edges"); 00187 return Math.abs(getHighValue() - getLowValue()); 00188 } 00189 } 00190 return _width; 00191 }
Bin setWidth | ( | Double | width | ) |
XAxis getXAxis | ( | ) |
Set containing x-axis.
Definition at line 206 of file Bin.java.
References XAxis.getBins(), and XAxis.getId().
Referenced by XAxis.addBin(), and XAxis.removeBin().
00206 { 00207 _xAxis = xAxis; 00208 if (getXAxis() != null) { 00209 if (getId() == null) { 00210 int highestId = 0; 00211 if (xAxis.getBins().size() > 0) { 00212 highestId = xAxis.getBins().last().getId(); 00213 } 00214 log().debug("Incrementing bin ID: " + (highestId + 1)); 00215 setId(highestId + 1); 00216 } 00217 log().debug("Adding bin to x-axis " + xAxis.getId() + ": ID = " + getId()); 00218 getXAxis().getBins().add(this); 00219 } 00220 return this; 00221 }
SortedSet<Bin> getBins | ( | ) |
Get all the x-axis Bins which are in the same row as this one (inclusive).
Definition at line 228 of file Bin.java.
References Dataset.getBins(), and XAxis.getDataset().
00228 { 00229 SortedSet<Bin> matchingBins = null; 00230 XAxis x = getXAxis(); 00231 if (x != null) { 00232 Dataset d = x.getDataset(); 00233 if (d != null) { 00234 matchingBins = d.getBins(getId()); 00235 } 00236 } 00237 return matchingBins; 00238 }
SortedSet<Point> getPoints | ( | ) |
Get the corresponding Points from the y-axes in this Dataset.
Definition at line 241 of file Bin.java.
References XAxis.getDataset(), and Dataset.getPoints().
00241 { 00242 SortedSet<Point> matchingPoints = null; 00243 XAxis x = getXAxis(); 00244 if (x != null) { 00245 Dataset d = x.getDataset(); 00246 if (d != null) { 00247 matchingPoints = d.getPoints(getId()); 00248 } 00249 } 00250 return matchingPoints; 00251 }
String toString | ( | ) |
String toString | ( | Integer | indentBy | ) |
String representation with indent.
Definition at line 263 of file Bin.java.
00263 { 00264 log().debug("Writing out x-axis as a string"); 00265 StringBuffer s = new StringBuffer(); 00266 String indent = ""; 00267 for (int i = 0; i < indentBy; ++i) indent += " "; 00268 00269 s.append(indent + "Bin " + getId() + ": "); 00270 if (getLowValue() != null && getHighValue() != null) { 00271 s.append(getLowValue() + " - " + getHighValue()); 00272 } else if (getFocus() != null) { 00273 s.append(getFocus()); 00274 if (getWidth() != null) { 00275 s.append(" (width = " + getWidth() + ")"); 00276 } 00277 } 00278 return s.toString(); 00279 }
boolean equals | ( | Object | other | ) |
int hashCode | ( | ) |
int compareTo | ( | Bin | other | ) |
Compare bins by comparing Ids.
Definition at line 307 of file Bin.java.
References Bin.getId(), and Bin.getXAxis().
00307 { 00308 log().debug("Comparing bins..."); 00309 if (getId() == null) { 00310 log().warn("Null Bin ID"); 00312 return 1; // Sort null bins at the end 00313 } else if (getId() > other.getId()) { 00314 log().debug("Greater than"); 00315 return 1; 00316 } else if (getId() < other.getId()) { 00317 log().debug("Less than"); 00318 return -1; 00319 } else { 00320 log().debug("Bin IDs are equal"); 00321 if (getXAxis() != null && other.getXAxis() != null) { 00322 return getXAxis().compareTo(other.getXAxis()); 00323 } else { 00324 return 0; 00325 } 00326 } 00327 }
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(), AxisError.setAxis(), DatasetError.setDataset(), DatasetError.setNormType(), PointError.setPoint(), and Uncertainty.toString().