Package uk.ac.starlink.ttools.plot2
Class BasicRanger
java.lang.Object
uk.ac.starlink.ttools.plot2.BasicRanger
- All Implemented Interfaces:
Ranger
Ranger implementation that just keeps track of high and low values.
- Since:
- 14 Mar 2019
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.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.Returns an object characterising the range of data submitted so far.void
submitDatum
(double datum) Accepts a data value.
-
Constructor Details
-
BasicRanger
public BasicRanger(boolean isBestEfforts) Constructor.- Parameters:
isBestEfforts
- whether best efforts ranging should be done without complaint for inappropriate scalings
-
-
Method Details
-
submitDatum
public void submitDatum(double datum) Description copied from interface:Ranger
Accepts a data value.- Specified by:
submitDatum
in interfaceRanger
- Parameters:
datum
- datum
-
add
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
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
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
Returns a scaler based on a RangeScaling.- Parameters:
rscaling
- scaling of range typedataclip
- input data range adjustmentspan
- data range information- Returns:
- new scaler
-