com.iphrase.runtime.query.constraint
Class Disjunction

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--com.iphrase.runtime.query.constraint.Disjunction
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class Disjunction
extends java.util.Vector

Represent a collection of Constraint instances ORed together by this disjunction.

Note that neither ArrayList (nor List) support setSize(), so I've implemented this as a Vector.

See Also:
Serialized Form

Constructor Summary
Disjunction()
          Create an empty constraint disjunction.
Disjunction(Constraint constraint)
          Construct a disjunction from a single constraint.
 
Method Summary
 void cull(Constraint constraint)
          Cull a constraint from this disjunction.
 boolean matches(Constraint c)
          Determine whether this disjunction has any constraints that match (as defined by Constraint.matches(com.iphrase.runtime.query.constraint.Constraint)) the designated constraint.
 void merge(Constraint constraint)
          Merge a constraint into this disjunction.
static Disjunction newInstance(java.lang.String state)
           
 java.lang.String toString()
          Serialize this disjunction using the OneStep serialization format.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Disjunction

public Disjunction()
Create an empty constraint disjunction.

Disjunction

public Disjunction(Constraint constraint)
Construct a disjunction from a single constraint.
Parameters:
constraint - Constraint to be added to new disjunction
Method Detail

merge

public void merge(Constraint constraint)
Merge a constraint into this disjunction. Merge means cull(com.iphrase.runtime.query.constraint.Constraint) matches, then add the designated constraint.
Parameters:
constraint - the designated Constraint to merge

cull

public void cull(Constraint constraint)
Cull a constraint from this disjunction. Cull means remove any constraints from this disjunction that match (as defined by matches(com.iphrase.runtime.query.constraint.Constraint)) the designated constraint.
Parameters:
constraint - the designated Constraint to cull

matches

public boolean matches(Constraint c)
Determine whether this disjunction has any constraints that match (as defined by Constraint.matches(com.iphrase.runtime.query.constraint.Constraint)) the designated constraint.
Parameters:
c - Constraint to be matched
Returns:
true if there is a match, else false

toString

public java.lang.String toString()
Serialize this disjunction using the OneStep serialization format. Overrides Object.toString()
Overrides:
toString in class java.util.Vector
Returns:
OneStep serialization String of this disjunction

newInstance

public static Disjunction newInstance(java.lang.String state)
                               throws ArgumentError

© Copyright 2005, 2006. IBM Corporation. All rights reserved.