jopt.csp.spi.arcalgorithm.constraint.bool
Class ThreeVarConstraint

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.variable.VariableChangeBase
      extended byjopt.csp.spi.arcalgorithm.constraint.AbstractConstraint
          extended byjopt.csp.spi.arcalgorithm.constraint.bool.BooleanConstraint
              extended byjopt.csp.spi.arcalgorithm.constraint.bool.ThreeVarConstraint
All Implemented Interfaces:
jopt.csp.variable.CspConstraint, GraphConstraint, NumConstants, PostableConstraint, VariableChangeSource
Direct Known Subclasses:
BooleanAndConstraint, BooleanEqThreeVarConstraint, BooleanImpliesThreeVarConstraint, BooleanOrConstraint, BooleanXorConstraint

public abstract class ThreeVarConstraint
extends BooleanConstraint

Base class for constraints with one variable


Field Summary
 
Fields inherited from interface jopt.csp.spi.util.NumConstants
ADD, DIVIDE, DIVIDE_BY, DIVIDE_BY_CEIL, DIVIDE_BY_FLOOR, DIVIDE_CEIL, DIVIDE_FLOOR, DOUBLE, DOUBLE_NEG_INF, DOUBLE_POS_INF, DOUBLE_ZERO, EQ, FLOAT, FLOAT_NEG_INF, FLOAT_POS_INF, FLOAT_ZERO, GEQ, GT, HALF_PI, INTEGER, INTEGER_MAX, INTEGER_MIN, INTEGER_ZERO, LEQ, LONG, LONG_MAX, LONG_MIN, LONG_ZERO, LT, MULTIPLY, NEQ, ONE_AND_HALF_PI, PI, RANGE, SUBTRACT, SUBTRACT_FROM, TWO_PI
 
Constructor Summary
ThreeVarConstraint(BoolExpr xexpr, BoolExpr yexpr, boolean notY, BoolExpr zexpr, boolean constVal)
           
ThreeVarConstraint(BoolExpr xexpr, BoolExpr yexpr, boolean notY, BoolExpr zexpr, GenericBooleanConstant genConstVal)
           
 
Method Summary
 void addVariableChangeListener(VariableChangeListener listener)
          Adds a listener interested in variable change events
 void addVariableChangeListener(VariableChangeListener listener, boolean firstTime)
          Adds a listener interested in variable change events
 Arc[] getBooleanSourceArcs()
          Returns array of arcs that will affect the boolean true / false value of this constraint upon a change
 Node[] getBooleanSourceNodes()
          Returns array of nodes that will affect the boolean true / false value of this constraint upon a change
 GenericIndexManager getIndexManager()
          Retrieve a GenericIndexManager for this NumConstraint
 boolean isAnyYTrue()
          Returns true if any X node is true
 boolean isViolated(boolean allViolated)
          Returns true if constraint cannot be satisfied.
 void postToGraph()
          Posts a boolean constraint to the graph for use during propagation
 void removeVariableChangeListener(VariableChangeListener listener)
          Removes a variable listener from this variable
 
Methods inherited from class jopt.csp.spi.arcalgorithm.constraint.AbstractConstraint
associateToGraph, getGraphConstraintFragment, getPostableOpposite, isFalse, isTrue, toBoolean
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreeVarConstraint

public ThreeVarConstraint(BoolExpr xexpr,
                          BoolExpr yexpr,
                          boolean notY,
                          BoolExpr zexpr,
                          boolean constVal)

ThreeVarConstraint

public ThreeVarConstraint(BoolExpr xexpr,
                          BoolExpr yexpr,
                          boolean notY,
                          BoolExpr zexpr,
                          GenericBooleanConstant genConstVal)
Method Detail

postToGraph

public void postToGraph()
Description copied from interface: PostableConstraint
Posts a boolean constraint to the graph for use during propagation


getBooleanSourceArcs

public Arc[] getBooleanSourceArcs()
Description copied from interface: PostableConstraint
Returns array of arcs that will affect the boolean true / false value of this constraint upon a change


getBooleanSourceNodes

public Node[] getBooleanSourceNodes()
Description copied from interface: PostableConstraint
Returns array of nodes that will affect the boolean true / false value of this constraint upon a change


getIndexManager

public GenericIndexManager getIndexManager()
Retrieve a GenericIndexManager for this NumConstraint

Returns:
an index manager taking into account the appropriate restrictions

isViolated

public boolean isViolated(boolean allViolated)
Description copied from class: BooleanConstraint
Returns true if constraint cannot be satisfied. If all violated is true, this method returns true only when all conditions are violated. If all violated is false, this method returns true when any condition is violated. The presence of multiple conditions is an issue when generic vars/exprs are involved.

Specified by:
isViolated in class BooleanConstraint
Parameters:
allViolated - Determines the criteria for violation

addVariableChangeListener

public void addVariableChangeListener(VariableChangeListener listener,
                                      boolean firstTime)
Description copied from class: BooleanConstraint
Adds a listener interested in variable change events

Overrides:
addVariableChangeListener in class BooleanConstraint

addVariableChangeListener

public void addVariableChangeListener(VariableChangeListener listener)
Description copied from interface: VariableChangeSource
Adds a listener interested in variable change events

Specified by:
addVariableChangeListener in interface VariableChangeSource
Overrides:
addVariableChangeListener in class BooleanConstraint

removeVariableChangeListener

public void removeVariableChangeListener(VariableChangeListener listener)
Description copied from interface: VariableChangeSource
Removes a variable listener from this variable

Specified by:
removeVariableChangeListener in interface VariableChangeSource
Overrides:
removeVariableChangeListener in class BooleanConstraint

isAnyYTrue

public boolean isAnyYTrue()
Returns true if any X node is true