Public Member Functions | |
PointError () | |
Default constructor. | |
PointError (Double plusminus, ErrorSource sourcetype, ErrorNorm normtype) | |
Constructor for symmetric error. | |
PointError (Double plus, Double minus, ErrorSource sourcetype, ErrorNorm normtype) | |
Constructor for asymmetric errors. | |
PointError (Point parent, Double plusminus, ErrorSource sourcetype, ErrorNorm normtype) | |
Constructor for symmetric error, with parent point. | |
PointError (Point parent, Double plus, Double minus, ErrorSource sourcetype, ErrorNorm normtype) | |
Constructor for asymmetric errors, with parent point. | |
Uncertainty | getAbsoluteError () throws HDException |
Get the absolute error corresponding to this error and its point's value. | |
Uncertainty | getAbsoluteError (Point p) throws HDException |
Get the absolute error corresponding to this error and a given point (which must be this error's parent point). | |
Integer | getId () |
Get the point error ID. | |
PointError | setId (Integer pointErrorId) |
Set the point error ID. | |
Point | getPoint () |
Get the parent point. | |
PointError | setPoint (Point parentPoint) |
Set the parent point. | |
int | compareTo (PointError other) |
boolean | equals (Object other) |
Override equals method with business key equality. | |
int | hashCode () |
Override hashcode method. | |
boolean | isSymmetric () |
Are the plus and minus errors symmetric? | |
boolean | hasZeroSize () |
Are the plus and minus errors both zero? | |
Double | getPlus () |
Get the upward error. | |
Uncertainty | setPlus (Double plus) |
Set the upward error. | |
Double | getMinus () |
Get the downward error. | |
Uncertainty | setMinus (Double minus) |
Set the downward error. | |
ErrorSource | getSourceType () |
Get the error source type (stat, sys, etc. | |
Uncertainty | setSourceType (ErrorSource sourcetype) |
Set the error source type (stat, sys, etc. | |
ErrorNorm | getNormType () |
Get the error normalization type (abs, frac, pct, etc. | |
Uncertainty | setNormType (ErrorNorm normtype) |
Set the error normalization type (abs, frac, pct, etc. | |
String | getComment () |
Get the modification comment string. | |
Uncertainty | setComment (String comment) |
Set the modification comment string. | |
int | compareTo (Uncertainty other) |
String | toString () |
String representation. | |
String | toString (Integer indentBy) |
Indented string representation. | |
Package Functions | |
Logger | log () |
Neat method to allow every class to get hold of a custom-named Logger. |
as stored by a Value.
Definition at line 14 of file PointError.java.
PointError | ( | ) |
PointError | ( | Double | plusminus, | |
ErrorSource | sourcetype, | |||
ErrorNorm | normtype | |||
) |
Constructor for symmetric error.
plusminus | : size of symmetric error | |
sourcetype | : origin of error, i.e. systematic, statistical, etc. | |
normtype | : normalisation of error, i.e. absolute, fractional, percentage, etc. |
Definition at line 41 of file PointError.java.
PointError | ( | Double | plus, | |
Double | minus, | |||
ErrorSource | sourcetype, | |||
ErrorNorm | normtype | |||
) |
Constructor for asymmetric errors.
plus | input <0 gives -err1 | |
minus | input <0 gives +err2 | |
sourcetype | : origin of error, i.e. systematic, statistical, etc. | |
normtype | : normalisation of error, i.e. absolute, fractional, percentage, etc. |
Definition at line 52 of file PointError.java.
PointError | ( | Point | parent, | |
Double | plusminus, | |||
ErrorSource | sourcetype, | |||
ErrorNorm | normtype | |||
) |
Constructor for symmetric error, with parent point.
Definition at line 59 of file PointError.java.
References PointError.setPoint().
00059 { 00060 super(plusminus, sourcetype, normtype); 00061 setPoint(parent); 00062 }
PointError | ( | Point | parent, | |
Double | plus, | |||
Double | minus, | |||
ErrorSource | sourcetype, | |||
ErrorNorm | normtype | |||
) |
Constructor for asymmetric errors, with parent point.
Definition at line 67 of file PointError.java.
References PointError.setPoint().
00067 { 00068 super(plus, minus, sourcetype, normtype); 00069 setPoint(parent); 00070 }
Uncertainty getAbsoluteError | ( | ) | throws HDException |
Get the absolute error corresponding to this error and its point's value.
Definition at line 77 of file PointError.java.
References Uncertainty.getAbsoluteError(), and PointError.getPoint().
00077 { 00078 return super.getAbsoluteError(getPoint()); 00079 }
Uncertainty getAbsoluteError | ( | Point | p | ) | throws HDException |
Get the absolute error corresponding to this error and a given point (which must be this error's parent point).
Reimplemented from Uncertainty.
Definition at line 83 of file PointError.java.
References PointError.getPoint().
00083 { 00084 if (! p.equals(getPoint())) { 00085 throw new HDException("Tried to apply a point error to a point other than its owner."); 00086 } 00087 return super.getAbsoluteError(p); 00088 }
Integer getId | ( | ) |
Get the point error ID.
Definition at line 95 of file PointError.java.
Referenced by Point.addError(), PointError.compareTo(), and PointError.hashCode().
PointError setId | ( | Integer | pointErrorId | ) |
Set the point error ID.
Definition at line 99 of file PointError.java.
Referenced by Point.addError().
Point getPoint | ( | ) |
Get the parent point.
Definition at line 109 of file PointError.java.
Referenced by PointError.getAbsoluteError().
PointError setPoint | ( | Point | parentPoint | ) |
Set the parent point.
Definition at line 114 of file PointError.java.
Referenced by PointError.PointError().
int compareTo | ( | PointError | other | ) |
Definition at line 123 of file PointError.java.
References PointError.getId(), and Storeable.log().
Referenced by Uncertainty.compareTo().
00123 { 00124 log().debug("Comparing point errors..."); 00125 if (getId() == null) { 00126 log().warn("Null point error ID"); 00127 return 1; // Sort null point errors at the end 00128 } else if (getId() > other.getId()) { 00129 log().debug("Greater than"); 00130 return 1; 00131 } else if (getId() < other.getId()) { 00132 log().debug("Less than"); 00133 return -1; 00134 } else { 00135 log().debug("Equal to"); 00136 return 0; 00137 } 00138 }
boolean equals | ( | Object | other | ) |
Override equals method with business key equality.
Definition at line 145 of file PointError.java.
References PointError.hashCode().
00145 { 00146 if (this == other) return true; 00147 if (! (other instanceof PointError)) return false; 00148 return hashCode() == other.hashCode(); 00149 }
int hashCode | ( | ) |
Override hashcode method.
Definition at line 152 of file PointError.java.
References PointError.getId(), Uncertainty.getMinus(), Uncertainty.getNormType(), Uncertainty.getPlus(), and Uncertainty.getSourceType().
Referenced by PointError.equals().
00152 { 00153 int code = 23; 00154 if (getSourceType() != null) code ^= getSourceType().hashCode(); 00155 if (getNormType() != null) code ^= getNormType().hashCode(); 00156 if (getId() != null) code ^= getId().hashCode(); 00158 if (getPlus() != null) code ^= 2 * getPlus().hashCode(); // ensure this is even 00159 if (getMinus() != null) code ^= 2 * getMinus().hashCode() + 1; // ensure this is odd 00160 return code; 00161 }
boolean isSymmetric | ( | ) | [inherited] |
Are the plus and minus errors symmetric?
Definition at line 88 of file Uncertainty.java.
References Uncertainty.getMinus(), and Uncertainty.getPlus().
Referenced by Uncertainty.toString().
boolean hasZeroSize | ( | ) | [inherited] |
Are the plus and minus errors both zero?
Definition at line 94 of file Uncertainty.java.
References Uncertainty.getMinus(), and Uncertainty.getPlus().
Double getPlus | ( | ) | [inherited] |
Get the upward error.
Definition at line 132 of file Uncertainty.java.
Referenced by AxisError.equals(), Uncertainty.getAbsoluteError(), PointError.hashCode(), DatasetError.hashCode(), AxisError.hashCode(), Uncertainty.hasZeroSize(), Uncertainty.isSymmetric(), and Uncertainty.toString().
Uncertainty setPlus | ( | Double | plus | ) | [inherited] |
Set the upward error.
Definition at line 137 of file Uncertainty.java.
Referenced by Uncertainty.Uncertainty().
Double getMinus | ( | ) | [inherited] |
Get the downward error.
Definition at line 145 of file Uncertainty.java.
Referenced by AxisError.equals(), Uncertainty.getAbsoluteError(), PointError.hashCode(), DatasetError.hashCode(), AxisError.hashCode(), Uncertainty.hasZeroSize(), Uncertainty.isSymmetric(), and Uncertainty.toString().
Uncertainty setMinus | ( | Double | minus | ) | [inherited] |
Set the downward error.
Definition at line 150 of file Uncertainty.java.
Referenced by Uncertainty.Uncertainty().
ErrorSource getSourceType | ( | ) | [inherited] |
Get the error source type (stat, sys, etc.
) as an enum.
Definition at line 158 of file Uncertainty.java.
Referenced by AxisError.equals(), Uncertainty.getAbsoluteError(), PointError.hashCode(), DatasetError.hashCode(), AxisError.hashCode(), and Uncertainty.toString().
Uncertainty setSourceType | ( | ErrorSource | sourcetype | ) | [inherited] |
Set the error source type (stat, sys, etc.
) from the enum.
Definition at line 163 of file Uncertainty.java.
Referenced by Uncertainty.Uncertainty().
ErrorNorm getNormType | ( | ) | [inherited] |
Get the error normalization type (abs, frac, pct, etc.
) as an enum.
Definition at line 170 of file Uncertainty.java.
Referenced by AxisError.equals(), Uncertainty.getAbsoluteError(), PointError.hashCode(), DatasetError.hashCode(), AxisError.hashCode(), and Uncertainty.toString().
Uncertainty setNormType | ( | ErrorNorm | normtype | ) | [inherited] |
Set the error normalization type (abs, frac, pct, etc.
) from the enum.
Reimplemented in DatasetError.
Definition at line 174 of file Uncertainty.java.
Referenced by Uncertainty.Uncertainty().
String getComment | ( | ) | [inherited] |
Get the modification comment string.
Definition at line 181 of file Uncertainty.java.
Referenced by Uncertainty.toString().
Uncertainty setComment | ( | String | comment | ) | [inherited] |
int compareTo | ( | Uncertainty | other | ) | [inherited] |
Definition at line 194 of file Uncertainty.java.
References DatasetError.compareTo(), AxisError.compareTo(), PointError.compareTo(), and Storeable.log().
00194 { 00195 log().debug("Comparing errors..."); 00196 00197 // For point errors 00198 if (this instanceof PointError) { 00199 if (other instanceof PointError) { 00200 PointError test = (PointError) this; 00201 int result = test.compareTo((PointError) other); 00202 if (result != 0) return result; 00203 } else return 1; 00204 } 00205 00206 // For axis errors 00207 if (this instanceof AxisError) { 00208 if (other instanceof AxisError) { 00209 AxisError test = (AxisError) this; 00210 int result = test.compareTo((AxisError) other); 00211 if (result != 0) return result; 00212 } else return (other instanceof PointError) ? -1 : 1; 00213 } 00214 00215 // For dataset errors 00216 if (this instanceof DatasetError) { 00217 if (other instanceof DatasetError) { 00218 DatasetError test = (DatasetError) this; 00219 int result = test.compareTo((DatasetError) other); 00220 if (result != 0) return result; 00221 } else return 1; 00222 } 00223 00225 return 0; 00226 }
String toString | ( | ) | [inherited] |
String representation.
Reimplemented from Storeable.
Definition at line 234 of file Uncertainty.java.
Referenced by Uncertainty.toString().
00234 { 00235 return toString(0); 00236 }
String toString | ( | Integer | indentBy | ) | [inherited] |
Indented string representation.
Definition at line 240 of file Uncertainty.java.
References Uncertainty.getComment(), Uncertainty.getMinus(), Uncertainty.getNormType(), Uncertainty.getPlus(), Uncertainty.getSourceType(), Uncertainty.isSymmetric(), Storeable.log(), and Uncertainty.toString().
00240 { 00241 log().debug("Writing out error as a string"); 00242 StringBuffer s = new StringBuffer(); 00243 String indent = ""; 00244 for (int i = 0; i < indentBy; ++i) indent += " "; 00245 00246 //if (! hasZeroSize()) { 00247 s.append(indent); 00248 Double plusval = getPlus(); 00249 Double minusval = getMinus(); 00250 00251 String numFormat = "###.##"; 00252 // Use the number formatter to recalculate and display everything as a percentage 00253 if (getNormType() == ErrorNorm.PCT) { 00254 plusval /= 100; 00255 minusval /= 100; 00256 } 00257 if (getNormType() == ErrorNorm.FRAC || getNormType() == ErrorNorm.PCT) { 00258 numFormat += "%"; // multiplies by 100 and sticks "%" on the end 00259 } 00260 DecimalFormat numFormatter = new DecimalFormat(numFormat); 00261 if (isSymmetric()) { 00262 s.append("+- " + numFormatter.format(plusval)); 00263 } else { 00264 s.append("+ " + numFormatter.format(plusval)); 00265 s.append(" - " + numFormatter.format(minusval)); 00266 } 00267 s.append(" ("); 00268 //s.append(getNormType().toString()); 00269 //s.append(", "); 00270 s.append(getSourceType().toString()); 00271 s.append(")"); 00272 if (getComment() != null && getComment().length() != 0) { 00273 s.append(" [" + getComment() + "]"); 00274 } 00275 //} 00276 return s.toString(); 00277 }
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().