jopt.csp.spi.arcalgorithm.domain
Class BooleanComputedDomain

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.domain.AbstractDomain
      extended byjopt.csp.spi.arcalgorithm.domain.BooleanComputedDomain
All Implemented Interfaces:
BooleanDomain, ChoicePointDataSource, Domain, DomainChangeSource, IntDomain, NumDomain

public class BooleanComputedDomain
extends AbstractDomain
implements BooleanDomain


Constructor Summary
BooleanComputedDomain(BooleanDomain domA, BooleanDomain domB, boolean notB, boolean constVal, GenericBooleanConstant genConstVal, int operation)
          Creates new boolean computed domain based on a an expression built from other boolean domains
BooleanComputedDomain(jopt.csp.variable.CspConstraint constraint)
          Creates new boolean domain that wraps a constraint
 
Method Summary
 boolean choicePointStackSet()
          Returns true if a call to setChoicePointStack will fail
 void clearDelta()
          Clears the delta set for this domain
 java.lang.Object clone()
          Returns a copy of this domain
 jopt.csp.util.NumberIterator deltaValues()
          Returns iterator of values in node's delta
 jopt.csp.util.NumSet getDeltaSet()
          Returns the delta set for this domain
 java.lang.Object getDomainState()
          Stores all necessary information for this domain allowing it to be restored to a previous state at a later point in time.
 int getMax()
          Returns maximum value of domain
 int getMin()
          Returns minimum value of domain
 int getNextHigher(int val)
          Returns the next higher value in the domain or current value if none exists
 java.lang.Number getNextHigher(java.lang.Number val)
           
 int getNextLower(int val)
          Returns the next lower value in the domain or current value if none exists
 java.lang.Number getNextLower(java.lang.Number val)
           
 int getSize()
          Returns size of domain
 boolean isBound()
          Returns true if domain is bound to a value
 boolean isFalse()
          Returns true if this domain is bound to a false value
 boolean isInDomain(boolean bool)
          Returns true if value is in domain
 boolean isInDomain(int val)
          Returns true if value is in domain
 boolean isInDomain(java.lang.Number val)
           
 boolean isTrue()
          Returns true if this domain is bound to a true value
 void removeDomain(jopt.csp.util.NumSet vals)
          Attempts to reduce a domain by removing a set of values
 void removeRange(int start, int end)
          Attempts to reduce domain by removing a range of values
 void removeValue(int val)
          Attempts to remove a single value from the domain
 void restoreDomainState(java.lang.Object state)
          Restores a domain to a previous state using the information contained in the state parameter.
 void setChoicePointStack(ChoicePointStack cps)
          Sets the choicepoint stack associated with this domain.
 void setDomain(jopt.csp.util.NumSet s)
          Attempts to reduce a domain by restricting it to a set of values
 void setFalse()
          Attempts to reduce domain to a false value
 void setMax(int val)
          Attempts to reduce domain to a maximum value.
 void setMin(int val)
          Attempts to reduce domain to a minimum value.
 void setRange(int start, int end)
          Attempts to reduce domain to within a range of values
 void setTrue()
          Attempts to reduce domain to a true value
 void setValue(int val)
          Attempts to reduce domain to a single value.
 jopt.csp.util.NumSet toSet()
          Returns set of Numbers and NumIntervals representing domain
 java.lang.String toString()
           
 jopt.csp.util.NumberIterator values()
          Returns iterator of values in node's domain
 
Methods inherited from class jopt.csp.spi.arcalgorithm.domain.AbstractDomain
addDomainChangeListener, addRangeChangeListener, addValueChangeListener, changed, removeDomainChangeListener, removeRangeChangeListener, removeValueChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jopt.csp.spi.arcalgorithm.domain.Domain
changed
 

Constructor Detail

BooleanComputedDomain

public BooleanComputedDomain(jopt.csp.variable.CspConstraint constraint)
Creates new boolean domain that wraps a constraint


BooleanComputedDomain

public BooleanComputedDomain(BooleanDomain domA,
                             BooleanDomain domB,
                             boolean notB,
                             boolean constVal,
                             GenericBooleanConstant genConstVal,
                             int operation)
Creates new boolean computed domain based on a an expression built from other boolean domains

Method Detail

isTrue

public boolean isTrue()
Returns true if this domain is bound to a true value

Specified by:
isTrue in interface BooleanDomain

isFalse

public boolean isFalse()
Returns true if this domain is bound to a false value

Specified by:
isFalse in interface BooleanDomain

getSize

public int getSize()
Returns size of domain

Specified by:
getSize in interface NumDomain

isBound

public boolean isBound()
Returns true if domain is bound to a value

Specified by:
isBound in interface Domain

isInDomain

public boolean isInDomain(boolean bool)
Returns true if value is in domain

