|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchord.bddbddb.Rel
public class Rel
Generic implementation of a BDD-based relation.
Typical usage is as follows:
setName(String), which sets the name of the relation,setSign(RelSign), which sets the signature of the relation, andsetDoms(Dom[]), which sets the domains of the relation.zero() or one() which initializes the relation in memory to an
empty or full one, respectively;add(int[]) or add(Object[]) with the argument in each
call being a tuple to be added to the relation in memory. If the tuple already exists in
the relation then the call does not have any effect.save(String), which also
removes the relation from memory (i.e., BDDs allocated for the relation in memory are freed).
load(String), which loads the
relation from disk into memory, and then calling any of the following:
close().
Note: Much of the BDD-related code in this class is adapted from bddbddb.
| Nested Class Summary | |
|---|---|
class |
Rel.AryNIterable
|
class |
Rel.HextIterable<T0,T1,T2,T3,T4,T5>
|
class |
Rel.IntAryNIterable
|
class |
Rel.IntHextIterable
|
class |
Rel.IntPairIterable
|
class |
Rel.IntPentIterable
|
class |
Rel.IntQuadIterable
|
class |
Rel.IntTrioIterable
|
class |
Rel.PairIterable<T0,T1>
|
class |
Rel.PentIterable<T0,T1,T2,T3,T4>
|
class |
Rel.QuadIterable<T0,T1,T2,T3>
|
class |
Rel.RelView
An immutable view of a relation. |
class |
Rel.SelfIterable<T>
|
class |
Rel.TrioIterable<T0,T1,T2>
|
class |
Rel.TupleIterator<T>
|
| Field Summary | |
|---|---|
protected net.sf.javabdd.BDD |
bdd
|
protected net.sf.javabdd.BDDDomain[] |
domBdds
|
protected int[] |
domIdxs
|
protected Dom[] |
doms
|
protected net.sf.javabdd.BDDFactory |
factory
|
protected net.sf.javabdd.BDD |
iterBdd
|
protected java.lang.String |
name
|
protected int |
numDoms
|
protected RelSign |
sign
|
| Constructor Summary | |
|---|---|
Rel()
|
|
| Method Summary | ||
|---|---|---|
void |
add(int idx0)
|
|
void |
add(int[] idxs)
|
|
void |
add(int idx0,
int idx1)
|
|
void |
add(int idx0,
int idx1,
int idx2)
|
|
void |
add(int idx0,
int idx1,
int idx2,
int idx3)
|
|
void |
add(int idx0,
int idx1,
int idx2,
int idx3,
int idx4)
|
|
void |
add(int idx0,
int idx1,
int idx2,
int idx3,
int idx4,
int idx5)
|
|
void |
add(java.lang.Object[] vals)
|
|
|
add(T0 val0)
|
|
|
add(T0 val0,
T1 val1)
|
|
|
add(T0 val0,
T1 val1,
T2 val2)
|
|
|
add(T0 val0,
T1 val1,
T2 val2,
T3 val3)
|
|
|
add(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4)
|
|
|
add(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4,
T5 val5)
|
|
protected void |
checkRange(int idx,
int domIdx)
|
|
protected void |
checkRange(java.lang.Object val,
int domIdx)
|
|
void |
close()
Frees this relation from memory. |
|
boolean |
contains(int idx0)
|
|
boolean |
contains(int idx0,
int idx1)
|
|
boolean |
contains(java.lang.Object[] vals)
|
|
|
contains(T0 val0)
|
|
|
contains(T0 val0,
T1 val1)
|
|
|
contains(T0 val0,
T1 val1,
T2 val2)
|
|
|
contains(T0 val0,
T1 val1,
T2 val2,
T3 val3)
|
|
|
contains(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4)
|
|
|
contains(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4,
T5 val5)
|
|
|
getAry1ValTuples()
|
|
Rel.IntPairIterable |
getAry2IntTuples()
|
|
|
getAry2ValTuples()
|
|
Rel.IntTrioIterable |
getAry3IntTuples()
|
|
|
getAry3ValTuples()
|
|
Rel.IntQuadIterable |
getAry4IntTuples()
|
|
|
getAry4ValTuples()
|
|
Rel.IntPentIterable |
getAry5IntTuples()
|
|
|
getAry5ValTuples()
|
|
Rel.IntHextIterable |
getAry6IntTuples()
|
|
|
getAry6ValTuples()
|
|
Rel.IntAryNIterable |
getAryNIntTuples()
|
|
Rel.AryNIterable |
getAryNValTuples()
|
|
Dom[] |
getDoms()
|
|
java.lang.String |
getName()
Provides the name of this relation. |
|
RelSign |
getSign()
Provides the signature of this relation. |
|
Rel.RelView |
getView()
Provides a fresh view of the relation. |
|
protected void |
initialize()
|
|
boolean |
isOpen()
Determines whether the relation in memory is initialized. |
|
void |
load(java.lang.String dirName)
Copies this relation from disk to memory. |
|
void |
one()
Sets this relation in memory to the full relation (containing all tuples). |
|
void |
print()
|
|
void |
print(java.io.PrintStream out)
|
|
void |
print(java.lang.String dirName)
|
|
void |
remove(int idx0)
|
|
void |
remove(int idx0,
int idx1)
|
|
|
remove(T0 val0)
|
|
|
remove(T0 val0,
T1 val1)
|
|
void |
save(java.lang.String dirName)
Copies the relation from memory to disk and frees it from memory. |
|
void |
setDoms(Dom[] doms)
Sets the domains of this relation. |
|
void |
setName(java.lang.String name)
Sets the name of this relation. |
|
void |
setSign(RelSign sign)
Sets the signature of this relation. |
|
void |
setSign(java.lang.String[] domNames,
java.lang.String domOrder)
Sets the signature of this relation. |
|
void |
setSign(java.lang.String domNames,
java.lang.String domOrder)
Sets the signature of this relation. |
|
int |
size()
Provides the size of the relation. |
|
void |
zero()
Sets this relation in memory to the empty relation (containing no tuples). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected RelSign sign
protected Dom[] doms
protected int numDoms
protected net.sf.javabdd.BDDFactory factory
protected int[] domIdxs
protected net.sf.javabdd.BDDDomain[] domBdds
protected net.sf.javabdd.BDD bdd
protected net.sf.javabdd.BDD iterBdd
| Constructor Detail |
|---|
public Rel()
| Method Detail |
|---|
public void setName(java.lang.String name)
name - The name of this relation.public java.lang.String getName()
public void setSign(java.lang.String domNames,
java.lang.String domOrder)
domNames - An ordered list of comma-separated
domain names of this relation.domOrder - The BDD ordering of the domain names.
public void setSign(java.lang.String[] domNames,
java.lang.String domOrder)
domNames - An ordered list of domain names of
this relation.domOrder - The BDD ordering of the domain names.public void setSign(RelSign sign)
sign - The signature of this relation.public RelSign getSign()
public Dom[] getDoms()
public void setDoms(Dom[] doms)
The signature of the relation must be set before the domains are set.
The contents of the domains need not be uptodate when this
method is called. The contents of the domains are used
only when the contents of this relation are initialized (by
calling one of methods one(), zero(), and
load(String)).
doms - The domains of this relation.protected void initialize()
public void one()
public void zero()
public void load(java.lang.String dirName)
public void close()
public void save(java.lang.String dirName)
public void print(java.lang.String dirName)
public Rel.RelView getView()
protected void checkRange(java.lang.Object val,
int domIdx)
protected void checkRange(int idx,
int domIdx)
public boolean isOpen()
public int size()
public <T0> void add(T0 val0)
public void add(int idx0)
public <T0> void remove(T0 val0)
public void remove(int idx0)
public <T0> boolean contains(T0 val0)
public boolean contains(int idx0)
public <T0> java.lang.Iterable<T0> getAry1ValTuples()
public <T0,T1> void add(T0 val0,
T1 val1)
public void add(int idx0,
int idx1)
public <T0,T1> void remove(T0 val0,
T1 val1)
public void remove(int idx0,
int idx1)
public <T0,T1> boolean contains(T0 val0,
T1 val1)
public boolean contains(int idx0,
int idx1)
public <T0,T1> Rel.PairIterable<T0,T1> getAry2ValTuples()
public Rel.IntPairIterable getAry2IntTuples()
public <T0,T1,T2> void add(T0 val0,
T1 val1,
T2 val2)
public void add(int idx0,
int idx1,
int idx2)
public <T0,T1,T2> boolean contains(T0 val0,
T1 val1,
T2 val2)
public <T0,T1,T2> Rel.TrioIterable<T0,T1,T2> getAry3ValTuples()
public Rel.IntTrioIterable getAry3IntTuples()
public <T0,T1,T2,T3> void add(T0 val0,
T1 val1,
T2 val2,
T3 val3)
public void add(int idx0,
int idx1,
int idx2,
int idx3)
public <T0,T1,T2,T3> boolean contains(T0 val0,
T1 val1,
T2 val2,
T3 val3)
public <T0,T1,T2,T3> Rel.QuadIterable<T0,T1,T2,T3> getAry4ValTuples()
public Rel.IntQuadIterable getAry4IntTuples()
public <T0,T1,T2,T3,T4> void add(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4)
public void add(int idx0,
int idx1,
int idx2,
int idx3,
int idx4)
public <T0,T1,T2,T3,T4> boolean contains(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4)
public <T0,T1,T2,T3,T4> Rel.PentIterable<T0,T1,T2,T3,T4> getAry5ValTuples()
public Rel.IntPentIterable getAry5IntTuples()
public <T0,T1,T2,T3,T4,T5> void add(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4,
T5 val5)
public void add(int idx0,
int idx1,
int idx2,
int idx3,
int idx4,
int idx5)
public <T0,T1,T2,T3,T4,T5> boolean contains(T0 val0,
T1 val1,
T2 val2,
T3 val3,
T4 val4,
T5 val5)
public <T0,T1,T2,T3,T4,T5> Rel.HextIterable<T0,T1,T2,T3,T4,T5> getAry6ValTuples()
public Rel.IntHextIterable getAry6IntTuples()
public void add(java.lang.Object[] vals)
public void add(int[] idxs)
public boolean contains(java.lang.Object[] vals)
public Rel.AryNIterable getAryNValTuples()
public Rel.IntAryNIterable getAryNIntTuples()
public void print()
public void print(java.io.PrintStream out)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||