javax.constraints
Interface Var

All Superinterfaces:
ConstrainedVariable
All Known Subinterfaces:
VarBool
All Known Implementing Classes:
AbstractVar

public interface Var
extends ConstrainedVariable

This interface represents constrained integer variables, the most frequently used type of constrained objects.


Method Summary
 Var abs()
          Returns a new Var that is constrained to be the absolute value of this variable.
 int compareTo(Var var)
           
 boolean contains(int value)
          Returns true if the domain of this variable contains the value.
 Var divide(int value)
          Returns a new Var that is constrained to be the division of this variable by the given value, i.e.
 Var divide(Var var)
          Returns a new Var that is constrained to be the division of this variable by the given variable, i.e.
 int getDomainSize()
          Returns the current number of values inside the domain of this variable.
 DomainType getDomainType()
          Returns the type of this variable's domain.
 java.lang.String getInitialDomain()
          Returns a string representation of the initial domain of this variable.
 int getMax()
          Returns the current maximum value in the domain of this variable.
 int getMin()
          Returns the current minimum value in the domain of this variable.
 int getValue()
          Returns the value to which this variable has been instantiated, throws a RuntimeException if the variable is not instantiated.
 boolean isBound()
          Returns true if the domain of the variable contains only one value.
 Var minus(int value)
          Returns a new Var that is constrained to be the difference of this variable and the given value, i.e.
 Var minus(Var var)
          Returns a new Var that is constrained to be the difference of this variable and the given variable, i.e.
 Var mod(int value)
          Returns a new Var that is constrained to be the remainder after performing integer division of this variable by the given value, i.e.
 Var multiply(int value)
          Returns a new Var that is constrained to be the product of this variable and the given value, i.e.
 Var multiply(Var var)
          Returns a new Var that is constrained to be the product of this variable and the given variable, i.e.
 Var negative()
          Returns a new Var that is constrained to be the negation of this variable, i.e.
 Var plus(int value)
          Returns a new Var that is constrained to be the sum of this variable and the given value, i.e.
 Var plus(Var var)
          Returns a new Var that is constrained to be the sum of this variable and the given variable, i.e.
 Var power(int value)
          Returns a new Var that is constrained to be this variable raised to the power of the given value, i.e.
 void setDomainType(DomainType type)
          Changes the domain type of this variable.
 Var sqr()
          Returns a new Var that is constrained to be the product of this variable and itself, i.e.
 
Methods inherited from interface javax.constraints.ConstrainedVariable
getImpl, getName, getObject, getProblem, setImpl, setName, setObject
 

Method Detail

abs

Var abs()
Returns a new Var that is constrained to be the absolute value of this variable.

Returns:
a Var that represents the absolute value of this variable.

compareTo

int compareTo(Var var)

contains

boolean contains(int value)
Returns true if the domain of this variable contains the value.

Returns:
true if the value is in the domain of this variable

divide

Var divide(int value)
Returns a new Var that is constrained to be the division of this variable by the given value, i.e. this / value.

Parameters:
value - the given value.
Returns:
a Var that represents: this / value.

divide

Var divide(Var var)
           throws java.lang.Exception
Returns a new Var that is constrained to be the division of this variable by the given variable, i.e. this / var.

Parameters:
var - the given variable.
Returns:
a Var that represents: this / var.
Throws:
java.lang.Exception - if dividing by zero.

getDomainSize

int getDomainSize()
Returns the current number of values inside the domain of this variable.

Returns:
the current number of values inside the domain of this variable.

getDomainType

DomainType getDomainType()
Returns the type of this variable's domain.

Returns:
the type of this variable's domain.

getInitialDomain

java.lang.String getInitialDomain()
Returns a string representation of the initial domain of this variable.

Returns:
a string representation of the initial domain of this variable.

getMax

int getMax()
Returns the current maximum value in the domain of this variable.

Returns:
the current maximum value in the domain of this variable.

getMin

int getMin()
Returns the current minimum value in the domain of this variable.

Returns:
the current minimum value in the domain of this variable.

getValue

int getValue()
Returns the value to which this variable has been instantiated, throws a RuntimeException if the variable is not instantiated.

Returns:
the value of this instantiated variable.
Throws:
java.lang.RuntimeException - if this variable is not instantiated.

isBound

boolean isBound()
Returns true if the domain of the variable contains only one value.

Returns:
true if the domain of the variable contains only one value.

minus

Var minus(int value)
Returns a new Var that is constrained to be the difference of this variable and the given value, i.e. this - value.

Parameters:
value - the given value.
Returns:
a Var that represents: this - value.

minus

Var minus(Var var)
Returns a new Var that is constrained to be the difference of this variable and the given variable, i.e. this - var.

Parameters:
var - the given variable.
Returns:
a Var that represents: this - var.

mod

Var mod(int value)
Returns a new Var that is constrained to be the remainder after performing integer division of this variable by the given value, i.e. mod(this,value).

Parameters:
value - the given value.
Returns:
a Var that represents: mod(this,value).

multiply

Var multiply(int value)
Returns a new Var that is constrained to be the product of this variable and the given value, i.e. this * value.

Parameters:
value - the given value.
Returns:
a Var that represents: this * value.

multiply

Var multiply(Var var)
Returns a new Var that is constrained to be the product of this variable and the given variable, i.e. this * var.

Parameters:
var - the given variable.
Returns:
a Var that represents: this * var.

negative

Var negative()
Returns a new Var that is constrained to be the negation of this variable, i.e. 0 - this.

Returns:
a Var that represents: 0 - this.

plus

Var plus(int value)
Returns a new Var that is constrained to be the sum of this variable and the given value, i.e. this + value.

Parameters:
value - the given value.
Returns:
a Var that represents: this + value.

plus

Var plus(Var var)
Returns a new Var that is constrained to be the sum of this variable and the given variable, i.e. this + var.

Parameters:
var - the given variable.
Returns:
a Var that represents: this + var.

power

Var power(int value)
Returns a new Var that is constrained to be this variable raised to the power of the given value, i.e. this**value.

Parameters:
value - the given value.
Returns:
a Var that represents: this**value.

setDomainType

void setDomainType(DomainType type)
Changes the domain type of this variable. Setting domain type AFTER a variable was created allows to take into consideration posted constraints and other problem state specific information.

Parameters:
type -

sqr

Var sqr()
Returns a new Var that is constrained to be the product of this variable and itself, i.e. this * this.

Returns:
a Var that represents: this * this.