sbrt.kernel.utilities
Class LogicalRelation<C>

java.lang.Object
  extended by sbrt.kernel.utilities.LogicalRelation<C>
Type Parameters:
C - the condition type.
All Implemented Interfaces:
java.lang.Iterable<C>
Direct Known Subclasses:
And, Or

public abstract class LogicalRelation<C>
extends java.lang.Object
implements java.lang.Iterable<C>

This class is used to represent logical relationships or operations. Logical relationships have a set of conditions which usually evaluate to either "true" or "false".

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
LogicalRelation(java.util.Collection<C> conditions)
          Constructs a new logical relationship from the provided conditions.
 
Method Summary
 boolean contains(java.lang.Object condition)
          Indicates if this logical relationship contains the provided condition.
 int elements()
          Returns the number of conditions of this logical relationship.
abstract  boolean equals(java.lang.Object obj)
          Inidicates if this logical relationship is "equal to" the provided object.
 UnmodifiableSet<C> getConditions()
          Returns the set of conditions of this logical relationship.
 int hashCode()
          Returns a content-based hash code.
 java.util.Iterator<C> iterator()
          Returns an iterator over the conditions of this logical relationship.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogicalRelation

public LogicalRelation(java.util.Collection<C> conditions)
Constructs a new logical relationship from the provided conditions.

Parameters:
conditions - the set of conditions.
Method Detail

getConditions

public UnmodifiableSet<C> getConditions()
Returns the set of conditions of this logical relationship.

Returns:
the set of conditions of this logical relationship.

elements

public int elements()
Returns the number of conditions of this logical relationship.

Returns:
the number of conditions of this logical relationship.

iterator

public java.util.Iterator<C> iterator()
Returns an iterator over the conditions of this logical relationship.

Specified by:
iterator in interface java.lang.Iterable<C>
Returns:
an iterator over the conditions of this logical relationship.

contains

public boolean contains(java.lang.Object condition)
Indicates if this logical relationship contains the provided condition.

Parameters:
condition - the condition for which occurence is checked.
Returns:
true if the provide condition is contained in this logical relationship; false otherwise.

hashCode

public int hashCode()
Returns a content-based hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
a content-based hash code.

equals

public abstract boolean equals(java.lang.Object obj)
Inidicates if this logical relationship is "equal to" the provided object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object for which comparison is made.
Returns:
true if this logical relationship equals the provided object; false otherwise.