|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.csail.sdg.alloy4compiler.sim.SimTupleset
public final class SimTupleset
Immutable; represents a tupleset.
Field Summary | |
---|---|
static SimTupleset |
EMPTY
The tupleset containing no tuples. |
Method Summary | |
---|---|
int |
arity()
If this tupleset is empty, then return 0, else return the arity of every tuple in this tupleset. |
SimTupleset |
beginWith(SimTuple x)
Return the set of tuples which begins with the given tuple (where we remove the "matching leading part") |
SimTupleset |
closure()
Returns the closure of this tupleset (NOTE: if this.arity!=2, we will return an empty set) |
SimTupleset |
difference(SimTuple that)
Return this minus that; (if this tupleset and that tuple does not have compatible arity, then we return this tupleset as is). |
SimTupleset |
difference(SimTupleset that)
Return this minus that; (if this tupleset and that tupleset does not have compatible arity, then we return this tupleset as is). |
SimTupleset |
domain(SimTupleset that)
Returns this<:that (NOTE: if this.arity!=1, then we return the empty set) |
boolean |
empty()
Returns true if this is empty. |
SimTupleset |
endWith(SimTuple x)
Return the set of tuples which ends with the given tuple (where we remove the "matching trailing part") |
boolean |
equals(java.lang.Object that)
Returns true if this contains the same tuples as that. |
boolean |
equals(SimTupleset that)
Returns true if this contains the same tuples as that. |
java.util.List<SimAtom> |
getAllAtoms(int column)
Returns a modifiable copy of the list of all i-th atom from all tuples in some arbitrary order (0 is first atom, 1 is second atom...) |
SimAtom |
getAtom()
Returns an arbitrary atom from an arbitrary tuple. |
SimTuple |
getTuple()
Returns an arbitrary tuple. |
boolean |
has(SimAtom that)
Returns true if this tupleset is unary and contains the given atom. |
boolean |
has(SimTuple that)
Returns true if this tupleset contains the given tuple. |
int |
hashCode()
Returns a hashcode consistent with the equals() method. |
SimTupleset |
head(int n)
Return the tupleset where each tuple is truncated to the first N atoms; if n is zero or negative, we return the emptyset; if n >= this.arity, we return this as is. |
SimTupleset |
iden()
Return the identity over this tupleset; (if this tupleset's arity is not 1, then we return an emptyset) Note: the result's tuple order is the same as this tupleset's tuple order. |
boolean |
in(SimTupleset that)
Returns true if this is a subset of that. |
SimTupleset |
intersect(SimTupleset that)
Return the intersection of this and that. |
boolean |
intersects(SimTupleset that)
Return true if the intersection of this and that is nonempty. |
java.util.Iterator<SimTuple> |
iterator()
Returns a read-only iterator over the tuples. |
SimTupleset |
join(SimTupleset that)
Return the relational join between this and that (throws ErrorType if this.arity==1 and that.arity==1) |
java.util.Iterator<SimTupleset> |
loneOf()
Return an iterator over all subset x of this where x.size<=1 |
long |
longsize()
Returns the number of tuples in this tupleset (this answer will never overflow) |
static SimTupleset |
make(java.util.Collection<SimTuple> tuples)
Make a tupleset containing a deep copy of the given list of tuples (Note: caller MUST make sure there are no duplicates, and all tuples are of same arity!) |
static SimTupleset |
make(int min,
int max)
Construct the set containing integers between min and max (inclusively). |
static SimTupleset |
make(SimTuple tuple)
Construct a tupleset containing the given tuple. |
static SimTupleset |
make(java.lang.String atom)
Make a tupleset containing the given atom. |
static SimTupleset |
makenext(int min,
int max)
Construct the set containing (min,min+1)...(max-1,max) |
java.util.Iterator<SimTupleset> |
oneOf()
Return an iterator over all subset x of this where x.size==1 |
SimTupleset |
override(SimTuple that)
Return the relational override of this and that; (if this tupleset and that tuple does not have compatible arity, then we return this tupleset as is). |
SimTupleset |
override(SimTupleset that)
Return the relational override of this and that; (if this tupleset and that tupleset does not have compatible arity, then we return this tupleset as is). |
SimTupleset |
product(SimTupleset that)
Return the cartesian product of this and that. |
SimTupleset |
range(SimTupleset that)
Returns this:>that (NOTE: if that.arity!=1, then we return the empty set) |
SimTupleset |
removeAll(SimAtom that)
Return this minus any tuple that contains the given atom. |
java.util.Iterator<SimTupleset> |
setOf()
Return an iterator over all subset x of this |
int |
size()
Returns the number of tuples in this tupleset (this answer may be truncated if it cannot fit in a 32-bit integer) |
java.util.Iterator<SimTupleset> |
someOf()
Return an iterator over all subset x of this where x.size>=1 |
int |
sum()
Sum up all the integer atoms in this tupleset; (if this tupleset's arity is not 1, then we return 0) |
SimTupleset |
tail(int n)
Return the tupleset where each tuple is truncated to the last N atoms; if n is zero or negative, we return the emptyset; if n >= this.arity, we return this as is. |
java.lang.String |
toString()
|
boolean |
totalOrder(SimTupleset elem,
SimTupleset first)
Return true if this is a total ordering over "elem", with "first" being the first element of the total order. |
SimTupleset |
transpose()
Return the transpose of this tupleset; (if this tupleset's arity is not 2, we'll return an empty set instead) |
SimTupleset |
union(SimTuple that)
Return the union of this and that; (if this tupleset and that tuple does not have compatible arity, then we return this tupleset as is). |
SimTupleset |
union(SimTupleset that)
Return the union of this and that; (if this tupleset and that tupleset does not have compatible arity, then we return this tupleset as is). |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final SimTupleset EMPTY
Method Detail |
---|
public static SimTupleset make(int min, int max)
public static SimTupleset makenext(int min, int max)
public static SimTupleset make(SimTuple tuple)
public static SimTupleset make(java.lang.String atom)
public static SimTupleset make(java.util.Collection<SimTuple> tuples)
public int arity()
public boolean empty()
public int size()
public long longsize()
public boolean has(SimTuple that)
public boolean has(SimAtom that)
public SimAtom getAtom() throws ErrorAPI
-
- ErrorAPI if this tupleset is empty
ErrorAPI
public SimTuple getTuple() throws ErrorAPI
-
- ErrorAPI if this tupleset is empty
ErrorAPI
public SimTupleset union(SimTupleset that)
public SimTupleset union(SimTuple that)
public SimTupleset head(int n)
public SimTupleset tail(int n)
public java.util.Iterator<SimTuple> iterator()
iterator
in interface java.lang.Iterable<SimTuple>
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public boolean equals(SimTupleset that)
public boolean in(SimTupleset that)
public int sum()
public SimTupleset iden()
public SimTupleset override(SimTuple that)
public SimTupleset override(SimTupleset that) throws ErrorAPI
ErrorAPI
public SimTupleset difference(SimTupleset that)
public SimTupleset difference(SimTuple that)
public SimTupleset removeAll(SimAtom that)
public SimTupleset transpose()
public SimTupleset product(SimTupleset that)
public SimTupleset join(SimTupleset that) throws ErrorType
ErrorType
public SimTupleset intersect(SimTupleset that)
public boolean intersects(SimTupleset that)
public SimTupleset domain(SimTupleset that)
public SimTupleset range(SimTupleset that)
public SimTupleset closure()
public SimTupleset beginWith(SimTuple x)
public SimTupleset endWith(SimTuple x)
public java.util.List<SimAtom> getAllAtoms(int column) throws ErrorAPI
-
- ErrorAPI if this tupleset contains at least one tuple whose length is less than or equal to i
ErrorAPI
public boolean totalOrder(SimTupleset elem, SimTupleset first) throws ErrorAPI
ErrorAPI
public java.util.Iterator<SimTupleset> loneOf()
public java.util.Iterator<SimTupleset> oneOf()
public java.util.Iterator<SimTupleset> setOf()
public java.util.Iterator<SimTupleset> someOf()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |