org.deri.iris.storage.simple
Class SimpleRelation

java.lang.Object
  extended by org.deri.iris.storage.simple.SimpleRelation
All Implemented Interfaces:
IRelation

public class SimpleRelation
extends Object
implements IRelation

A simple, in-memory, array-based relation.


Method Summary
 boolean add(ITuple tuple)
          Add a tuple to the relation.
 boolean addAll(IRelation relation)
          Add all tuples in relation 'relation' to this relation.
 boolean contains(ITuple tuple)
           
 ITuple get(int index)
          Get a tuple at a specific index.
 int size()
          Get the current number of tuples in this relation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

add

public boolean add(ITuple tuple)
Description copied from interface: IRelation
Add a tuple to the relation. The tuple MUST have the same arity as all other tuples in the relation.

Specified by:
add in interface IRelation
Parameters:
tuple - The (unique) tuple to add.
Returns:
true, if it was added, false if a tuple already exists in the relation with the same term values.

addAll

public boolean addAll(IRelation relation)
Description copied from interface: IRelation
Add all tuples in relation 'relation' to this relation. The tuples in 'relation' MUST have the same arity as all other tuples in this relation.

Specified by:
addAll in interface IRelation
Parameters:
relation - The relation containing tuples to add.
Returns:
true if any tuples were actually added.

get

public ITuple get(int index)
Description copied from interface: IRelation
Get a tuple at a specific index.

Specified by:
get in interface IRelation
Parameters:
index - The index of the tuple in the relation, 0 <= index < size().
Returns:
The tuple at the given index position.

size

public int size()
Description copied from interface: IRelation
Get the current number of tuples in this relation.

Specified by:
size in interface IRelation
Returns:
The number of tuples in the relation.

contains

public boolean contains(ITuple tuple)
Specified by:
contains in interface IRelation

toString

public String toString()
Overrides:
toString in class Object