Package com.github.javabdd
Class BDDDomain
- java.lang.Object
-
- com.github.javabdd.BDDDomain
-
public abstract class BDDDomain extends Object
Represents a domain of BDD variables. This is useful for finite state machines, among other things.BDDDomains are called "finite domain blocks" in Section 2.9 of the buddy documentation. A BDDDomain is a block of BDD variables that can represent integer values as opposed to only true and false.
Use
BDDFactory.extDomain()to create one or more domains with a specified list of sizes.- See Also:
BDDFactory.extDomain(int[])
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBDDDomain(int index, BigInteger range)Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BDDbuildAdd(BDDDomain that, int bits, long value)BDDbuildAdd(BDDDomain that, long value)BDDbuildEquals(BDDDomain that)Builds a BDD which is true for all the possible assignments to the variable blocks that makes the blocks equal.BDDdomain()Returns what corresponds to a disjunction of all possible values of this domain.intensureCapacity(long range)intensureCapacity(BigInteger range)abstract BDDFactorygetFactory()Returns the factory that created this domain.intgetIndex()Returns the index of this domain.StringgetName()Gets the name of this domain.BigInteger[]getVarIndices(BDD that)Convert a BDDthatto a list of indices of this domain.BigInteger[]getVarIndices(BDD that, int max)Convert a BDDthatto a list of indices of this domain.BDDithVar(long val)Returns the BDD that defines the given value for this finite domain block.BDDithVar(BigInteger val)BDDVarSetset()Returns the variable set that contains the variables used to define this finite domain block.voidsetName(String name)Sets the name of this domain.BigIntegersize()Returns the size of the domain for this finite domain block.StringtoString()intvarNum()Returns the number of BDD variables used for this finite domain block.BDDvarRange(long lo, long hi)Returns the BDD that defines the given range of values, inclusive, for this finite domain block.BDDvarRange(BigInteger lo, BigInteger hi)int[]vars()Returns an integer array containing the indices of the BDD variables used to define this finite domain.
-
-
-
Field Detail
-
name
protected String name
-
index
protected int index
-
realsize
protected BigInteger realsize
-
ivar
protected int[] ivar
-
var
protected BDDVarSet var
-
-
Constructor Detail
-
BDDDomain
protected BDDDomain(int index, BigInteger range)Default constructor.- Parameters:
index- index of this domainrange- size of this domain
-
-
Method Detail
-
getFactory
public abstract BDDFactory getFactory()
Returns the factory that created this domain.- Returns:
- the BDD factory
-
setName
public void setName(String name)
Sets the name of this domain.- Parameters:
name- the name
-
getName
public String getName()
Gets the name of this domain.- Returns:
- the name
-
getIndex
public int getIndex()
Returns the index of this domain.- Returns:
- the index
-
domain
public BDD domain()
Returns what corresponds to a disjunction of all possible values of this domain. This is more efficient than doing ithVar(0) OR ithVar(1) ... explicitly for all values in the domain.Compare to fdd_domain.
- Returns:
- BDD representing the possible values of this domain
-
size
public BigInteger size()
Returns the size of the domain for this finite domain block.Compare to fdd_domainsize.
- Returns:
- the size
-
buildEquals
public BDD buildEquals(BDDDomain that)
Builds a BDD which is true for all the possible assignments to the variable blocks that makes the blocks equal.Compare to fdd_equals/fdd_equ.
- Parameters:
that- the other BDD domain- Returns:
- BDD
-
set
public BDDVarSet set()
Returns the variable set that contains the variables used to define this finite domain block.Compare to fdd_ithset.
- Returns:
- BDDVarSet
-
ithVar
public BDD ithVar(long val)
Returns the BDD that defines the given value for this finite domain block.Compare to fdd_ithvar.
- Parameters:
val- the given value- Returns:
- BDD
-
ithVar
public BDD ithVar(BigInteger val)
-
varRange
public BDD varRange(long lo, long hi)
Returns the BDD that defines the given range of values, inclusive, for this finite domain block.- Parameters:
lo- low value (inclusive)hi- high value (inclusive)- Returns:
- BDD
-
varRange
public BDD varRange(BigInteger lo, BigInteger hi)
-
varNum
public int varNum()
Returns the number of BDD variables used for this finite domain block.Compare to fdd_varnum.
- Returns:
- int
-
vars
public int[] vars()
Returns an integer array containing the indices of the BDD variables used to define this finite domain.Compare to fdd_vars.
- Returns:
- int[]
-
ensureCapacity
public int ensureCapacity(long range)
-
ensureCapacity
public int ensureCapacity(BigInteger range)
-
getVarIndices
public BigInteger[] getVarIndices(BDD that)
Convert a BDDthatto a list of indices of this domain. This method assumes that the BDD passed is a disjunction of ithVar(i_1) to ithVar(i_k). It returns an array of length 'k' with elements [i_1,...,i_k].Be careful when using this method for BDDs with a large number of entries, as it allocates a BigInteger[] array of dimension k.
- Parameters:
that- bdd that is the disjunction of domain indices- Returns:
- list of indices in this domain
- See Also:
getVarIndices(BDD,int),ithVar(BigInteger)
-
getVarIndices
public BigInteger[] getVarIndices(BDD that, int max)
Convert a BDDthatto a list of indices of this domain. Same as getVarIndices(BDD), except only 'max' indices are extracted.- Parameters:
that- bdd that is the disjunction of domain indicesmax- maximum number of entries to be returned- Returns:
- list of indices of this domain
- See Also:
ithVar(long)
-
-