net.agmodel.physical
Class JigsawQuantity

java.lang.Object
  |
  +--net.agmodel.physical.JigsawQuantity

public class JigsawQuantity
extends Object

Represents a measurement which may have estimated or missing components.
For example, a daily average temperature derived from hourly averages which include some missing data,
or hourly data which has been linearly interpolated over a short gap of a couple of hours.
This class lets applications choose how to handle such partial or estimated data.


Field Summary
static float COMPLETE
          Indicates that there was not any missing data during the interval this value represents
static float DEFAULTMISSINGTHRESHOLD
          The default maximum threshold for data coverage to be regarded as missing.
static float DEFAULTSUFFICIENTTHRESHOLD
          The default minimum threshold for data coverage to be regarded as sufficient.
static float DEVOID
          Indicates that there was not any data available within in the interval this value represents
static JigsawQuantity EMPTY
          Indicates that there was not any data available within in the interval this value represents
protected static String missing
          The string used to represent missing values
protected static float missingThreshold
          Coverage <= this value is regarded as missing;
protected static NumberFormat outF
           
protected static int SPATIALLYINTERPOLATED
           
protected static float sufficientThreshold
          Coverage > this value is regarded as complete;
protected static int TEMPORALLYINTERPOLATED
           
protected static int UNINTERPOLATED
           
 
Constructor Summary
JigsawQuantity(double amount, float coverage, boolean spatiallyInterpolated, boolean temporallyInterpolated)
          Creates a jigsaw quantity
 
Method Summary
 double getAmount()
          Returns the amount, without any indication of quality.
 float getCoverage()
          The extent to which the raw data required to calculate the value were available.
static String getMissing()
          Gets the string output by toString{} to represent DEVOID values
static float getMissingThreshold()
          Gets the value used as the threshold for missing values.
static NumberFormat getNumberFormat()
          Gets the internal number format used by toString()
static float getSufficientThreshold()
          Gets the value used as the threshold for missing values.
 boolean isSpatiallyInterpolated()
          Whether temporal interpolation was used to estimate the value
 boolean isTemporallyInterpolated()
          Whether spatial interpolation was used to estimate the value
 void setAmount(double amount)
          Sets the amount
static void setMissing(String toOutput)
          Sets the string output by toString{} to represent DEVOID values
static void setNumberFormat(NumberFormat format)
          Sets the internal number format used by toString()
static void setThresholds(float aMissingThreshold, float aSufficientThreshold)
          Sets the value used as the threshold for missing values.
 String toString()
          Creates a default string representation of the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMPLETE

public static final float COMPLETE
Indicates that there was not any missing data during the interval this value represents

See Also:
Constant Field Values

DEVOID

public static final float DEVOID
Indicates that there was not any data available within in the interval this value represents

See Also:
Constant Field Values

DEFAULTMISSINGTHRESHOLD

public static final float DEFAULTMISSINGTHRESHOLD
The default maximum threshold for data coverage to be regarded as missing.

See Also:
Constant Field Values

DEFAULTSUFFICIENTTHRESHOLD

public static final float DEFAULTSUFFICIENTTHRESHOLD
The default minimum threshold for data coverage to be regarded as sufficient.

See Also:
Constant Field Values

EMPTY

public static final JigsawQuantity EMPTY
Indicates that there was not any data available within in the interval this value represents


missing

protected static String missing
The string used to represent missing values


missingThreshold

protected static float missingThreshold
Coverage <= this value is regarded as missing;


sufficientThreshold

protected static float sufficientThreshold
Coverage > this value is regarded as complete;


outF

protected static NumberFormat outF

UNINTERPOLATED

protected static final int UNINTERPOLATED
See Also:
Constant Field Values

TEMPORALLYINTERPOLATED

protected static final int TEMPORALLYINTERPOLATED
See Also:
Constant Field Values

SPATIALLYINTERPOLATED

protected static final int SPATIALLYINTERPOLATED
See Also:
Constant Field Values
Constructor Detail

JigsawQuantity

public JigsawQuantity(double amount,
                      float coverage,
                      boolean spatiallyInterpolated,
                      boolean temporallyInterpolated)
Creates a jigsaw quantity

Parameters:
amount - the value of the measurement
coverage - the extent to which the raw data required to calculate the value were available, ranging from COMPLETE to DEVOID
spatiallyInterpolated - whether spatial interpolation was used to estimate the value.
temporallyInterpolated - whether temporal interpolation was used to estimate the value.
Method Detail

setMissing

public static void setMissing(String toOutput)
Sets the string output by toString{} to represent DEVOID values


getMissing

public static String getMissing()
Gets the string output by toString{} to represent DEVOID values


setThresholds

public static void setThresholds(float aMissingThreshold,
                                 float aSufficientThreshold)
Sets the value used as the threshold for missing values.
Data with coverage equal to or less than this value is regarded as missing.


getMissingThreshold

public static float getMissingThreshold()
Gets the value used as the threshold for missing values.
Data with coverage equal to or less than this value is regarded as missing.


getSufficientThreshold

public static float getSufficientThreshold()
Gets the value used as the threshold for missing values.
Data with coverage equal to or less than this value is regarded as missing.


setNumberFormat

public static void setNumberFormat(NumberFormat format)
Sets the internal number format used by toString()

Parameters:
format - the NumberFormat to use (cloned by the method)

getNumberFormat

public static NumberFormat getNumberFormat()
Gets the internal number format used by toString()


isTemporallyInterpolated

public boolean isTemporallyInterpolated()
Whether spatial interpolation was used to estimate the value

Returns:
true if the value was spatially interpolated, false otherwise

isSpatiallyInterpolated

public boolean isSpatiallyInterpolated()
Whether temporal interpolation was used to estimate the value

Returns:
true if the value was temporally interpolated, false otherwise

getCoverage

public float getCoverage()
The extent to which the raw data required to calculate the value were available.

Returns:
COMPLETE if all the data were available, DEVOID if no data were available

getAmount

public double getAmount()
Returns the amount, without any indication of quality.

Returns:
the amount

setAmount

public void setAmount(double amount)
Sets the amount


toString

public String toString()
Creates a default string representation of the value. If coverage is complete, just output the value formatted to 3 decimal places. If coverage is greater than sufficientThreshold but < complete, output the value between single quotes. If coverage is <= sufficientThreshold and > 0.5, output value between square brackets.
If coverage is <= 0.5 and > missingThreshold, output value between round brackets.
If coverage is <= missingThreshold and > 0, output value between curly brackets.
If coverage is 0 output the missing string.

Overrides:
toString in class Object
Returns:
the resulting string