Specified by:
isInDomain in interface BooleanDomain

setTrue

public void setTrue()
Attempts to reduce domain to a true value

Specified by:
setTrue in interface BooleanDomain
Throws:
jopt.csp.variable.PropagationFailureException - If domain is empty

setFalse

public void setFalse()
Attempts to reduce domain to a false value

Specified by:
setFalse in interface BooleanDomain
Throws:
jopt.csp.variable.PropagationFailureException - If domain is empty

setChoicePointStack

public void setChoicePointStack(ChoicePointStack cps)
Sets the choicepoint stack associated with this domain. Can only be set once

Specified by:
setChoicePointStack in interface ChoicePointDataSource

choicePointStackSet

public boolean choicePointStackSet()
Returns true if a call to setChoicePointStack will fail

Specified by:
choicePointStackSet in interface ChoicePointDataSource

getDomainState

public java.lang.Object getDomainState()
Stores all necessary information for this domain allowing it to be restored to a previous state at a later point in time.

Specified by:
getDomainState in interface Domain
Returns:
an Object representing the current state information for this domain
See Also:
Domain.restoreDomainState(java.lang.Object)

restoreDomainState

public void restoreDomainState(java.lang.Object state)
Restores a domain to a previous state using the information contained in the state parameter.

Specified by:
restoreDomainState in interface Domain
Parameters:
state - The state information to which this domain should be set
See Also:
Domain.restoreDomainState(java.lang.Object)

values

public jopt.csp.util.NumberIterator values()
Returns iterator of values in node's domain

Specified by:
values in interface NumDomain

deltaValues

public jopt.csp.util.NumberIterator deltaValues()
Returns iterator of values in node's delta

Specified by:
deltaValues in interface NumDomain

toSet

public jopt.csp.util.NumSet toSet()
Returns set of Numbers and NumIntervals representing domain

Specified by:
toSet in interface NumDomain

getDeltaSet

public jopt.csp.util.NumSet getDeltaSet()
Returns the delta set for this domain

Specified by:
getDeltaSet in interface NumDomain

clearDelta

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

Specified by:
clearDelta in interface Domain

toString

public java.lang.String toString()

getMax

public int getMax()
Description copied from interface: IntDomain
Returns maximum value of domain

Specified by:
getMax in interface IntDomain

getMin

public int getMin()
Description copied from interface: IntDomain
Returns minimum value of domain

Specified by:
getMin in interface IntDomain

isInDomain

public boolean isInDomain(java.lang.Number val)

isInDomain

public boolean isInDomain(int val)
Description copied from interface: IntDomain
Returns true if value is in domain

Specified by:
isInDomain in interface IntDomain

getNextHigher

public java.lang.Number getNextHigher(java.lang.Number val)

getNextHigher

public int getNextHigher(int val)
Description copied from interface: IntDomain
Returns the next higher value in the domain or current value if none exists

Specified by:
getNextHigher in interface IntDomain

getNextLower

public java.lang.Number getNextLower(java.lang.Number val)

getNextLower

public int getNextLower(int val)
Description copied from interface: IntDomain
Returns the next lower value in the domain or current value if none exists

Specified by:
getNextLower in interface IntDomain

setMax

public void setMax(int val)
Description copied from interface: IntDomain
Attempts to reduce domain to a maximum value.

Specified by:
setMax in interface IntDomain

setMin

public void setMin(int val)
Description copied from interface: IntDomain
Attempts to reduce domain to a minimum value.

Specified by:
setMin in interface IntDomain

setValue

public void setValue(int val)
Description copied from interface: IntDomain
Attempts to reduce domain to a single value.

Specified by:
setValue in interface IntDomain

removeValue

public void removeValue(int val)
Description copied from interface: IntDomain
Attempts to remove a single value from the domain

Specified by:
removeValue in interface IntDomain

setRange

public void setRange(int start,
                     int end)
Description copied from interface: IntDomain
Attempts to reduce domain to within a range of values

Specified by:
setRange in interface IntDomain

removeRange

public void removeRange(int start,
                        int end)
Description copied from interface: IntDomain
Attempts to reduce domain by removing a range of values

Specified by:
removeRange in interface IntDomain

setDomain

public void setDomain(jopt.csp.util.NumSet s)
Description copied from interface: NumDomain
Attempts to reduce a domain by restricting it to a set of values

Specified by:
setDomain in interface NumDomain

removeDomain

public void removeDomain(jopt.csp.util.NumSet vals)
Description copied from interface: NumDomain
Attempts to reduce a domain by removing a set of values

Specified by:
removeDomain in interface NumDomain

clone

public java.lang.Object clone()
Description copied from interface: Domain
Returns a copy of this domain

Specified by:
clone in interface Domain
Specified by:
clone in class AbstractDomain