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 voidadd(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.RangercreateCompatibleRanger()Returns a Ranger instance that is compatible with this one.static ScalercreateRangeScaler(Scaling.RangeScaling rscaling, Subrange dataclip, Span span)Returns a scaler based on a RangeScaling.SpancreateSpan()Returns an object characterising the range of data submitted so far.voidsubmitDatum(double datum)Accepts a data value.
-
-
-
Method Detail
-
submitDatum
public void submitDatum(double datum)
Description copied from interface:RangerAccepts a data value.- Specified by:
submitDatumin interfaceRanger- Parameters:
datum- datum
-
add
public void add(Ranger other)
Description copied from interface:RangerMerges 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:RangerReturns 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:
createCompatibleRangerin interfaceRanger- Returns:
- new compatible ranger instance
-
createSpan
public Span createSpan()
Description copied from interface:RangerReturns 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:
createSpanin 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
-
-