net.sourceforge.nite.search.rewriter
Class MinimalCondition

java.lang.Object
  extended by net.sourceforge.nite.search.rewriter.MinimalCondition

public class MinimalCondition
extends java.lang.Object

A class encapsulating details about a condition (NodeLogical or NodeCondition) which is to be assigned to a new SimpleQuery during a query rewrite. This will be done by the ConditionDistributor. Records the condition along with the variables involved in it, and a boolean indicating whether or not this condition has been distributed to a new query.


Constructor Summary
MinimalCondition(SimpleNode cond)
          Initialise the object with a condition.
 
Method Summary
 void addVariable(DeclarableVariable dv)
          Adds a DeclarableVariable to the list of DeclarableVariables in this condition.
 void addVariable(java.lang.String var)
          Adds a variable name to the list of variables in this condition.
 int getCardinality()
          Returns the number of variables involved in this condition.
 SimpleNode getCondition()
          Returns the condition node represented by this MinimalCondition.
 java.util.List getVariableNames()
          Returns the names of the variables used in this condition.
 java.util.List getVariablesOfCardinality(int n)
          Returns the names of all the DeclarableVariable objects which are of the given cardinality (those which appear in n conditions).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MinimalCondition

public MinimalCondition(SimpleNode cond)
Initialise the object with a condition. This may be an atomic NodeCondition or a grouping of conditions under a NodeLogical.

Parameters:
cond - a SimpleNode representing the condition to be encapsulated
Method Detail

addVariable

public void addVariable(java.lang.String var)
Adds a variable name to the list of variables in this condition.

Parameters:
var - the name of the variable to add

addVariable

public void addVariable(DeclarableVariable dv)
Adds a DeclarableVariable to the list of DeclarableVariables in this condition.

Parameters:
dv - a DeclarableVariable object to add

getCardinality

public int getCardinality()
Returns the number of variables involved in this condition.

Returns:
the number of variables used in this condition

getVariableNames

public java.util.List getVariableNames()
Returns the names of the variables used in this condition.

Returns:
a List of variable names

getCondition

public SimpleNode getCondition()
Returns the condition node represented by this MinimalCondition.

Returns:
the condition node

getVariablesOfCardinality

public java.util.List getVariablesOfCardinality(int n)
Returns the names of all the DeclarableVariable objects which are of the given cardinality (those which appear in n conditions).

Parameters:
n - the cardinality required of the variables
Returns:
a List of names

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object