org.deri.iris.basics
Class Tuple

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<ITerm>
          extended by org.deri.iris.basics.Tuple
All Implemented Interfaces:
Comparable<ITuple>, Iterable<ITerm>, Collection<ITerm>, List<ITerm>, ITuple

public class Tuple
extends AbstractList<ITerm>
implements ITuple

A simple tuple implementation. This implementation is thread-safe.

$Id: Tuple.java,v 1.20 2007-11-07 16:14:44 nathaliest Exp $

Version:
$Revision: 1.20 $
Author:
Darko Anicic, DERI Innsbruck, Richard P??ttler (richard dot poettler at deri dot at)

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Method Summary
 ITuple append(Collection<? extends ITerm> t)
          Creates a new tupel with the tuples of this one and appends the tuples of the submitted list at the end.
 int compareTo(ITuple t)
           
 boolean equals(Object o)
           
 ITerm get(int i)
           
 List<IVariable> getAllVariables()
          Returns all variables from this tupple.
 Set<IVariable> getVariables()
          Returns all distinct variables from this tupple.
 boolean isGround()
          Checks whether this tuple contains only ground terms.
 int size()
           
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Method Detail

size

public int size()
Specified by:
size in interface Collection<ITerm>
Specified by:
size in interface List<ITerm>
Specified by:
size in class AbstractCollection<ITerm>

get

public ITerm get(int i)
Specified by:
get in interface List<ITerm>
Specified by:
get in class AbstractList<ITerm>

append

public ITuple append(Collection<? extends ITerm> t)
Description copied from interface: ITuple
Creates a new tupel with the tuples of this one and appends the tuples of the submitted list at the end.

Specified by:
append in interface ITuple
Parameters:
t - the tuples to add
Returns:
the newly created tuple

isGround

public boolean isGround()
Description copied from interface: ITuple
Checks whether this tuple contains only ground terms.

Specified by:
isGround in interface ITuple
Returns:
true if all terms of this tuple are grounded; false otherwise.

toString

public String toString()
Overrides:
toString in class AbstractCollection<ITerm>

compareTo

public int compareTo(ITuple t)
Specified by:
compareTo in interface Comparable<ITuple>

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<ITerm>
Specified by:
equals in interface List<ITerm>
Overrides:
equals in class AbstractList<ITerm>

getVariables

public Set<IVariable> getVariables()
Description copied from interface: ITuple
Returns all distinct variables from this tupple.

Specified by:
getVariables in interface ITuple
Returns:
All distinct variables from this tupple.

getAllVariables

public List<IVariable> getAllVariables()
Description copied from interface: ITuple
Returns all variables from this tupple.

Specified by:
getAllVariables in interface ITuple
Returns:
All variables from this tupple.