org.hd.d.pg2k.svrCore.vars
Class SimpleNumberStats

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.vars.SimpleVarStats
      extended by org.hd.d.pg2k.svrCore.vars.SimpleNumberStats

public final class SimpleNumberStats
extends SimpleVarStats

Immutable simple stats derived from a NUMBER globalMap variable. Has a toString() method directly usable on a JSP page.

Captures a reference to the value it was constructed from.

For most combination operators such as getSum(), values are manipulated as double (as risk of precision loss) to:


Field Summary
private  java.text.DecimalFormat format
          Our computed formatting object; never null.
private  java.lang.String pattern
          The pattern String; never null.
 
Fields inherited from class org.hd.d.pg2k.svrCore.vars.SimpleVarStats
filteredVar
 
Constructor Summary
SimpleNumberStats(SimpleVariableValue originalVar, long oldestAllowed, InstanceID sysID, java.lang.String decimalFormatPattern)
          Construct a new instance, filtering variable globalMap members by age.
 
Method Summary
 java.lang.Number getMax()
          Gets the maximum of the non-null values.
 java.lang.Number getMin()
          Gets the minimum of the non-null values.
 java.lang.String getPattern()
          Get the pattern String; never null.
 java.lang.Number getSum()
          Gets the total of the non-null values.
 java.lang.String toString()
          Returns HTML- and human- friendly summary of numerical stats.
 
Methods inherited from class org.hd.d.pg2k.svrCore.vars.SimpleVarStats
getFilteredVar, getMainValue, getNonNullValueCount, getSystemCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pattern

private final java.lang.String pattern
The pattern String; never null.


format

private final transient java.text.DecimalFormat format
Our computed formatting object; never null. Not immutable, so must nto be passed outside the class.

Constructor Detail

SimpleNumberStats

public SimpleNumberStats(SimpleVariableValue originalVar,
                         long oldestAllowed,
                         InstanceID sysID,
                         java.lang.String decimalFormatPattern)
Construct a new instance, filtering variable globalMap members by age.

Parameters:
originalVar - the variable to compute; must be non-null TYPE_NUMBER (and getValue() must return non-null value)
oldestAllowed - any globalMap entry than this will be ignored, which allows only up-to-date information to be included
decimalFormatPattern - numeric formatting string to be used for display of most quantities; never null
sysID - identifies this system so we can select the local value of a global variable if available; can be null
Method Detail

getPattern

public java.lang.String getPattern()
Get the pattern String; never null.


getSum

public java.lang.Number getSum()
Gets the total of the non-null values. If there are no usable globalMap values, then this returns the main value, which may be null.


getMax

public java.lang.Number getMax()
Gets the maximum of the non-null values. If there are no usable globalMap values, then this returns the main value, which may be null.


getMin

public java.lang.Number getMin()
Gets the minimum of the non-null values. If there are no usable globalMap values, then this returns the main value, which may be null.


toString

public java.lang.String toString()
Returns HTML- and human- friendly summary of numerical stats. This does not include the variable name.

If the count is zero, just returns a formatted version of the value.

Overrides:
toString in class SimpleVarStats

DHD Multimedia Gallery V1.57.21

Copyright (c) 1996-2011, Damon Hart-Davis. All rights reserved.