choco.cp.solver.constraints.reified.leaves.arithm
Class IfThenElseNode

java.lang.Object
  extended by choco.kernel.solver.constraints.reified.INode
      extended by choco.cp.solver.constraints.reified.leaves.bool.AbstractBoolNode
          extended by choco.cp.solver.constraints.reified.leaves.arithm.IfThenElseNode
All Implemented Interfaces:
IPretty, ArithmNode, BoolNode

public final class IfThenElseNode
extends AbstractBoolNode
implements ArithmNode, BoolNode


Field Summary
 
Fields inherited from class choco.kernel.solver.constraints.reified.INode
LOGGER, subtrees
 
Constructor Summary
IfThenElseNode(INode[] subt)
           
 
Method Summary
protected  boolean checkIfConditionAlreadyABooleanVar()
          A common use of the If Then Else is to use a boolean variable as a condition, in which cas it is useless to introduce another one.
 boolean checkTuple(int[] tuple)
           
 int eval(int[] tuple)
           
 SConstraint extractConstraint(Solver s)
          Extracts the sub constraint without reifying it !
 IntDomainVar extractResult(Solver s)
           
 boolean isReified()
          check if this expression is reified (involve or, and, not, ...)
 String pretty()
          pretty printing of the object.
 
Methods inherited from class choco.kernel.solver.constraints.reified.INode
computeLinearExpr, countNbVar, getModelScope, getNbSubTrees, getScope, getSubtree, getType, hasOnlyVariablesLeaves, isAConstant, isALinearTerm, isAVariable, isBoolean, isCsteEqualTo, isDecompositionPossible, setIndexes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IfThenElseNode

public IfThenElseNode(INode[] subt)
Method Detail

eval

public int eval(int[] tuple)
Specified by:
eval in interface ArithmNode

checkTuple

public boolean checkTuple(int[] tuple)
Specified by:
checkTuple in interface BoolNode

extractResult

public IntDomainVar extractResult(Solver s)
Overrides:
extractResult in class AbstractBoolNode
Returns:
a variable that represents the true/false value of the tree belows this node if it is a reified node or its value if it is an arithmetic node

extractConstraint

public SConstraint extractConstraint(Solver s)
Description copied from class: AbstractBoolNode
Extracts the sub constraint without reifying it !

Specified by:
extractConstraint in interface BoolNode
Specified by:
extractConstraint in class AbstractBoolNode
Parameters:
s - solver
Returns:
SConstraint

checkIfConditionAlreadyABooleanVar

protected boolean checkIfConditionAlreadyABooleanVar()
A common use of the If Then Else is to use a boolean variable as a condition, in which cas it is useless to introduce another one.

Returns:
true is one implicated variable is already a boolean variable

isReified

public boolean isReified()
Description copied from class: INode
check if this expression is reified (involve or, and, not, ...)

Overrides:
isReified in class INode
Returns:

pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface IPretty
Returns:
a readable string representation of the object


Copyright © 2012. All Rights Reserved.