|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.instance.Instance
public final class Instance
Represents a model (an instance) of a relational formula, which is a mapping
from relations
and integers to sets of tuples
drawn from a given universe
.
all r: tuples.TupleSet & Relation | r.arity = tuples[r].arity && tuples[r].universe = universe |
all i: tuples.TupleSet & int | ints[i].arity = 1 && ints[i].size() = 1 |
universe: Universe |
relations: set Relation |
tuples: (relations -> one TupleSet) + (int -> lone TupleSet) |
Constructor Summary | |
---|---|
Instance(Universe universe)
Constructs an empty instance over the given universe |
Method Summary | |
---|---|
void |
add(int i,
TupleSet s)
Maps the given integer to the given tuple set. |
void |
add(Relation relation,
TupleSet s)
Maps the given relation to the given tuple set. |
Instance |
clone()
Returns a deep copy of this Instance object. |
boolean |
contains(int i)
Returns true if this instance maps the given integer to a singleton tupleset; otherwise returns false. |
boolean |
contains(Relation relation)
Returns true if this instance maps the given relation to a set of tuples; otherwise returns false. |
IntSet |
ints()
Returns the integers mapped by this instance. |
SparseSequence<TupleSet> |
intTuples()
Returns a sparse sequence view of int<:this.tuples. |
java.util.Set<Relation> |
relations()
Returns the relations mapped by this instance. |
java.util.Map<Relation,TupleSet> |
relationTuples()
Returns a map view of Relation<:this.tuples. |
java.lang.String |
toString()
|
TupleSet |
tuples(int i)
Returns the set of tuples assigned to the given integer by this Instance. |
TupleSet |
tuples(Relation relation)
Returns the set of tuples assigned to the given relation by this Instance. |
Universe |
universe()
Returns the universe from which the tuples in this instance are drawn. |
Instance |
unmodifiableView()
Returns an unmodifiable view of this instance. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Instance(Universe universe)
java.lang.NullPointerException
- - universe = nullthis.universe' = universe && no this.tuples' |
Method Detail |
---|
public Universe universe()
public boolean contains(Relation relation)
public boolean contains(int i)
public java.util.Set<Relation> relations()
public IntSet ints()
public void add(Relation relation, TupleSet s)
java.lang.NullPointerException
- - relation = null || s = null
java.lang.IllegalArgumentException
- - relation.arity != s.arity
java.lang.IllegalArgumentException
- - s.universe != this.universe
java.lang.UnsupportedOperationException
- - this is an unmodifiable instancethis.tuples' = this.tuples ++ relation->s |
public void add(int i, TupleSet s)
java.lang.NullPointerException
- - s = null
java.lang.IllegalArgumentException
- - s.arity != 1 || s.size() != 1
java.lang.IllegalArgumentException
- - s.universe != this.universe
java.lang.UnsupportedOperationException
- - this is an unmodifiable instancethis.tuples' = this.tuples ++ i->s |
public TupleSet tuples(Relation relation)
public java.util.Map<Relation,TupleSet> relationTuples()
public TupleSet tuples(int i)
public SparseSequence<TupleSet> intTuples()
public Instance unmodifiableView()
public Instance clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |