omnics.constraint
Class UnaryConstraint

java.lang.Object
  extended by omnics.Constraint
      extended by omnics.constraint.UnaryConstraint
All Implemented Interfaces:
java.io.Serializable

public abstract class UnaryConstraint
extends Constraint

Author:
Cristian Frasinaru
See Also:
Serialized Form

Field Summary
protected  Var x
           
 
Fields inherited from class omnics.Constraint
ALLOWED, filter, FORBIDDEN, MAX, MIN, name, problem, variables
 
Constructor Summary
UnaryConstraint(Var x)
          Creates a new instance of BinaryConstraint
 
Method Summary
abstract  int eval(java.lang.Object a)
          This is the method that evaluates the tuple (x=a).
 int eval(Tuple tuple)
          Method used by the solver.
 int eval(Var x, java.lang.Object a)
          Method used by the solver.
 
Methods inherited from class omnics.Constraint
eval, getFilter, getName, getProblem, getTuples, getVarArray, getVariables, setFilter, setName, setVariables, setVariables, toString, variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

protected Var x
Constructor Detail

UnaryConstraint

public UnaryConstraint(Var x)
Creates a new instance of BinaryConstraint

Method Detail

eval

public abstract int eval(java.lang.Object a)
This is the method that evaluates the tuple (x=a). Must be implemented in the subclasses.


eval

public int eval(Var x,
                java.lang.Object a)
Method used by the solver.

Overrides:
eval in class Constraint
Parameters:
x - some variable of the constraint
a - some value in x's domain
Returns:
a value between ValuationStructure.MIN and ValuationStructure.MAX.
See Also:
Constraint.eval(Tuple), ValuationStructure

eval

public int eval(Tuple tuple)
Method used by the solver.

Specified by:
eval in class Constraint
Parameters:
tuple - some tuple
Returns:
a value between ValuationStructure.MIN and ValuationStructure.MAX.
See Also:
Constraint.eval(Tuple), ValuationStructure