Package org.projog.clp
Class ClpConstraintStore
- java.lang.Object
-
- org.projog.clp.ClpConstraintStore
-
- All Implemented Interfaces:
ConstraintStore,ReadConstraintStore
public final class ClpConstraintStore extends java.lang.Object implements ConstraintStore
A collection of constraints and variables that represent a problem domain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClpConstraintStore.Builderstatic classClpConstraintStore.Enforcestatic classClpConstraintStore.EnforceAll
-
Field Summary
Fields Modifier and Type Field Description private intconstraintCtrprivate java.util.Queue<java.lang.Integer>constraintQueueprivate Constraint[]constraintsprivate java.util.Map<Variable,java.util.List<java.lang.Integer>>constraintsByVariableprivate intvariableCtrprivate Variable[]variablesprivate VariableState[]variableStates
-
Constructor Summary
Constructors Modifier Constructor Description privateClpConstraintStore(ClpConstraintStore original)privateClpConstraintStore(ClpConstraintStore.Builder b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ClpConstraintStorecopy()private VariableStategetExpression(Expression e)longgetMax(Expression id)longgetMin(Expression id)longgetValue(Variable id)VariablegetVariable(int idx)intgetVariablesCount()VariableStategetVariableState(int idx)booleanresolve()ExpressionResultsetMax(Expression id, long max)ExpressionResultsetMin(Expression id, long min)ExpressionResultsetNot(Expression id, long not)ExpressionResultsetValue(Expression id, long value)private ExpressionResultupdate(Expression e, VariableStateResult r)
-
-
-
Field Detail
-
variableCtr
private final int variableCtr
-
variables
private final Variable[] variables
-
variableStates
private final VariableState[] variableStates
-
constraintCtr
private final int constraintCtr
-
constraints
private final Constraint[] constraints
-
constraintsByVariable
private final java.util.Map<Variable,java.util.List<java.lang.Integer>> constraintsByVariable
-
constraintQueue
private final java.util.Queue<java.lang.Integer> constraintQueue
-
-
Constructor Detail
-
ClpConstraintStore
private ClpConstraintStore(ClpConstraintStore.Builder b)
-
ClpConstraintStore
private ClpConstraintStore(ClpConstraintStore original)
-
-
Method Detail
-
copy
ClpConstraintStore copy()
-
getVariablesCount
public int getVariablesCount()
-
getVariable
public Variable getVariable(int idx)
-
getVariableState
public VariableState getVariableState(int idx)
-
getValue
public long getValue(Variable id)
-
update
private ExpressionResult update(Expression e, VariableStateResult r)
-
resolve
public boolean resolve()
-
getExpression
private VariableState getExpression(Expression e)
-
getMin
public long getMin(Expression id)
- Specified by:
getMinin interfaceReadConstraintStore
-
getMax
public long getMax(Expression id)
- Specified by:
getMaxin interfaceReadConstraintStore
-
setValue
public ExpressionResult setValue(Expression id, long value)
- Specified by:
setValuein interfaceConstraintStore
-
setMin
public ExpressionResult setMin(Expression id, long min)
- Specified by:
setMinin interfaceConstraintStore
-
setMax
public ExpressionResult setMax(Expression id, long max)
- Specified by:
setMaxin interfaceConstraintStore
-
setNot
public ExpressionResult setNot(Expression id, long not)
- Specified by:
setNotin interfaceConstraintStore
-
-