omnics.constraint
Class ExplicitConstraint

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

public class ExplicitConstraint
extends Constraint

Author:
Cristian Frasinaru
See Also:
Serialized Form

Field Summary
 
Fields inherited from class omnics.Constraint
ALLOWED, filter, FORBIDDEN, MAX, MIN, name, problem, variables
 
Constructor Summary
ExplicitConstraint()
          Creates a new instance of ExplicitConstraint
ExplicitConstraint(java.lang.String name, VarSet variables, java.lang.Object[][] values)
          Creates a new instance of ExplicitConstraint
ExplicitConstraint(VarSet variables, java.lang.Object[][] values)
          Creates a new instance of ExplicitConstraint
 
Method Summary
 boolean add(Tuple tuple)
           
 boolean contains(Tuple tuple)
          Tests if the tuple is
 int eval(Tuple tuple)
          Evaluates a tuple.
 TupleSet getTuples()
          Creates and returns a set containing all the tuples that satisfy this constraint.
 void join(TupleSet otherTuples)
           
 boolean remove(Tuple tuple)
           
 void setTuples(TupleSet tuples)
           
 java.lang.String toString()
          Returns a string representation of the constraint.
 
Methods inherited from class omnics.Constraint
eval, eval, getFilter, getName, getProblem, getVarArray, getVariables, setFilter, setName, setVariables, setVariables, variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExplicitConstraint

public ExplicitConstraint()
Creates a new instance of ExplicitConstraint


ExplicitConstraint

public ExplicitConstraint(VarSet variables,
                          java.lang.Object[][] values)
Creates a new instance of ExplicitConstraint


ExplicitConstraint

public ExplicitConstraint(java.lang.String name,
                          VarSet variables,
                          java.lang.Object[][] values)
Creates a new instance of ExplicitConstraint

Method Detail

getTuples

public TupleSet getTuples()
Description copied from class: Constraint
Creates and returns a set containing all the tuples that satisfy this constraint.

Warning: if the constrained is not an explicit constraint

Overrides:
getTuples in class Constraint
Returns:
all the tuples that satisfy this constraint.

setTuples

public void setTuples(TupleSet tuples)

add

public boolean add(Tuple tuple)

remove

public boolean remove(Tuple tuple)

contains

public boolean contains(Tuple tuple)
Tests if the tuple is


eval

public int eval(Tuple tuple)
Description copied from class: Constraint
Evaluates a tuple. The result of the evaluation could be: Constants MIN, MAX, ALLOWED, FORBIDDEN are defined in ValuationStructure

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

join

public void join(TupleSet otherTuples)

toString

public java.lang.String toString()
Description copied from class: Constraint
Returns a string representation of the constraint. It actually returns the name of the constraint. If the constraint has not been given an explicit name, it's name is: getClass().getName() + "(" + variables + ")"

Overrides:
toString in class Constraint
Returns:
a string representation of the constraint