public abstract class Tuple extends Object
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.arity: int
universe: Universe
atoms: [0..arity)->one Object
atoms[int] in universe.atoms[int]
Constructor and Description |
---|
Tuple() |
Modifier and Type | Method and Description |
---|---|
abstract int |
arity()
Returns the arity of this tuple.
|
abstract 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(Object atom)
Returns true if atom is in this tuple, otherwise returns false.
|
boolean |
equals(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.
|
String |
toString() |
abstract Universe |
universe()
Returns the universe from which the atoms in this
tuple are drawn.
|
public abstract int arity()
public abstract Object atom(int i)
IndexOutOfBoundsException
- i < 0 || i >= this.aritypublic abstract int atomIndex(int i)
IndexOutOfBoundsException
- i < 0 || i >= this.aritypublic abstract boolean contains(Object atom)
IllegalArgumentException
- atom !in this.universe.atoms[int]public boolean equals(Object o)
public int hashCode()
public abstract int index()
public abstract Tuple product(Tuple tuple)
NullPointerException
- tuple = nullIllegalArgumentException
- tuple.universe != this.universepublic String toString()
toString
in class Object
Object.toString()
public abstract Universe universe()
© Emina Torlak 2005-present