com.isti.trinetwatch.ruleset
Class CriteriaTable

java.lang.Object
  extended bycom.isti.trinetwatch.ruleset.CriteriaTable

public class CriteriaTable
extends java.lang.Object

Class CriteriaTable manages a table of Criteria objects (to be associated with a dynamic parameter).


Constructor Summary
CriteriaTable()
           
 
Method Summary
 boolean add(UsageLevelTag usageLevel, Criteria criteriaObj)
          Adds a usage-level / criteria pair to the table.
 Criteria get(int usageValue)
          Returns Criteria object associated with the given numeric usage-level value.
 Criteria get(UsageLevelTag usageLevel)
          Returns Criteria object associated with the given usage-level.
 int getMaxUsageValue()
          Returns the numeric 'value' for the "maximum" usage level used in the table.
 int getMinUsageValue()
          Returns the numeric 'value' for the "minimum" usage level used in the table.
 java.lang.Class getNumbersClass()
          Returns the class type object for the numeric values used in the table, or null if no objects exist in the list.
 UsageLevelTag getUsageLevelTag(int usageValue)
          Returns the UsageLevelTag object associated with the given numeric usage-level value (if it is used in this object's table).
 java.lang.String toString()
          Returns a string representation of this object.
 StatusLevelTag useValToStatus(int usageValue, java.lang.Number value)
          Translates the given numeric usage-level value and the given numeric value to a status level.
 StatusLevelTag useValToStatus(UsageLevelTag usageLevel, java.lang.Number value)
          Translates the given usage-level and numeric value to a status level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CriteriaTable

public CriteriaTable()
Method Detail

add

public boolean add(UsageLevelTag usageLevel,
                   Criteria criteriaObj)
Adds a usage-level / criteria pair to the table.

Returns:
true if successful, false if an object with the same usage-level already exists in table or if the numeric class type used in the criteria does not match the type used in previously added criteria objects.

get

public Criteria get(UsageLevelTag usageLevel)
Returns Criteria object associated with the given usage-level.

Returns:
The handle of the Criteria object or null if no matching object was found.

get

public Criteria get(int usageValue)
Returns Criteria object associated with the given numeric usage-level value.

Returns:
The handle of the Criteria object or null if no matching object was found.

getUsageLevelTag

public UsageLevelTag getUsageLevelTag(int usageValue)
Returns the UsageLevelTag object associated with the given numeric usage-level value (if it is used in this object's table).

Returns:
The handle of the UsageLevelTag object or null if no matching object was found.

useValToStatus

public StatusLevelTag useValToStatus(UsageLevelTag usageLevel,
                                     java.lang.Number value)
Translates the given usage-level and numeric value to a status level.

Parameters:
usageLevel - the handle of UsageLevelTag object.
value - an object containing the numeric value to be translated (such as an 'Integer', 'Double', etc.)
Returns:
The StatusLevelTag object for the given usage level and value, or 'null' if no entries exist for the given usage level.
Throws:
java.lang.ClassCastException - if the given object's type prevents it from being compared to the numeric objects in the list.

useValToStatus

public StatusLevelTag useValToStatus(int usageValue,
                                     java.lang.Number value)
Translates the given numeric usage-level value and the given numeric value to a status level.

Parameters:
usageValue - a numeric value corresponding to a usage-level.
value - an object containing the numeric value to be translated (such as an 'Integer', 'Double', etc.)
Returns:
The StatusLevelTag object for the given usage level and value, or 'null' if no entries exist for the given usage level.
Throws:
java.lang.ClassCastException - if the given object's type prevents it from being compared to the numeric objects in the list.

getMinUsageValue

public int getMinUsageValue()
Returns the numeric 'value' for the "minimum" usage level used in the table.

Returns:
The numeric 'value' for the "minimum" usage level value in the table or 'Integer.MAX_VALUE' if the table is empty.

getMaxUsageValue

public int getMaxUsageValue()
Returns the numeric 'value' for the "maximum" usage level used in the table.

Returns:
The numeric 'value' for the "maximum" usage level value in the table or 'Integer.MIN_VALUE' if the table is empty.

getNumbersClass

public java.lang.Class getNumbersClass()
Returns the class type object for the numeric values used in the table, or null if no objects exist in the list.


toString

public java.lang.String toString()
Returns a string representation of this object. The string representation of each 'Criteria' object is put in a separate section delimited by a blank line.