|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.instance.TupleFactory
public final class TupleFactory
A factory class that facilitates creation of tuples and tuple sets drawn from a given universe. Only one factory per universe exists.
no f: TupleFactory - this | f.universe = this.universe |
universe: Universe |
Method Summary | |
---|---|
TupleSet |
allOf(int arity)
Returns a set of all tuples of the given arity, drawn from this.universe. |
TupleSet |
area(Tuple upperLeft,
Tuple lowerRight)
Returns a tuple set that contains all tuples in the specified area of the n-dimensional space, where n is the arity of the argument tuples. |
TupleSet |
noneOf(int arity)
Returns an initially empty tuple set of the given arity, based on this.universe. |
TupleSet |
range(Tuple from,
Tuple to)
Returns a tuple set that contains all tuples between from
and to , inclusive. |
TupleSet |
setOf(java.util.Collection<Tuple> tuples)
Returns a tuple set consisting of specified tuples. |
TupleSet |
setOf(int arity,
IntSet tupleIndices)
Returns a set of the given arity that contains all tuples whose indeces are contained in the given int set. |
TupleSet |
setOf(java.lang.Object... atoms)
Returns a set of tuples of arity 1, each of which wraps one of the given objects. |
TupleSet |
setOf(Tuple first,
Tuple... rest)
Returns a tuple set consisting of specified tuples. |
Tuple |
tuple(int arity,
int index)
Returns a tuple with the specified arity whose index in an arity-dimensional space over this.universe is given by the index parameter. |
Tuple |
tuple(java.util.List<?> atoms)
Returns a tuple that contains the specified sequence of atoms, drawn from this.universe. |
Tuple |
tuple(java.lang.Object... atoms)
Returns a tuple that contains the specified sequence of atoms, drawn from this.universe. |
Universe |
universe()
Returns the universe to which this factory belongs. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Universe universe()
public Tuple tuple(java.lang.Object... atoms)
java.lang.NullPointerException
- - atoms = null
java.lang.IllegalArgumentException
- - atoms.length < 1
java.lang.IllegalArgumentException
- - some a: atoms[int] | a !in this.universe.atoms[int]public Tuple tuple(java.util.List<?> atoms)
java.lang.NullPointerException
- - atoms = null
java.lang.IllegalArgumentException
- - atoms.size < 1
java.lang.IllegalArgumentException
- - some a: atoms[int] | a !in this.universe.atoms[int]public Tuple tuple(int arity, int index)
java.lang.IllegalArgumentException
- - arity < 1 || index < 0 || index >= universe.size^aritypublic TupleSet allOf(int arity)
java.lang.IllegalArgumentException
- - arity < 1public TupleSet setOf(java.lang.Object... atoms)
java.lang.NullPointerException
- - atoms = null
java.lang.IllegalArgumentException
- - some atoms[int] - this.universe.atoms[int]public TupleSet setOf(Tuple first, Tuple... rest)
java.lang.NullPointerException
- - first = null || rest = null
java.lang.IllegalArgumentException
- - first.universe != this.universe
java.lang.IllegalArgumentException
- - some t: rest[int] | t.universe != this.universe || t.arity != first.aritypublic TupleSet setOf(java.util.Collection<Tuple> tuples)
java.lang.NullPointerException
- - tuples = null
java.lang.IllegalArgumentException
- - tuples.isEmpty()
java.lang.IllegalArgumentException
- - tuples.universe != this.universe || #tuples.arity > 1public TupleSet setOf(int arity, IntSet tupleIndices)
java.lang.NullPointerException
- - tupleIndices = null
java.lang.IllegalArgumentException
- - tupleIndices is uncloneable
java.lang.IllegalArgumentException
- - arity < 1
java.lang.IllegalArgumentException
- - tupleIndices.min() < 0 || tupleIndices.max() >= this.universe.size()^aritytupleIndices is cloneable |
public TupleSet noneOf(int arity)
java.lang.IllegalArgumentException
- - arity < 1public TupleSet range(Tuple from, Tuple to)
from
and to
, inclusive. More formally, the returned set contains
all tuples whose indeces are in the range [from.index()..to.index()].
java.lang.NullPointerException
- - from = null || to = null
java.lang.IllegalArgumentException
- - from.arity != to.arity
java.lang.IllegalArgumentException
- - from.universe != this.universe || to.universe != this.universe
java.lang.IllegalArgumentException
- - from.index > to.indexpublic TupleSet area(Tuple upperLeft, Tuple lowerRight)
java.lang.NullPointerException
- - upperLeft = null || lowerRight = null
java.lang.IllegalArgumentException
- - upperLeft.arity != lowerRight.arity
java.lang.IllegalArgumentException
- - lowerRight.universe != this.universe || upperLeft.universe != this.universe
java.lang.IllegalArgumentException
- - some i: [0..upperLeft.arity) |
this.universe.index(upperLeft.atoms[i]) >
this.universe.index(lowerRight.atoms[i])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |