All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class logic.BooleanTuple

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

public class BooleanTuple
extends Object
implements BooleanTupleConstants
This class is a wrapper for an array of Booleans. We need a wrapper so that it can be used as a key in a hashtable. It provides a simple implementation of hashCode() for this purpose.


Variable Index

 o tuple

Constructor Index

 o BooleanTuple(Vector)
The constructor accepts a Vector of Conditions -- only 30 are allowed.

Method Index

 o equals(Object)
Two BooleanTuples are equal if they are both nonnull, and their underlying instances of Boolean[] have the same length and have entries that have the same booleanValue()'s.
 o getTuple()
 o hashCode()
The algorithm used here is to treat a sequence of booleans as a binary sequence, with T=1 and F=0, and then treat the binary sequence as an actual binary integer.
 o num(Boolean)
 o setTuple(Boolean[])
 o setTuple(Vector)
 o size()
 o toString()

Variables

 o tuple
 private Boolean tuple[]

Constructors

 o BooleanTuple
 public BooleanTuple(Vector tuple) throws NestingTooDeepException
The constructor accepts a Vector of Conditions -- only 30 are allowed. It converts the vector to an array and caches it.

Methods

 o equals
 public boolean equals(Object ob)
Two BooleanTuples are equal if they are both nonnull, and their underlying instances of Boolean[] have the same length and have entries that have the same booleanValue()'s.

Overrides:
equals in class Object
 o getTuple
 public Boolean[] getTuple()
 o hashCode
 public int hashCode()
The algorithm used here is to treat a sequence of booleans as a binary sequence, with T=1 and F=0, and then treat the binary sequence as an actual binary integer. The algorithm simply computes the base 10 value of this binary number and returns it. An inherent limitation is that the largest allowed int is 2^31 -1, so that we can't rely on the algorithm for tuples of length > 30.

Overrides:
hashCode in class Object
 o num
 private int num(Boolean b)
 o setTuple
 public void setTuple(Boolean arr[])
Parameters:
v - java.util.Vector
 o setTuple
 public void setTuple(Vector v)
Parameters:
v - java.util.Vector
 o size
 public int size()
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index