jopt.csp.variable
Interface CspLongVariable

All Superinterfaces:
CspDoubleCast, CspFloatCast, CspLongCast, CspLongExpr, CspNumExpr, CspNumVariable, CspVariable

public interface CspLongVariable
extends CspLongExpr, CspNumVariable

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


Method Summary
 long getMax()
          Returns the maximum value of this variable's domain
 long getMin()
          Returns the minimum value of this variable's domain
 long getNextHigher(long val)
          Returns the next higher value in this variable's domain or current value if none exists
 long getNextLower(long val)
          Returns the next lower value in this variable's domain or current value if none exists
 boolean isInDomain(long val)
          Returns true if the specified value is in this variable's domain
 void removeAll(LongSet set)
          Attempts to reduce this variable's domain by removing a set of values
 void removeRange(long start, long end)
          Attempts to reduce this variable's domain by removing a range of values
 void removeValue(long val)
          Attempts to remove a single value from this variable's domain
 void setMax(long val)
          Attempts to reduce this variable's domain to be less than the specified maximum value.
 void setMin(long val)
          Attempts to reduce this variable's domain to be less than the specified minimum value.
 void setRange(long start, long end)
          Attempts to reduce this variable's domain to within a range of values
 void setValue(long val)
          Attempts to reduce this variable's domain to a single value.
 
Methods inherited from interface jopt.csp.variable.CspLongExpr
add, add, add, add, add, add, between, between, divide, divide, divide, divide, divide, divide, eq, eq, geq, geq, gt, gt, leq, leq, lt, lt, multiply, multiply, multiply, multiply, multiply, multiply, neq, neq, notBetween, notBetween, 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 long getMax()
Returns the maximum value of this variable's domain

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

getMin

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

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

isInDomain

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

Parameters:
val - value to check if it is in this variable's domain
Returns:
true if val is present in this variable's domain

setMax

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

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

setMin

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

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

setValue

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

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

removeValue

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

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

removeAll

public void removeAll(LongSet 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

setRange

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

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

removeRange

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

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

getNextHigher

public long getNextHigher(long 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 long getNextLower(long 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