org.hd.d.pg2k.svrCore
Class VarTools

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.VarTools

public final class VarTools
extends java.lang.Object

This class has tools handling common SystemVariables.


Field Summary
static int MIN_AGE_MS
          Minimum age of globalMap entry we will discard, ms; strictly positive.
 
Constructor Summary
private VarTools()
          Prevent creation of instances of this class.
 
Method Summary
static SimpleNumberStats generateSimpleNumberStats(BasicVarMgrInterface dataSource, SimpleVariableDefinition def, int maxAge_ms, java.lang.String decimalFormatPattern)
          Robustly computes simple stats on a named TYPE_NUMBER variable.
static SimpleNumberStats generateSimpleNumberStats(SimpleVariableValue var, int maxAge, java.lang.String decimalFormatPattern, InstanceID sysID)
          Robustly computes simple stats on a TYPE_NUMBER variable.
static SimpleVarStats generateSimpleStats(BasicVarMgrInterface dataSource, SimpleVariableDefinition def, int maxAge_ms)
          Robustly computes simple stats on a named generic variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_AGE_MS

public static final int MIN_AGE_MS
Minimum age of globalMap entry we will discard, ms; strictly positive.

See Also:
Constant Field Values
Constructor Detail

VarTools

private VarTools()
Prevent creation of instances of this class.

Method Detail

generateSimpleStats

public static final SimpleVarStats generateSimpleStats(BasicVarMgrInterface dataSource,
                                                       SimpleVariableDefinition def,
                                                       int maxAge_ms)
Robustly computes simple stats on a named generic variable. The stats instance produced is

Parameters:
maxAge_ms - maximum age of globalMap entry we will use in ms; will be coerced upwards to a minimum value based on allowed variable-propagation latency Catches most exceptions and returns null in case of error.

Computes the system ID automatically, if available.

See Also:
generateSimpleNumberStats(org.hd.d.pg2k.svrCore.vars.BasicVarMgrInterface, org.hd.d.pg2k.svrCore.vars.SimpleVariableDefinition, int, java.lang.String)

generateSimpleNumberStats

public static final SimpleNumberStats generateSimpleNumberStats(BasicVarMgrInterface dataSource,
                                                                SimpleVariableDefinition def,
                                                                int maxAge_ms,
                                                                java.lang.String decimalFormatPattern)
Robustly computes simple stats on a named TYPE_NUMBER variable.

Parameters:
maxAge_ms - maximum age of globalMap entry we will use in ms; will be coerced upwards to a minimum value based on allowed variable-propagation latency Catches most exceptions and returns null in case of error.

Computes the system ID automatically, if available.

See Also:
generateSimpleNumberStats(org.hd.d.pg2k.svrCore.vars.BasicVarMgrInterface, org.hd.d.pg2k.svrCore.vars.SimpleVariableDefinition, int, java.lang.String)

generateSimpleNumberStats

public static final SimpleNumberStats generateSimpleNumberStats(SimpleVariableValue var,
                                                                int maxAge,
                                                                java.lang.String decimalFormatPattern,
                                                                InstanceID sysID)
Robustly computes simple stats on a TYPE_NUMBER variable. Intended to be used both in normal code and directly in JSP pages (eg is robust, never throws exceptions, HMTL-friendly toString()).

Returns an immutable object containing the stats which has a toString() which renders a relatively admin-human-friendly simple String containing all the stats, or null if the variable presented is null or not numeric or for some reason not suitable.

A local value is treated like a global with one entry but flagged as local.

Only the young-enough members of a global are used; if none are young enough then the main value is used and flagged as old.

Parameters:
sysID - identifies this system so we can select the local value of a global variable if available; can be null
maxAge - maximum age of globalMap entries to be used; coerced to be at least a little larger than the refresh
Returns:
null if variable is unsuitable, else encapsulated stats

DHD Multimedia Gallery V1.53.0

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