com.isti.trinetwatch.ruleset
Class CriteriaTable

java.lang.Object
  extended by com.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.
 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.Class getValueClass()
          Returns the class type object for the values used in the table.
 java.lang.String toString()
          Returns a string representation of this object.
 StatusLevelTag useValToStatus(int usageValue, java.lang.Object value)
          Translates the given usage-level value and the given value to a status level.
 StatusLevelTag useValToStatus(UsageLevelTag usageLevel, java.lang.Object value)
          Translates the given usage-level and 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.

Parameters:
usageLevel - usage level of pair to be added.
criteriaObj - criteria object of pair to be added.
Returns:
true if successful, false if an object with the same usage-level already exists in table or if the 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.

Parameters:
usageLevel - usage level to match.
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.

Parameters:
usageValue - usage value to match.
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).

Parameters:
usageValue - usage value to match.
Returns:
The handle of the UsageLevelTag object or null if no matching object was found.

useValToStatus

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

Parameters:
usageLevel - the handle of UsageLevelTag object.
value - an object containing the value to be translated.
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 objects in the list.

useValToStatus

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

Parameters:
usageValue - a value corresponding to a usage-level.
value - an object containing the value to be translated.
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 objects in the list.

getValueClass

public java.lang.Class getValueClass()
Returns the class type object for the values used in the table.

Returns:
The class type object for the 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.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object.