com.isti.trinetwatch.ruleset
Class Criteria

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

public class Criteria
extends java.lang.Object

Class Criteria manages a list of comparison values and their translations to status levels.


Constructor Summary
Criteria()
           
 
Method Summary
 boolean add(Comparison cObj)
          Adds the given Comparison object to this object's list.
 boolean add(StatusLevelTag statusLevel, java.lang.Number minValue)
          Adds a Comparison object containing the given parameters to this object's list.
 java.util.Vector getComparisonSet()
          Returns the Vector of 'Comparison' objects that make up the comparison set for this criteria.
 java.lang.Class getNumbersClass()
          Returns the class type object for the numeric values in the comparison list, or null if no objects exist in the list.
 java.lang.String toString()
          Returns a string representation of this object.
 StatusLevelTag valueToStatus(java.lang.Number value)
          Translates the given value to a status level using this object's list of Comparison objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Criteria

public Criteria()
Method Detail

add

public boolean add(StatusLevelTag statusLevel,
                   java.lang.Number minValue)
Adds a Comparison object containing the given parameters to this object's list. Note that the 'minValue' objects must all be of the same type and the values must be in ascending order (where each 'minValue' is larger than the previous one).

Parameters:
statusLevel - handle of a StatusLevelTag object.
minValue - an object containing the minimum numeric value to be associated with the given status level (such as an 'Integer', 'Double', etc.)
Returns:
true if successful, false if 'minValue' object's type does not match previous entries or is not larger then the previous entry.

add

public boolean add(Comparison cObj)
Adds the given Comparison object to this object's list. Note that the Comparison objects' 'minValue' objects must all be of the same type and the values must be in ascending order (where each 'minValue' is larger than the previous one).

Returns:
true if successful, false if the Comparison object's 'minValue' object's type does not match previous entries or is not larger then the previous entry.

valueToStatus

public StatusLevelTag valueToStatus(java.lang.Number value)
Translates the given value to a status level using this object's list of Comparison objects.

Parameters:
value - an object containing the numeric value to be translated (such as an 'Integer', 'Double', etc.)
Returns:
The StatusLevelTag object for the given value (returns 'StatusLevelTag.unknownStatusTag' if the given value is null or if it is lower than the minimum value in the list).
Throws:
java.lang.ClassCastException - if the given object's type prevents it from being compared to the numeric objects in the list.

getNumbersClass

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


getComparisonSet

public java.util.Vector getComparisonSet()
Returns the Vector of 'Comparison' objects that make up the comparison set for this criteria.


toString

public java.lang.String toString()
Returns a string representation of this object. The string representation of each 'Comparison' object is put on a separate indented line.