jopt.csp.spi.arcalgorithm.variable
Class SetVariableBase

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.variable.VariableChangeBase
      extended byjopt.csp.spi.arcalgorithm.variable.SetVariableBase
All Implemented Interfaces:
jopt.csp.variable.CspSetVariable, jopt.csp.variable.CspVariable, SetVariable, Storable, Variable, VariableChangeSource
Direct Known Subclasses:
IntSetVariable

public abstract class SetVariableBase
extends VariableChangeBase
implements jopt.csp.variable.CspSetVariable, SetVariable, Variable


Method Summary
 void addRequired(java.lang.Object value)
          Adds a required value to the set
 void addRequired(java.util.Set values)
          Adds a set of values to the required set
 void clearDelta()
          Clears the delta set for this domain
 boolean equals(java.lang.Object obj)
          Allows for equality comparisons between SetVariableBase objects
 SetDomain getDomain()
          Returns domain for variable
 java.lang.String getName()
          Returns name of node
abstract  SetNode getNode()
          Retrieves node for an expression
 int getPossibleCardinality()
          Returns possible cardinality
 java.util.Set getPossibleDeltaSet()
          Returns the possible-delta set
 java.util.Set getPossibleSet()
          Returns possible set of values in this variable's domain
 int getRequiredCardinality()
          Returns required cardinality
 java.util.Set getRequiredDeltaSet()
          Returns the required-delta set
 java.util.Set getRequiredSet()
          Returns required set of values in this variable's domain
 int getSize()
          Returns 1 + cardinality of possible - cardinality of required
 java.lang.Object getState()
          Stores appropriate data for future restoration.
 int hashCode()
          Returns a hash code based on this variable's name (if one exists)
 boolean isBound()
          Returns true if this variable's domain is bound to a value
 boolean isInDomain(java.lang.Object val)
          Returns true if value is in this variable's domain
 boolean isPossible(java.lang.Object value)
          Returns true if the specified value is possible
 boolean isRequired(java.lang.Object value)
          Returns true if the specified value is required
 void removePossible(java.lang.Object value)
          Removes a value from the possible set
 void removePossible(java.util.Set values)
          Removes a set of values from the possible set
 void restoreState(java.lang.Object state)
          Restores variable information from stored data.
 void setName(java.lang.String name)
          Sets name of node
 java.lang.String toString()
           
 void updateGraph(NodeArcGraph graph)
          Adds arcs representing this expression to the node arc graph
 
Methods inherited from class jopt.csp.spi.arcalgorithm.variable.VariableChangeBase
addVariableChangeListener, removeVariableChangeListener
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
Returns name of node

Specified by:
getName in interface jopt.csp.variable.CspSetVariable

setName

public void setName(java.lang.String name)
Sets name of node

Specified by:
setName in interface jopt.csp.variable.CspSetVariable

getNode

public abstract SetNode getNode()
Retrieves node for an expression

Specified by:
getNode in interface SetVariable

getDomain

public SetDomain getDomain()
Returns domain for variable

Specified by:
getDomain in interface SetVariable

updateGraph

public void updateGraph(NodeArcGraph graph)
Adds arcs representing this expression to the node arc graph

Specified by:
updateGraph in interface SetVariable

hashCode

public int hashCode()
Returns a hash code based on this variable's name (if one exists)


equals

public final boolean equals(java.lang.Object obj)
Allows for equality comparisons between SetVariableBase objects

Parameters:
obj -
Returns:
true if the specified object is a SetVariableBase and its name is identical to this SetVariableBase object

isInDomain

public final boolean isInDomain(java.lang.Object val)
Returns true if value is in this variable's domain

Specified by:
isInDomain in interface jopt.csp.variable.CspSetVariable

isRequired

public final boolean isRequired(java.lang.Object value)
Returns true if the specified value is required

Specified by:
isRequired in interface jopt.csp.variable.CspSetVariable

isPossible

public final boolean isPossible(java.lang.Object value)
Returns true if the specified value is possible

Specified by:
isPossible in interface jopt.csp.variable.CspSetVariable

addRequired

public final void addRequired(java.lang.Object value)
                       throws jopt.csp.variable.PropagationFailureException
Adds a required value to the set

Specified by:
addRequired in interface jopt.csp.variable.CspSetVariable
Throws:
jopt.csp.variable.PropagationFailureException

addRequired

public final void addRequired(java.util.Set values)
                       throws jopt.csp.variable.PropagationFailureException
Adds a set of values to the required set

Specified by:
addRequired in interface jopt.csp.variable.CspSetVariable
Throws:
jopt.csp.variable.PropagationFailureException

removePossible

public final void removePossible(java.lang.Object value)
                          throws jopt.csp.variable.PropagationFailureException
Removes a value from the possible set

Specified by:
removePossible in interface jopt.csp.variable.CspSetVariable
Throws:
jopt.csp.variable.PropagationFailureException

removePossible

public final void removePossible(java.util.Set values)
                          throws jopt.csp.variable.PropagationFailureException
Removes a set of values from the possible set

Specified by:
removePossible in interface jopt.csp.variable.CspSetVariable
Throws:
jopt.csp.variable.PropagationFailureException

clearDelta

public final void clearDelta()
Clears the delta set for this domain


getSize

public final int getSize()
Returns 1 + cardinality of possible - cardinality of required

Specified by:
getSize in interface jopt.csp.variable.CspSetVariable

getPossibleCardinality

public final int getPossibleCardinality()
Returns possible cardinality

Specified by:
getPossibleCardinality in interface jopt.csp.variable.CspSetVariable

getPossibleDeltaSet

public final java.util.Set getPossibleDeltaSet()
Returns the possible-delta set


getPossibleSet

public final java.util.Set getPossibleSet()
Returns possible set of values in this variable's domain

Specified by:
getPossibleSet in interface jopt.csp.variable.CspSetVariable

getRequiredCardinality

public final int getRequiredCardinality()
Returns required cardinality

Specified by:
getRequiredCardinality in interface jopt.csp.variable.CspSetVariable

getRequiredDeltaSet

public final java.util.Set getRequiredDeltaSet()
Returns the required-delta set


getRequiredSet

public final java.util.Set getRequiredSet()
Returns required set of values in this variable's domain

Specified by:
getRequiredSet in interface jopt.csp.variable.CspSetVariable

isBound

public final boolean isBound()
Returns true if this variable's domain is bound to a value

Specified by:
isBound in interface jopt.csp.variable.CspVariable

getState

public java.lang.Object getState()
Stores appropriate data for future restoration.

Specified by:
getState in interface Storable

restoreState

public void restoreState(java.lang.Object state)
Restores variable information from stored data.

Specified by:
restoreState in interface Storable

toString

public java.lang.String toString()