|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.instance.Tuple
public abstract class Tuple
Represents a sequence of atoms drawn from a given universe
.
Note that a Tuple of arity n whose atoms belong to a Universe u encodes an n-digit number in
base u.size. The decimal representation of this number is taken to be the index of the tuple
in an n-dimensional space over the Universe u.
atoms[int] in universe.atoms[int] |
arity: int |
universe: Universe |
atoms: [0..arity)->one Object |
Constructor Summary | |
---|---|
Tuple()
|
Method Summary | |
---|---|
abstract int |
arity()
Returns the arity of this tuple. |
abstract java.lang.Object |
atom(int i)
Returns the atom at the specified index |
abstract int |
atomIndex(int i)
Returns the index of the ith atom as given by this.universe. |
abstract boolean |
contains(java.lang.Object atom)
Returns true if atom is in this tuple, otherwise returns false. |
boolean |
equals(java.lang.Object o)
Returns true if o is a tuple with the same sequence of atoms as this, drawn from the same universe as this. |
int |
hashCode()
Returns a hash code based on the tuple's arity, index, and the hash code of its universe, so that the general contract of Object.hashCode is obeyed. |
abstract int |
index()
A Tuple encodes a number with this.arity digits in radix this.universe.size; a Tuple's index is the decimal representation of this number. |
abstract Tuple |
product(Tuple tuple)
Returns the cross product of this and the specified tuple. |
java.lang.String |
toString()
|
abstract Universe |
universe()
Returns the universe from which the atoms in this tuple are drawn. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tuple()
Method Detail |
---|
public abstract Universe universe()
public abstract int arity()
public abstract int index()
public abstract java.lang.Object atom(int i)
java.lang.IndexOutOfBoundsException
- - i < 0 || i >= this.aritypublic abstract int atomIndex(int i)
java.lang.IndexOutOfBoundsException
- - i < 0 || i >= this.aritypublic abstract boolean contains(java.lang.Object atom)
java.lang.IllegalArgumentException
- - atom !in this.universe.atoms[int]public abstract Tuple product(Tuple tuple)
java.lang.NullPointerException
- - tuple = null
java.lang.IllegalArgumentException
- - tuple.universe != this.universepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
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 |