All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class logic.Condition

java.lang.Object
   |
   +----logic.Condition

public class Condition
extends Object
This class abstracts the notion of a "condition" in branching logic. It provides constructors for a variety of simple kinds of conditions such as comparing primitives with =, <, or <=. It also provides a constructor for testing whether objects are equal, and a more general constructor, which accepts a Hashtable, for more complicated conditions.


Variable Index

 o b1
 o b2
 o BOOLEAN
 o d1
 o d2
 o data
 o DOUBLE
 o EQUAL
 o f1
 o f2
 o FLOAT
 o i1
 o i2
 o INTEGER
 o LESS
 o LESS_EQUAL
 o ob1
 o ob2
 o OBJECT
 o op
 o status

Constructor Index

 o Condition(boolean, boolean)
This constructor compares two booleans to see if they are the same.
 o Condition(double, int, double)
This constructor compares two doubles using the comparison named by oper.
 o Condition(float, int, float)
This constructor compares two float's using the comparison named by oper.
 o Condition(Hashtable)
This version of Condition accepts a Hashtable that must contain all the data that is necessary to implement the evaluate() method -- the evaluate() method must be overridden if this constructor is used.
 o Condition(int, int, int)
This constructor compares two int's using the comparison named by oper.
 o Condition(Object, Object)
This constructor is used when two objects need to be compared.

Method Index

 o badOperator(int)
returns true if the argument op is not one of the legal operators
 o evaluate()
If the Hashtable version of the constructor is used, this method must be overridden; otherwise the present version of evaluate should work without modification
 o evaluateBoolean()
 o evaluateDouble()
 o evaluateFloat()
 o evaluateInteger()
 o evaluateObject()
Note that the equals() method of Object should have been overridden in order for this method to work as desired.
 o getData()

Variables

 o BOOLEAN
 final int BOOLEAN
 o INTEGER
 final int INTEGER
 o FLOAT
 final int FLOAT
 o DOUBLE
 final int DOUBLE
 o OBJECT
 final int OBJECT
 o status
 int status
 o data
 Hashtable data
 o ob1
 Object ob1
 o ob2
 Object ob2
 o b1
 boolean b1
 o b2
 boolean b2
 o i1
 int i1
 o i2
 int i2
 o f1
 float f1
 o f2
 float f2
 o d1
 double d1
 o d2
 double d2
 o op
 int op
 o LESS
 public static final int LESS
 o LESS_EQUAL
 public static final int LESS_EQUAL
 o EQUAL
 public static final int EQUAL

Constructors

 o Condition
 public Condition(double d1,
                  int oper,
                  double d2) throws IllegalExpressionException
This constructor compares two doubles using the comparison named by oper. The default evaluate() method should be used.

 o Condition
 public Condition(float f1,
                  int oper,
                  float f2) throws IllegalExpressionException
This constructor compares two float's using the comparison named by oper. The default evaluate() method should be used.

 o Condition
 public Condition(int i1,
                  int oper,
                  int i2) throws IllegalExpressionException
This constructor compares two int's using the comparison named by oper. The default evaluate() method should be used.

 o Condition
 public Condition(Object ob1,
                  Object ob2)
This constructor is used when two objects need to be compared. Usually, the default equals(Object) method provided by Object should be overridden in the class that is the template for the arguments ob1 and ob2.

 o Condition
 public Condition(Hashtable data)
This version of Condition accepts a Hashtable that must contain all the data that is necessary to implement the evaluate() method -- the evaluate() method must be overridden if this constructor is used.

 o Condition
 public Condition(boolean b1,
                  boolean b2)
This constructor compares two booleans to see if they are the same. The default evaluate() method should be used.

Methods

 o badOperator
 private boolean badOperator(int oper)
returns true if the argument op is not one of the legal operators

 o evaluate
 public Boolean evaluate() throws DataNotFoundException
If the Hashtable version of the constructor is used, this method must be overridden; otherwise the present version of evaluate should work without modification

 o evaluateBoolean
 private Boolean evaluateBoolean()
 o evaluateDouble
 private Boolean evaluateDouble()
 o evaluateFloat
 private Boolean evaluateFloat()
 o evaluateInteger
 private Boolean evaluateInteger()
 o evaluateObject
 private Boolean evaluateObject()
Note that the equals() method of Object should have been overridden in order for this method to work as desired.

 o getData
 public Hashtable getData()

All Packages  Class Hierarchy  This Package  Previous  Next  Index