|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<Tuple>
kodkod.instance.TupleSet
public final class TupleSet
Represents a set of tuples
of a given arity, constructed over a given universe
.
All polymorphic methods throw a ClassCastException when passed
an element that is not a Tuple. All methods throw a NullPointerException
when passed null. The iterator of a TupleSet returns tuples in the order of their
indeces
.
tuples.arity = arity && tuples.universe = universe |
tuples: set Tuple |
universe: Universe |
arity: int |
Method Summary | |
---|---|
boolean |
add(Tuple t)
Adds the specified tuple to this tupleset. |
boolean |
addAll(java.util.Collection<? extends Tuple> c)
Adds all tuples from c to this, if not present, and returns true. |
int |
arity()
Returns this.arity |
int |
capacity()
Returns the capacity of this set -- the maximum number of tuples that it can hold, given its universe and arity. |
void |
clear()
Removes all tuples from this tupleset. |
TupleSet |
clone()
Returns a deep copy of this tuple set. |
boolean |
contains(java.lang.Object o)
Returns true if this contains the given object. |
boolean |
containsAll(java.util.Collection<?> c)
Returns true if this contains all tuples from c. |
boolean |
equals(java.lang.Object o)
Returns true if o contains the same tuples as this. |
int |
hashCode()
|
IntSet |
indexView()
Returns an unmodifiable int set view of the tuples stored in this set. |
java.util.Iterator<Tuple> |
iterator()
Returns an iterator over the tuples in this tupleset. |
TupleSet |
product(TupleSet s)
Returns a tuple set that is the cross product of this and the specified set. |
TupleSet |
project(int dimension)
Projects this TupleSet onto the given dimension. |
boolean |
remove(java.lang.Object o)
Removes the given object from this tupleset, if present, and returns true. |
boolean |
removeAll(java.util.Collection<?> c)
Removes all tuples in c from this, if present, and returns true. |
boolean |
retainAll(java.util.Collection<?> c)
Removes all tuples from this that are not in c, if any, and returns true. |
int |
size()
Returns the size of this tupleset. |
Universe |
universe()
Returns this.universe. |
TupleSet |
unmodifiableView()
Returns an unmodifiable view of the this tupleset. |
Methods inherited from class java.util.AbstractCollection |
---|
isEmpty, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
isEmpty, toArray, toArray |
Method Detail |
---|
public final int capacity()
public Universe universe()
public int arity()
public IntSet indexView()
public TupleSet unmodifiableView()
public TupleSet product(TupleSet s)
java.lang.NullPointerException
- - s = null
java.lang.IllegalArgumentException
- - s.universe != this.universepublic TupleSet project(int dimension)
java.lang.IllegalArgumentException
- - dimension < 0 || dimension >= this.aritypublic TupleSet clone()
clone
in class java.lang.Object
public java.util.Iterator<Tuple> iterator()
iterator
in interface java.lang.Iterable<Tuple>
iterator
in interface java.util.Collection<Tuple>
iterator
in interface java.util.Set<Tuple>
iterator
in class java.util.AbstractCollection<Tuple>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<Tuple>
contains
in interface java.util.Set<Tuple>
contains
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- o.arity != this.arity || o.universe != this.universepublic int size()
size
in interface java.util.Collection<Tuple>
size
in interface java.util.Set<Tuple>
size
in class java.util.AbstractCollection<Tuple>
public void clear()
clear
in interface java.util.Collection<Tuple>
clear
in interface java.util.Set<Tuple>
clear
in class java.util.AbstractCollection<Tuple>
no this.tuples' |
public boolean add(Tuple t)
add
in interface java.util.Collection<Tuple>
add
in interface java.util.Set<Tuple>
add
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- - t.universe != this.universe || t.arity != this.aritythis.tuples' = this.tuples + t |
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<Tuple>
remove
in interface java.util.Set<Tuple>
remove
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- - o.universe != this.universe || o.arity != this.aritythis.tuples' = this.tuples - o |
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<Tuple>
containsAll
in interface java.util.Set<Tuple>
containsAll
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- - some t: c.elements | t.universe != this.universe || t.arity != this.aritypublic boolean addAll(java.util.Collection<? extends Tuple> c)
addAll
in interface java.util.Collection<Tuple>
addAll
in interface java.util.Set<Tuple>
addAll
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- - some t: c.elements | t.universe != this.universe || t.arity != this.aritythis.tuples' = this.tuples + c.elements |
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<Tuple>
removeAll
in interface java.util.Set<Tuple>
removeAll
in class java.util.AbstractSet<Tuple>
java.lang.IllegalArgumentException
- - some t: c.elements | t.universe != this.universe || t.arity != this.aritythis.tuples' = this.tuples - c.elements |
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<Tuple>
retainAll
in interface java.util.Set<Tuple>
retainAll
in class java.util.AbstractCollection<Tuple>
java.lang.IllegalArgumentException
- - some t: c.elements | t.universe != this.universe || t.arity != this.aritythis.tuples' = this.tuples & c.elements |
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<Tuple>
equals
in interface java.util.Set<Tuple>
equals
in class java.util.AbstractSet<Tuple>
public int hashCode()
hashCode
in interface java.util.Collection<Tuple>
hashCode
in interface java.util.Set<Tuple>
hashCode
in class java.util.AbstractSet<Tuple>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |