Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

mlsub.typing.lowlevel
Class Domain  view Domain download Domain.java

java.lang.Object
  extended bymlsub.typing.lowlevel.BitVector
      extended bymlsub.typing.lowlevel.Domain
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

final class Domain
extends BitVector

A "Domain" is a BitVector that holds all the possible values of a variable. A value can be any rigid variable or a special constant called "unit" which implements all the interfaces of the constraint but is comparable with no rigid variable. This is to handle satisfiability in the absence of any satisfiability witness For example, the constraint x <= x IS satisfiable even if there is no rigid variable. In this case, the domain of x is {unit} When a domain becomes empty, i.e., when it does not contain any rigid variable nor unit, it means that the contraint is unsatisfiable.

Version:
$Revision: 1.4 $, $Date: 2003/09/06 11:31:10 $

Field Summary
(package private)  int cardDown
           
(package private)  int cardUp
           
private  boolean containsUnit
           
(package private) static int DOWN
           
(package private) static int UP
           
 
Fields inherited from class mlsub.typing.lowlevel.BitVector
UNDEFINED_INDEX
 
Constructor Summary
Domain(int width)
           
 
Method Summary
(package private)  int cardinal()
           
 int chooseValue()
          choose a value in this domain Returns -1 if the only possible value is unit
 int chooseValue(boolean unit, BitVector set)
          Choose a value within (unit, set)
 boolean containsUnit()
           
 boolean containsValue(int value)
          value >= -1 (-1 represents unit)
 void exclude(BitVector set)
          Exclude all the values in set
 void exclude(int value)
          Exclude value of this domain assume value >= -1 (-1 represents unit)
 void excludeUnit()
           
(package private)  int getFirstBit()
          Iteration thru the domain elements
 int getNextBit(int i)
          Gets the first bit set that is strictly greater than i or UNDEFINED_INDEX if there is none
(package private)  void initGfpCardinals()
           
 void instantiate(int value)
          Restrict this domain to be exactly {value} value is required to be >= -1 (-1 represents unit)
 boolean intersect(BitVector set)
          Returns true if there is a common value in this and set i.e., if chooseValue(false, set) will not throw LowlevelUnsatisfiable
 boolean isEmpty()
          Returns true if no bit is set in this BitVector
 boolean needPropagation(int direction)
           
(package private)  void rawExcludeUnit()
           
 void reduce(boolean unit, BitVector set)
          Constrain this domain to be included in (set, unit)
 java.lang.String toString()
          Converts the BitVector to a String.
 
Methods inherited from class mlsub.typing.lowlevel.BitVector
addProduct, and, andNot, andNot, andNotAnd, andNotAndOr, andNotOr, andNotOr, bitCopy, bitCount, bitCount, bitMerge, clear, clearAll, clone, equals, fill, fillNot, get, getLowestClearedBit, getLowestSetBit, getLowestSetBit, getLowestSetBitAnd, getLowestSetBitAndNotIn, getLowestSetBitNotIn, hashCode, includedIn, or, orAnd, orNotIn, set, size, slowaddProduct, truncate, xor
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

containsUnit

private boolean containsUnit

UP

static final int UP
See Also:
Constant Field Values

DOWN

static final int DOWN
See Also:
Constant Field Values

cardUp

int cardUp

cardDown

int cardDown
Constructor Detail

Domain

public Domain(int width)
Method Detail

cardinal

int cardinal()

isEmpty

public boolean isEmpty()
Description copied from class: BitVector
Returns true if no bit is set in this BitVector

Overrides:
isEmpty in class BitVector

containsUnit

public boolean containsUnit()

needPropagation

public boolean needPropagation(int direction)

initGfpCardinals

void initGfpCardinals()

reduce

public void reduce(boolean unit,
                   BitVector set)
            throws LowlevelUnsatisfiable
Constrain this domain to be included in (set, unit)


exclude

public void exclude(BitVector set)
             throws LowlevelUnsatisfiable
Exclude all the values in set


rawExcludeUnit

void rawExcludeUnit()

excludeUnit

public void excludeUnit()
                 throws LowlevelUnsatisfiable

exclude

public void exclude(int value)
             throws LowlevelUnsatisfiable
Exclude value of this domain assume value >= -1 (-1 represents unit)


chooseValue

public int chooseValue()
                throws LowlevelUnsatisfiable
choose a value in this domain Returns -1 if the only possible value is unit


chooseValue

public int chooseValue(boolean unit,
                       BitVector set)
                throws LowlevelUnsatisfiable
Choose a value within (unit, set)


containsValue

public boolean containsValue(int value)
value >= -1 (-1 represents unit)


instantiate

public void instantiate(int value)
                 throws LowlevelUnsatisfiable
Restrict this domain to be exactly {value} value is required to be >= -1 (-1 represents unit)


intersect

public boolean intersect(BitVector set)
Returns true if there is a common value in this and set i.e., if chooseValue(false, set) will not throw LowlevelUnsatisfiable


toString

public java.lang.String toString()
Description copied from class: BitVector
Converts the BitVector to a String.

Overrides:
toString in class BitVector

getFirstBit

int getFirstBit()
Iteration thru the domain elements


getNextBit

public int getNextBit(int i)
Description copied from class: BitVector
Gets the first bit set that is strictly greater than i or UNDEFINED_INDEX if there is none

Overrides:
getNextBit in class BitVector