net.sf.cpsolver.ifs.model
Class BinaryConstraint<V extends Variable<V,T>,T extends Value<V,T>>

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint<V,T>
      extended by net.sf.cpsolver.ifs.model.BinaryConstraint<V,T>
All Implemented Interfaces:
Comparable<Constraint<V,T>>
Direct Known Subclasses:
CSPBinaryConstraint, Dependence, JenrlConstraint

public abstract class BinaryConstraint<V extends Variable<V,T>,T extends Value<V,T>>
extends Constraint<V,T>

Binary constraint.

Extension of Constraint that links exactly two variables.

Version:
IFS 1.2 (Iterative Forward Search)
Copyright (C) 2006 - 2010 Tomáš Müller
muller@unitime.org
http://muller.unitime.org

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
See Also:
Variable, Constraint, Model

Field Summary
 
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
BinaryConstraint()
           
 
Method Summary
 void addVariable(V var)
          Add a variable to this constraint
 V another(V variable)
          Returns the variable out of the constraints variables which is different from the given variable.
 V first()
          First variable
 boolean isFirst(V variable)
          True, id the given variable is the first one
 V second()
          Second variable
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, assigned, assignedVariables, compareTo, computeConflicts, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, inConflict, isConsistent, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryConstraint

public BinaryConstraint()
Method Detail

addVariable

public void addVariable(V var)
Description copied from class: Constraint
Add a variable to this constraint

Overrides:
addVariable in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

first

public V first()
First variable


second

public V second()
Second variable


isFirst

public boolean isFirst(V variable)
True, id the given variable is the first one


another

public V another(V variable)
Returns the variable out of the constraints variables which is different from the given variable.