choco.kernel.model.constraints
Class AbstractConstraint

java.lang.Object
  extended by choco.kernel.model.VariableArray
      extended by choco.kernel.model.ModelObject
          extended by choco.kernel.model.constraints.AbstractConstraint
All Implemented Interfaces:
IPretty, IIndex, Constraint, IFindManager, IOptions, IVariableArray, Serializable, Comparable
Direct Known Subclasses:
ComponentConstraint, MetaConstraint

public abstract class AbstractConstraint
extends ModelObject
implements Constraint, Comparable

Author:
Arnaud Malapert
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class choco.kernel.model.VariableArray
VariableArray.VConstraintsDataStructure
 
Field Summary
protected  String manager
           
 
Fields inherited from class choco.kernel.model.VariableArray
NO_CONSTRAINTS
 
Fields inherited from interface choco.kernel.model.constraints.Constraint
LOGGER
 
Constructor Summary
AbstractConstraint(ConstraintType type, Variable[] variables)
           
AbstractConstraint(String consMan, Variable[] variables)
           
 
Method Summary
 int compareTo(Object o)
          Compares this object with the specified object for order.
 void findManager(Properties propertiesFile)
          Set the class manager
 ConstraintManager getConstraintManager()
           
 ConstraintType getConstraintType()
           
 ExpressionManager getExpressionManager()
          Return the constraint manager
 int[] getFavoriteDomains()
           
 IntegerVariable[] getIntVariableScope()
          get rid of the constants within the returned scopes !
 String getManager()
           
 String getName()
           
 Object getParameters()
           
 String pretty()
          pretty printing of the object.
 
Methods inherited from class choco.kernel.model.ModelObject
addOption, addOptions, addOptions, addOptions, addOptions, containsOption, getIndex, getOptions, hashCode, toString
 
Methods inherited from class choco.kernel.model.VariableArray
cancelExtractVariables, doExtractVariables, extractVariables, forceExtractVariables, getNbVars, getVariable, getVariableIterator, getVariables, replaceBy, replaceByConstantAt, setVariables, setVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.kernel.common.IIndex
getIndex
 
Methods inherited from interface choco.kernel.model.IVariableArray
extractVariables, getNbVars, getVariable, getVariableIterator, getVariables, replaceBy
 
Methods inherited from interface choco.kernel.model.IOptions
addOption, addOptions, addOptions, addOptions, addOptions, containsOption, getOptions
 

Field Detail

manager

protected String manager
Constructor Detail

AbstractConstraint

public AbstractConstraint(ConstraintType type,
                          Variable[] variables)

AbstractConstraint

public AbstractConstraint(String consMan,
                          Variable[] variables)
Method Detail

getParameters

public Object getParameters()

getName

public String getName()
Specified by:
getName in interface Constraint

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
Overrides:
pretty in class VariableArray
Returns:
a readable string representation of the object

getConstraintType

public final ConstraintType getConstraintType()
Specified by:
getConstraintType in interface Constraint

getIntVariableScope

public IntegerVariable[] getIntVariableScope()
get rid of the constants within the returned scopes !

Returns:
scope of integervariable of the constraint

getFavoriteDomains

public int[] getFavoriteDomains()
Specified by:
getFavoriteDomains in interface Constraint
Returns:
a list of domains accepted by the constraint and sorted by order of preference

getConstraintManager

public ConstraintManager getConstraintManager()

getExpressionManager

public ExpressionManager getExpressionManager()
Description copied from interface: Constraint
Return the constraint manager

Specified by:
getExpressionManager in interface Constraint
Returns:
constraint manager

getManager

public final String getManager()

findManager

public void findManager(Properties propertiesFile)
Description copied from interface: IFindManager
Set the class manager

Specified by:
findManager in interface IFindManager

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.

Specified by:
compareTo in interface Comparable
Parameters:
o - the object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this object.


Copyright © 2012. All Rights Reserved.