prefuse.data.tuple
Class TupleManager

java.lang.Object
  extended by prefuse.data.tuple.TupleManager

public class TupleManager
extends java.lang.Object

Manager class for Tuples. There is a unique Tuple for each row of a table. All data structures and Tuples are created lazily, on an as-needed basis. When a row is deleted from the table, it's corresponding Tuple (if created) is invalidated before being removed from this data structure, ensuring that any other live references to the Tuple can't be used to corrupt the table.

Author:
jeffrey heer

Nested Class Summary
 class TupleManager.TupleManagerIterator
          Iterator instance for iterating over tuples managed in a TupleManager.
 
Field Summary
protected  Graph m_graph
           
protected  Table m_table
           
protected  java.lang.Class m_tupleType
           
 
Constructor Summary
TupleManager(Table t, Graph g, java.lang.Class tupleType)
          Create a new TupleManager for the given Table.
 
Method Summary
 Tuple getTuple(int row)
          Get a Tuple corresponding to the given row index.
 java.lang.Class getTupleType()
          Get the type of Tuple instances to generate.
 void init(Table t, Graph g, java.lang.Class tupleType)
          Initialize this TupleManager for use with a given Table.
 void invalidate(int row)
          Invalidate the tuple at the given row.
 void invalidateAll()
          Invalidate all tuples managed by this TupleManager
 java.util.Iterator iterator(IntIterator rows)
          Return an iterator over the tuples in this manager.
protected  TableTuple newTuple(int row)
          Instantiate a new Tuple instance for the given row index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_graph

protected Graph m_graph

m_table

protected Table m_table

m_tupleType

protected java.lang.Class m_tupleType
Constructor Detail

TupleManager

public TupleManager(Table t,
                    Graph g,
                    java.lang.Class tupleType)
Create a new TupleManager for the given Table.

Parameters:
t - the data Table to generate Tuples for
Method Detail

init

public void init(Table t,
                 Graph g,
                 java.lang.Class tupleType)
Initialize this TupleManager for use with a given Table.

Parameters:
t - the data Table to generate Tuples for

getTupleType

public java.lang.Class getTupleType()
Get the type of Tuple instances to generate.

Returns:
the tuple type, as a Class instance

getTuple

public Tuple getTuple(int row)
Get a Tuple corresponding to the given row index.

Parameters:
row - the row index
Returns:
the Tuple corresponding to the given row

newTuple

protected TableTuple newTuple(int row)
Instantiate a new Tuple instance for the given row index.

Parameters:
row - the row index of the tuple
Returns:
the newly created Tuple

invalidate

public void invalidate(int row)
Invalidate the tuple at the given row.

Parameters:
row - the row index to invalidate

invalidateAll

public void invalidateAll()
Invalidate all tuples managed by this TupleManager


iterator

public java.util.Iterator iterator(IntIterator rows)
Return an iterator over the tuples in this manager.

Parameters:
rows - an iterator over table rows
Returns:
an iterator over the tuples indicated by the input row iterator


Copyright © 2007 Regents of the University of California