Sugar version 1.13 Core API Specification

jp.ac.kobe_u.cs.sugar.csp
Class IntegerVariable

java.lang.Object
  extended by jp.ac.kobe_u.cs.sugar.csp.IntegerVariable
All Implemented Interfaces:
Comparable<IntegerVariable>

public class IntegerVariable
extends Object
implements Comparable<IntegerVariable>

This class implements an integer variable of CSP.

See Also:
CSP

Constructor Summary
IntegerVariable(IntegerDomain domain)
           
IntegerVariable(String name, IntegerDomain domain)
           
 
Method Summary
 int bound(int lb, int ub)
           
 int compareTo(IntegerVariable v)
           
 void decode(BitSet satValues)
           
 void encode(Encoder encoder)
           
 boolean equals(Object obj)
           
 int getCode()
          Returns the code value in the encoded representation.
 int getCodeLE(int value)
           
 int getCodeLE(int a, int b)
           
 String getComment()
          Returns the comment set to the integer variable.
 IntegerDomain getDomain()
           
 String getName()
          Returns the name of the integer variable.
 int getSatVariablesSize()
           
 int getValue()
          Returns the value of the integer variable.
 int hashCode()
           
 boolean isAux()
          Returns true when the integer variable is aux.
 boolean isModified()
           
 boolean isSatisfied()
          Returns true when the value is within the bounds.
 boolean isUnsatisfiable()
           
 void setCode(int code)
          Sets the code value in the encoded representation.
 void setComment(String comment)
          Sets the comment to the integer variable.
 void setModified(boolean modified)
           
 void setValue(int value)
          Sets the value of the integer variable.
 String toString()
          Returns the string representation of the integer variable.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerVariable

public IntegerVariable(String name,
                       IntegerDomain domain)
                throws SugarException
Throws:
SugarException

IntegerVariable

public IntegerVariable(IntegerDomain domain)
                throws SugarException
Throws:
SugarException
Method Detail

getName

public String getName()
Returns the name of the integer variable.

Returns:
the name

getDomain

public IntegerDomain getDomain()

isAux

public boolean isAux()
Returns true when the integer variable is aux.

Returns:
true when the integer variable is aux

getComment

public String getComment()
Returns the comment set to the integer variable.

Returns:
the comment

setComment

public void setComment(String comment)
Sets the comment to the integer variable.

Parameters:
comment - the comment to set

isModified

public boolean isModified()
Returns:
the modified

setModified

public void setModified(boolean modified)
Parameters:
modified - the modified to set

bound

public int bound(int lb,
                 int ub)
          throws SugarException
Throws:
SugarException

getCode

public int getCode()
Returns the code value in the encoded representation.

Returns:
the code value in the encoded representation

setCode

public void setCode(int code)
Sets the code value in the encoded representation.

Parameters:
code - the code value

getValue

public int getValue()
Returns the value of the integer variable.

Returns:
the value

setValue

public void setValue(int value)
Sets the value of the integer variable.

Parameters:
value - the value to set

isUnsatisfiable

public boolean isUnsatisfiable()

isSatisfied

public boolean isSatisfied()
Returns true when the value is within the bounds.

Returns:
true when the value is within the bounds

getSatVariablesSize

public int getSatVariablesSize()

getCodeLE

public int getCodeLE(int value)

getCodeLE

public int getCodeLE(int a,
                     int b)

encode

public void encode(Encoder encoder)
            throws IOException
Throws:
IOException

decode

public void decode(BitSet satValues)

compareTo

public int compareTo(IntegerVariable v)
Specified by:
compareTo in interface Comparable<IntegerVariable>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Returns the string representation of the integer variable.

Overrides:
toString in class Object
Returns:
the string representation

Sugar version 1.13 Core API Specification

Sugar: A SAT-based Constraint Solver