Class ClpVariable
java.lang.Object
org.projog.core.predicate.builtin.clp.ClpVariable
- All Implemented Interfaces:
org.projog.clp.Constraint, org.projog.clp.Expression, org.projog.clp.LeafExpression, ArithmeticOperator, Numeric, Term
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateClpVariable(org.projog.clp.VariableState state, Collection<org.projog.clp.Constraint> rules) privateClpVariable(ClpVariable parent) -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddConstraint(org.projog.clp.Constraint c) voidReverts this term back to its original state prior to any unifications.Returns the result of the calculation using the specified arguments.copy()Returns a copy of this term.org.projog.clp.ConstraintResultenforce(org.projog.clp.ConstraintStore s) booleanTerm[]getArgs()Returns an array of this terms's arguments.getArgument(int index) Returns the term at the specified position in this term's arguments.(package private) List<org.projog.clp.Constraint> doubleReturns the value of this numeric as adouble.longgetLong()Returns the value of this numeric as along.longgetMax(org.projog.clp.ReadConstraintStore s) longgetMin(org.projog.clp.ReadConstraintStore s) getName()Returns a string representation of this term.intReturns the number of arguments in this term.(package private) org.projog.clp.VariableStategetState()getTerm()Returns the current instantiated state of this term.getType()Returns theTermTyperepresented by this term.inthashCode()booleanReturnstrueis this term is immutable.org.projog.clp.ConstraintResultprevent(org.projog.clp.ConstraintStore s) org.projog.clp.ConstraintResultreify(org.projog.clp.ReadConstraintStore s) org.projog.clp.LeafExpressionorg.projog.clp.ExpressionResultsetMax(org.projog.clp.ConstraintStore s, long max) org.projog.clp.ExpressionResultsetMin(org.projog.clp.ConstraintStore s, long min) org.projog.clp.ExpressionResultsetNot(org.projog.clp.ConstraintStore s, long not) toString()booleanAttempts to unify this term to the specified term.private static booleanunifyClpVariable(ClpVariable a, Term b) private booleanvoid
-
Field Details
-
TRUE
private static final int TRUE- See Also:
-
FALSE
private static final int FALSE- See Also:
-
child
-
state
private final org.projog.clp.VariableState state -
rules
-
-
Constructor Details
-
ClpVariable
public ClpVariable() -
ClpVariable
-
ClpVariable
private ClpVariable(org.projog.clp.VariableState state, Collection<org.projog.clp.Constraint> rules)
-
-
Method Details
-
getConstraints
List<org.projog.clp.Constraint> getConstraints() -
addConstraint
void addConstraint(org.projog.clp.Constraint c) -
getState
org.projog.clp.VariableState getState() -
copy
-
getName
-
getArgs
Description copied from interface:TermReturns an array of this terms's arguments.Note: for performance reasons the array returned is the same array used internally be the term instance so be careful not to alter the array returned as changes will be reflected in the original term.
-
getNumberOfArguments
public int getNumberOfArguments()Description copied from interface:TermReturns the number of arguments in this term.- Specified by:
getNumberOfArgumentsin interfaceTerm- Returns:
- number of arguments in this term
-
getArgument
Description copied from interface:TermReturns the term at the specified position in this term's arguments.- Specified by:
getArgumentin interfaceTerm- Parameters:
index- index of the argument to return- Returns:
- the term at the specified position in this term's arguments
-
getType
-
isImmutable
public boolean isImmutable()Description copied from interface:TermReturnstrueis this term is immutable.A term is considered immutable if its value will never change as a result of executing its
Term.unify(Term)orTerm.backtrack()methods. A term will not be considered immutable if it is aVariableor any of its arguments are not immutable.- Specified by:
isImmutablein interfaceTerm- Returns:
trueis this term is immutable
-
copy
Description copied from interface:Term -
getTerm
-
unify
Description copied from interface:TermAttempts to unify this term to the specified term.The rules for deciding if two terms are unifiable are as follows:
- An uninstantiated
Variablewill unify with any term. As a result theVariablewill become instantiated to the other term. The instantiaton will be undone whenTerm.backtrack()is next called on theVariable - Non-variable terms will unify with other terms that are of the same
TermTypeand have the same value. The exact meaning of "having the same value" will vary between term types but will include that the two terms being unified have the same number of arguments and that all of their corresponding arguments unify.
- An uninstantiated
-
unifyClpVariable
-
unifyLong
-
backtrack
-
getMin
public long getMin(org.projog.clp.ReadConstraintStore s) - Specified by:
getMinin interfaceorg.projog.clp.Constraint- Specified by:
getMinin interfaceorg.projog.clp.Expression
-
getMax
public long getMax(org.projog.clp.ReadConstraintStore s) - Specified by:
getMaxin interfaceorg.projog.clp.Constraint- Specified by:
getMaxin interfaceorg.projog.clp.Expression
-
setNot
public org.projog.clp.ExpressionResult setNot(org.projog.clp.ConstraintStore s, long not) - Specified by:
setNotin interfaceorg.projog.clp.Expression
-
setMin
public org.projog.clp.ExpressionResult setMin(org.projog.clp.ConstraintStore s, long min) - Specified by:
setMinin interfaceorg.projog.clp.Constraint- Specified by:
setMinin interfaceorg.projog.clp.Expression
-
setMax
public org.projog.clp.ExpressionResult setMax(org.projog.clp.ConstraintStore s, long max) - Specified by:
setMaxin interfaceorg.projog.clp.Constraint- Specified by:
setMaxin interfaceorg.projog.clp.Expression
-
enforce
public org.projog.clp.ConstraintResult enforce(org.projog.clp.ConstraintStore s) - Specified by:
enforcein interfaceorg.projog.clp.Constraint
-
prevent
public org.projog.clp.ConstraintResult prevent(org.projog.clp.ConstraintStore s) - Specified by:
preventin interfaceorg.projog.clp.Constraint
-
reify
public org.projog.clp.ConstraintResult reify(org.projog.clp.ReadConstraintStore s) - Specified by:
reifyin interfaceorg.projog.clp.Constraint
-
walk
- Specified by:
walkin interfaceorg.projog.clp.Constraint- Specified by:
walkin interfaceorg.projog.clp.Expression
-
replace
public org.projog.clp.LeafExpression replace(Function<org.projog.clp.LeafExpression, org.projog.clp.LeafExpression> function) - Specified by:
replacein interfaceorg.projog.clp.Constraint- Specified by:
replacein interfaceorg.projog.clp.Expression- Specified by:
replacein interfaceorg.projog.clp.LeafExpression
-
calculate
Description copied from interface:ArithmeticOperatorReturns the result of the calculation using the specified arguments.- Specified by:
calculatein interfaceArithmeticOperator- Parameters:
args- the arguments to use in the calculation- Returns:
- the result of the calculation using the specified arguments
-
getLong
-
getDouble
-
equals
-
hashCode
-
toString
-