jopt.csp.variable
Interface CspIntVariable

All Superinterfaces:
CspIntExpr, CspNumExpr, CspNumVariable, CspVariable

public interface CspIntVariable
extends CspIntExpr, CspNumVariable

Interface implemented by integer based variables. The domain that is associated with this type of variable can be modified unlike CspIntExpr objects.


Method Summary
 int getMax()
          Returns the maximum value of this variable's domain
 int getMin()
          Returns the minimum value of this variable's domain
 int getNextHigher(int val)
          Returns the next higher value in this variable's domain or current value if none exists
 int getNextLower(int val)
          Returns the next lower value in this variable's domain or current value if none exists
 boolean isInDomain(int val)
          Returns true if the specified value is in this variable's domain
 void removeAll(IntSet set)
          Attempts to reduce this variable's domain by removing a set of values
 void removeRange(int start, int end)
          Attempts to reduce this variable's domain by removing a range of values
 void removeValue(int val)
          Attempts to remove a single value from this variable's domain
 void setMax(int val)
          Attempts to reduce this variable's domain to be less than the specified maximum value.
 void setMin(int val)
          Attempts to reduce this variable's domain to be less than the specified minimum value.
 void setRange(int start, int end)
          Attempts to reduce this variable's domain to within a range of values
 void setValue(int val)
          Attempts to reduce this variable's domain to a single value.
 
Methods inherited from interface jopt.csp.variable.CspIntExpr
add, add, add, add, add, add, add, add, between, between, divide, divide, divide, divide, divide, divide, divide, divide, eq, eq, geq, geq, gt, gt, leq, leq, lt, lt, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiply, neq, neq, notBetween, notBetween, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract
 
Methods inherited from interface jopt.csp.variable.CspNumExpr
between, between, between, between, eq, geq, getName, gt, isBound, leq, lt, neq, notBetween, notBetween, notBetween, notBetween, setName
 
Methods inherited from interface jopt.csp.variable.CspVariable
getName, getSize, isBound
 

Method Detail

getMax

public int getMax()
Returns the maximum value of this variable's domain

Specified by:
getMax in interface CspIntExpr
Returns:
maximum value of this variable's domain

getMin

public int getMin()
Returns the minimum value of this variable's domain

Specified by:
getMin in interface CspIntExpr
Returns:
minimum value of this variable's domain

isInDomain

public boolean isInDomain(int val)
Returns true if the specified value is in this variable's domain

Parameters:
val - value to check if it is in the domain
Returns:
true if value is present in the domain

setMax

public void setMax(int val)
            throws PropagationFailureException
Attempts to reduce this variable's domain to be less than the specified maximum value.

Parameters:
val - value to set as the domain's maximum value
Throws:
PropagationFailureException - If this would cause the domain to become empty

setMin

public void setMin(int val)
            throws PropagationFailureException
Attempts to reduce this variable's domain to be less than the specified minimum value.

Parameters:
val - value to set as the domain's minimum value
Throws:
PropagationFailureException - If this would cause the domain to become empty

setValue

public void setValue(int val)
              throws PropagationFailureException
Attempts to reduce this variable's domain to a single value.

Parameters:
val - value to reduce the domain to
Throws:
PropagationFailureException - If this would cause the domain to become empty

removeValue

public void removeValue(int val)
                 throws PropagationFailureException
Attempts to remove a single value from this variable's domain

Parameters:
val - value to remove from variable's domain
Throws:
PropagationFailureException - If this would cause the domain to become empty

setRange

public void setRange(int start,
                     int end)
              throws PropagationFailureException
Attempts to reduce this variable's domain to within a range of values

Parameters:
start - value to set as domain's minimum value
end - value to set as domain's maximum value
Throws:
PropagationFailureException - If this would cause the domain to become empty

removeRange

public void removeRange(int start,
                        int end)
                 throws PropagationFailureException
Attempts to reduce this variable's domain by removing a range of values

Parameters:
start - minimum value of range to remove
end - maximum value of range to remove
Throws:
PropagationFailureException - If this would cause the domain to become empty

removeAll

public void removeAll(IntSet set)
               throws PropagationFailureException
Attempts to reduce this variable's domain by removing a set of values

Parameters:
set - set of values to remove from the domain
Throws:
PropagationFailureException - If this would cause the domain to become empty

getNextHigher

public int getNextHigher(int val)
Returns the next higher value in this variable's domain or current value if none exists

Parameters:
val - value of which to obtain the next higher
Returns:
the next value in the domain that is that is higher than val in the domain, if one is present else returns the same number back

getNextLower

public int getNextLower(int val)
Returns the next lower value in this variable's domain or current value if none exists

Parameters:
val - value of which to obtain the next lower
Returns:
the next value in the domain that is lower than val in the domain, if one is present else returns the same number back