Module org.maxicp

Interface CPBoolVar

All Superinterfaces:
BoolExpression, BoolVar, ConcreteBoolVar, ConcreteIntVar, ConcreteVar, CPIntVar, CPVar, Expression, IntExpression, IntVar, Serializable, Var
All Known Implementing Classes:
CPBoolVarImpl, CPBoolVarIsEqual

public interface CPBoolVar extends CPIntVar, ConcreteBoolVar
Boolean variable, that can be used as a 0-1 IntVar.

0 corresponds to false, and 1 corresponds to true

  • Method Details

    • isTrue

      boolean isTrue()
      Tests if the variable is fixed to true
      Returns:
      true if the variable is fixed to true (value 1)
    • isFalse

      boolean isFalse()
      Tests if the variable is fixed to false
      Returns:
      true if the variable is fixed to false (value 0)
    • fix

      void fix(boolean b)
      Fixes the variable
      Parameters:
      b - the value to assign to this boolean variable
      Throws:
      InconsistencyException - is thrown if the value is not in the domain
    • min

      default int min()
      Description copied from interface: CPIntVar
      Returns the minimum of the domain of the variable
      Specified by:
      min in interface CPIntVar
      Specified by:
      min in interface IntExpression
      Returns:
      the minimum of the domain of the variable
    • max

      default int max()
      Description copied from interface: CPIntVar
      Returns the maximum of the domain of the variable
      Specified by:
      max in interface CPIntVar
      Specified by:
      max in interface IntExpression
      Returns:
      the maximum of the domain of the variable
    • fillArray

      default int fillArray(int[] array)
      Description copied from interface: CPIntVar
      Copies the values of the domain into an array.
      Specified by:
      fillArray in interface CPIntVar
      Specified by:
      fillArray in interface IntExpression
      Parameters:
      array - an array large enough dest.length >= size()
      Returns:
      the size of the domain and dest[0,...,size-1] contains the values in the domain in an arbitrary order
    • size

      default int size()
      Description copied from interface: CPIntVar
      Returns the size of the domain of the variable
      Specified by:
      size in interface CPIntVar
      Specified by:
      size in interface IntExpression
      Returns:
      the size of the domain of the variable
    • contains

      default boolean contains(int v)
      Description copied from interface: CPIntVar
      Returns true if the domain contains the specified value.
      Specified by:
      contains in interface CPIntVar
      Specified by:
      contains in interface IntExpression
      Parameters:
      v - the value whose presence in the domain is to be tested
      Returns:
      true if the domain contains the specified value
    • evaluateBool

      default boolean evaluateBool() throws VariableNotFixedException
      Specified by:
      evaluateBool in interface BoolExpression
      Throws:
      VariableNotFixedException