Package uk.ac.starlink.ttools.plot2
Class BasicRanger
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.BasicRanger
-
-
Constructor Summary
Constructors Constructor Description BasicRanger(boolean isBestEfforts)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Ranger other)
Merges the contents of the supplied ranger into this one.static double[]
calculateFiniteBounds(double lo, double hi, boolean isPositive)
Returns a 2-element array giving definite lower and upper bounds based on known lower and upper values.Ranger
createCompatibleRanger()
Returns a Ranger instance that is compatible with this one.static Scaler
createRangeScaler(Scaling.RangeScaling rscaling, Subrange dataclip, Span span)
Returns a scaler based on a RangeScaling.Span
createSpan()
Returns an object characterising the range of data submitted so far.void
submitDatum(double datum)
Accepts a data value.
-
-
-
Method Detail
-
submitDatum
public void submitDatum(double datum)
Description copied from interface:Ranger
Accepts a data value.- Specified by:
submitDatum
in interfaceRanger
- Parameters:
datum
- datum
-
add
public void add(Ranger other)
Description copied from interface:Ranger
Merges the contents of the supplied ranger into this one. The effect is as if all the results accumulated into other had been accumulated into this one. The effect on the supplied other is undefined.The supplied ranger is assumed to be compatible with this one, which probably means created in the same way. If not, some RuntimeException such as a ClassCastException may result.
-
createCompatibleRanger
public Ranger createCompatibleRanger()
Description copied from interface:Ranger
Returns a Ranger instance that is compatible with this one. It has no content (does not copy any data from this one), but the two may be merged using theRanger.add(uk.ac.starlink.ttools.plot2.Ranger)
method.- Specified by:
createCompatibleRanger
in interfaceRanger
- Returns:
- new compatible ranger instance
-
createSpan
public Span createSpan()
Description copied from interface:Ranger
Returns an object characterising the range of data submitted so far. This should not be called while another thread might be callingRanger.submitDatum(double)
.- Specified by:
createSpan
in interfaceRanger
- Returns:
- span of accumulated data
-
calculateFiniteBounds
public static double[] calculateFiniteBounds(double lo, double hi, boolean isPositive)
Returns a 2-element array giving definite lower and upper bounds based on known lower and upper values. The upper bound will be strictly greater than the lower bound. Optionally, both bounds can be required to be strictly greater than zero. If the input values are insufficient to determine such return values, some reasonable defaults will be made up.- Parameters:
lo
- input lower bound, may be NaNhi
- input upper bound, may be NaNisPositive
- if true, output bounds must be positive- Returns:
- 2-element array giving (lo,hi)
-
createRangeScaler
public static Scaler createRangeScaler(Scaling.RangeScaling rscaling, Subrange dataclip, Span span)
Returns a scaler based on a RangeScaling.- Parameters:
rscaling
- scaling of range typedataclip
- input data range adjustmentspan
- data range information- Returns:
- new scaler
-
-