prefuse.data.tuple
Class CompositeTupleSet

java.lang.Object
  extended by prefuse.data.tuple.AbstractTupleSet
      extended by prefuse.data.tuple.CompositeTupleSet
All Implemented Interfaces:
TupleSet
Direct Known Subclasses:
Graph

public class CompositeTupleSet
extends AbstractTupleSet

TupleSet implementation for treating a collection of tuple sets as a single, composite tuple set. This composite does not take overlap between contained TupleSets into account.

The TupleSet.addTuple(Tuple) and setTuple(Tuple) methods are not supported by this class, and calling these methods will result in a UnsupportedOperationException. Instead, use the add or set methods on the desired non-composite tuple set.

Author:
jeffrey heer

Field Summary
 
Fields inherited from interface prefuse.data.tuple.TupleSet
EMPTY_ARRAY
 
Constructor Summary
  CompositeTupleSet()
          Create a new, empty CompositeTupleSet
protected CompositeTupleSet(boolean listen)
           
 
Method Summary
 void addColumn(java.lang.String name, java.lang.Class type)
          Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().
 void addColumn(java.lang.String name, java.lang.Class type, java.lang.Object defaultValue)
          Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().
 void addColumn(java.lang.String name, Expression expr)
          Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().
 void addColumn(java.lang.String name, java.lang.String expr)
          Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().
 void addSet(java.lang.String name, TupleSet set)
          Add a TupleSet to this composite.
 Tuple addTuple(Tuple t)
          Not supported.
 void clear()
          Clear this TupleSet, calling clear on all contained TupleSet instances.
 boolean containsSet(TupleSet set)
          Indicates if this composite contains the given TupleSet.
 boolean containsTuple(Tuple t)
          Indicates if a given Tuple is contained within this TupleSet.
 TupleSet getSet(java.lang.String name)
          Get the TupleSet associated with the given name.
 int getTupleCount()
          Get the number of tuples in this set.
 boolean hasSet(java.lang.String name)
          Indicates if this composite contains a TupleSet with the given name.
 boolean isAddColumnSupported()
          Returns true.
 void removeAllSets()
          Remove all contained TupleSets from this composite.
 TupleSet removeSet(java.lang.String name)
          Remove the TupleSet with the given name from this composite.
 boolean removeTuple(Tuple t)
          Removes the tuple from its source set if that source set is contained within this composite.
 java.util.Iterator setNames()
          Get an iterator over the names of all the TupleSets in this composite.
 java.util.Iterator sets()
          Get an iterator over all the TupleSets in this composite.
 Tuple setTuple(Tuple t)
          Not supported.
 java.util.Iterator tuples()
          Return an iterator over the tuples in this tuple set.
 java.util.Iterator tuples(Predicate filter)
          Return an iterator over the tuples in this tuple set, filtered by the given predicate.
 
Methods inherited from class prefuse.data.tuple.AbstractTupleSet
addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeTupleSet

public CompositeTupleSet()
Create a new, empty CompositeTupleSet


CompositeTupleSet

protected CompositeTupleSet(boolean listen)
Method Detail

addSet

public void addSet(java.lang.String name,
                   TupleSet set)
Add a TupleSet to this composite.

Parameters:
name - the name of the TupleSet to add
set - the set to add

hasSet

public boolean hasSet(java.lang.String name)
Indicates if this composite contains a TupleSet with the given name.

Parameters:
name - the name to look for
Returns:
true if a TupleSet with the given name is found, false otherwise

containsSet

public boolean containsSet(TupleSet set)
Indicates if this composite contains the given TupleSet.

Parameters:
set - the TupleSet to check for containment
Returns:
true if the TupleSet is contained in this composite, false otherwise

getSet

public TupleSet getSet(java.lang.String name)
Get the TupleSet associated with the given name.

Parameters:
name - the name of the TupleSet to get
Returns:
the associated TupleSet, or null if not found

setNames

public java.util.Iterator setNames()
Get an iterator over the names of all the TupleSets in this composite.

Returns:
the iterator over contained set names.

sets

public java.util.Iterator sets()
Get an iterator over all the TupleSets in this composite.

Returns:
the iterator contained sets.

removeSet

public TupleSet removeSet(java.lang.String name)
Remove the TupleSet with the given name from this composite.

Parameters:
name - the name of the TupleSet to remove
Returns:
the removed TupleSet, or null if not found

removeAllSets

public void removeAllSets()
Remove all contained TupleSets from this composite.


clear

public void clear()
Clear this TupleSet, calling clear on all contained TupleSet instances. All contained TupleSets remain members of this composite, but they have their data cleared.

See Also:
TupleSet.clear()

addTuple

public Tuple addTuple(Tuple t)
Not supported.

Parameters:
t - the Tuple add
Returns:
the actual Tuple instance stored in the TupleSet. This may be null to signify that the add failed, may be a new Tuple with values copied from the input tuple, or may be the input Tuple itself.
See Also:
TupleSet.addTuple(prefuse.data.Tuple)

setTuple

public Tuple setTuple(Tuple t)
Not supported.

Parameters:
t - the Tuple to set as the content of this TupleSet
Returns:
the actual Tuple instance stored in the TupleSet. This may be null to signify that the add failed, may be a new Tuple with values copied from the input tuple, or may be the input Tuple itself.
See Also:
TupleSet.setTuple(prefuse.data.Tuple)

removeTuple

public boolean removeTuple(Tuple t)
Removes the tuple from its source set if that source set is contained within this composite.

Parameters:
t - the Tuple to remove
Returns:
true if the Tuple was found and removed, false otherwise
See Also:
TupleSet.removeTuple(prefuse.data.Tuple)

containsTuple

public boolean containsTuple(Tuple t)
Description copied from interface: TupleSet
Indicates if a given Tuple is contained within this TupleSet.

Parameters:
t - the tuple to check for containment
Returns:
true if the Tuple is in this TupleSet, false otherwise
See Also:
TupleSet.containsTuple(prefuse.data.Tuple)

getTupleCount

public int getTupleCount()
Description copied from interface: TupleSet
Get the number of tuples in this set.

Returns:
the tuple count
See Also:
TupleSet.getTupleCount()

tuples

public java.util.Iterator tuples()
Description copied from interface: TupleSet
Return an iterator over the tuples in this tuple set.

Returns:
an iterator over this set's tuples
See Also:
TupleSet.tuples()

tuples

public java.util.Iterator tuples(Predicate filter)
Description copied from interface: TupleSet
Return an iterator over the tuples in this tuple set, filtered by the given predicate.

Specified by:
tuples in interface TupleSet
Overrides:
tuples in class AbstractTupleSet
Parameters:
filter - predicate to apply to tuples in this set, only tuples for which the predicate evaluates to true are included in the iteration
Returns:
a filtered iterator over this set's tuples
See Also:
TupleSet.tuples(prefuse.data.expression.Predicate)

isAddColumnSupported

public boolean isAddColumnSupported()
Returns true.

Specified by:
isAddColumnSupported in interface TupleSet
Overrides:
isAddColumnSupported in class AbstractTupleSet
Returns:
true is add column operations are supported, false otherwise
See Also:
TupleSet.isAddColumnSupported()

addColumn

public void addColumn(java.lang.String name,
                      java.lang.Class type,
                      java.lang.Object defaultValue)
Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().

Specified by:
addColumn in interface TupleSet
Overrides:
addColumn in class AbstractTupleSet
Parameters:
name - the name of the data field
type - the type of the data field
defaultValue - the defaultValue of the data field
See Also:
TupleSet.addColumn(java.lang.String, java.lang.Class, java.lang.Object)

addColumn

public void addColumn(java.lang.String name,
                      java.lang.Class type)
Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().

Specified by:
addColumn in interface TupleSet
Overrides:
addColumn in class AbstractTupleSet
Parameters:
name - the name of the data field
type - the type of the data field
See Also:
TupleSet.addColumn(java.lang.String, java.lang.Class)

addColumn

public void addColumn(java.lang.String name,
                      Expression expr)
Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().

Specified by:
addColumn in interface TupleSet
Overrides:
addColumn in class AbstractTupleSet
Parameters:
name - the name of the data field
expr - a compiled expression in the prefuse expression language. The results of applying the expression to a Tuple will become the data field value for that Tuple.
See Also:
TupleSet.addColumn(java.lang.String, prefuse.data.expression.Expression)

addColumn

public void addColumn(java.lang.String name,
                      java.lang.String expr)
Adds the value to all contained TupleSets that return a true value for TupleSet.isAddColumnSupported().

Specified by:
addColumn in interface TupleSet
Overrides:
addColumn in class AbstractTupleSet
Parameters:
name - the name of the data field
expr - an uncompiled expression in the prefuse expression language. This will be compiled to a valid expression, and the results of applying the expression to a Tuple will become the data field value for that Tuple.
See Also:
TupleSet.addColumn(java.lang.String, java.lang.String)


Copyright © 2007 Regents of the University of California