prefuse.data.tuple
Class AbstractTupleSet

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

public abstract class AbstractTupleSet
extends java.lang.Object
implements TupleSet

Abstract base class for TupleSet implementations. Provides mechanisms for generating filtered tuple iterators, maintain listeners, and supporting bound client properties.

Author:
jeffrey heer

Field Summary
 
Fields inherited from interface prefuse.data.tuple.TupleSet
EMPTY_ARRAY
 
Constructor Summary
AbstractTupleSet()
           
 
Method Summary
 void addColumn(java.lang.String name, java.lang.Class type)
          Unsupported by default.
 void addColumn(java.lang.String name, java.lang.Class type, java.lang.Object defaultValue)
          Unsupported by default.
 void addColumn(java.lang.String name, Expression expr)
          Unsupported by default.
 void addColumn(java.lang.String name, java.lang.String expr)
          Unsupported by default.
 void addColumns(Schema schema)
          Add the data fields of the given Schema to the Tuples in this TupleSet.
 void addPropertyChangeListener(java.beans.PropertyChangeListener lstnr)
          Add a PropertyChangeListener to be notified of changes to the properties bounds to this TupleSet.
 void addPropertyChangeListener(java.lang.String key, java.beans.PropertyChangeListener lstnr)
          Add a PropertyChangeListener to be notified of changes to a specific property bound to this TupleSet.
 void addTupleSetListener(TupleSetListener tsl)
          Add a listener to this tuple set that will be notified when tuples are added and removed from the set.
protected  void fireTupleEvent(Table t, int start, int end, int type)
          Fire a Tuple event.
protected  void fireTupleEvent(Tuple[] added, Tuple[] removed)
          Fire a Tuple event.
protected  void fireTupleEvent(Tuple t, int type)
          Fire a Tuple event.
 java.lang.Object getClientProperty(java.lang.String key)
          Get an client property bound to this TupleSet
 boolean isAddColumnSupported()
          False by default.
 void putClientProperty(java.lang.String key, java.lang.Object value)
          Set an arbitrary client property with this TupleSet
 void removePropertyChangeListener(java.beans.PropertyChangeListener lstnr)
          Remove a PropertyChangeListener from this TupleSet.
 void removePropertyChangeListener(java.lang.String key, java.beans.PropertyChangeListener lstnr)
          Remove a PropertyChangeListener from this TupleSet for a specific bound property.
 void removeTupleSetListener(TupleSetListener tsl)
          Remove a listener from this tuple set.
 java.util.Iterator tuples(Predicate filter)
          Return an iterator over the tuples in this tuple set, filtered by the given predicate.
 java.util.Iterator tuples(Predicate filter, Sort sort)
          Return an iterator over the tuples in this tuple set, filtered by the given predicate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface prefuse.data.tuple.TupleSet
addTuple, clear, containsTuple, getTupleCount, removeTuple, setTuple, tuples
 

Constructor Detail

AbstractTupleSet

public AbstractTupleSet()
Method Detail

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
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)

tuples

public java.util.Iterator tuples(Predicate filter,
                                 Sort sort)
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
Parameters:
filter - predicate to apply to tuples in this set, only tuples for which the predicate evaluates to true are included in the iteration. If this value is null, no filtering will be performed.
sort - the sorting criteria by which to order the returned tuples
Returns:
a filtered, sorted iterator over this set's tuples
See Also:
TupleSet.tuples(prefuse.data.expression.Predicate, prefuse.data.util.Sort)

addTupleSetListener

public void addTupleSetListener(TupleSetListener tsl)
Description copied from interface: TupleSet
Add a listener to this tuple set that will be notified when tuples are added and removed from the set.

Specified by:
addTupleSetListener in interface TupleSet
Parameters:
tsl - the TupleSetListener to add
See Also:
TupleSet.addTupleSetListener(prefuse.data.event.TupleSetListener)

removeTupleSetListener

public void removeTupleSetListener(TupleSetListener tsl)
Description copied from interface: TupleSet
Remove a listener from this tuple set.

Specified by:
removeTupleSetListener in interface TupleSet
Parameters:
tsl - the TupleSetListener to remove
See Also:
TupleSet.removeTupleSetListener(prefuse.data.event.TupleSetListener)

fireTupleEvent

protected void fireTupleEvent(Table t,
                              int start,
                              int end,
                              int type)
Fire a Tuple event.

Parameters:
t - the Table on which the event has occurred
start - the first row changed
end - the last row changed
type - the type of event, one of EventConstants.INSERT or EventConstants.DELETE.

fireTupleEvent

protected void fireTupleEvent(Tuple t,
                              int type)
Fire a Tuple event.

Parameters:
t - the tuple that has been added or removed
type - the type of event, one of EventConstants.INSERT or EventConstants.DELETE.

fireTupleEvent

protected void fireTupleEvent(Tuple[] added,
                              Tuple[] removed)
Fire a Tuple event.

Parameters:
added - array of Tuples that have been added, can be null
removed - array of Tuples that have been removed, can be null

isAddColumnSupported

public boolean isAddColumnSupported()
False by default.

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

addColumns

public void addColumns(Schema schema)
Description copied from interface: TupleSet
Add the data fields of the given Schema to the Tuples in this TupleSet. If this TupleSet contains heterogeneous Tuples (i.e., those from different source tables), all backing tables involved will be updated.

Specified by:
addColumns in interface TupleSet
Parameters:
schema - the Schema of data columns to add to this TupleSet
See Also:
TupleSet.addColumns(prefuse.data.Schema)

addColumn

public void addColumn(java.lang.String name,
                      java.lang.Class type,
                      java.lang.Object defaultValue)
Unsupported by default.

Specified by:
addColumn in interface TupleSet
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)
Unsupported by default.

Specified by:
addColumn in interface TupleSet
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)
Unsupported by default.

Specified by:
addColumn in interface TupleSet
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)
Unsupported by default.

Specified by:
addColumn in interface TupleSet
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)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener lstnr)
Description copied from interface: TupleSet
Add a PropertyChangeListener to be notified of changes to the properties bounds to this TupleSet.

Specified by:
addPropertyChangeListener in interface TupleSet
Parameters:
lstnr - the PropertyChangeListener to add
See Also:
TupleSet.addPropertyChangeListener(java.beans.PropertyChangeListener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String key,
                                      java.beans.PropertyChangeListener lstnr)
Description copied from interface: TupleSet
Add a PropertyChangeListener to be notified of changes to a specific property bound to this TupleSet.

Specified by:
addPropertyChangeListener in interface TupleSet
Parameters:
key - the specific key for which to listen to properties changes
lstnr - the PropertyChangeListener to add
See Also:
TupleSet.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener lstnr)
Description copied from interface: TupleSet
Remove a PropertyChangeListener from this TupleSet.

Specified by:
removePropertyChangeListener in interface TupleSet
Parameters:
lstnr - the PropertyChangeListener to remove
See Also:
TupleSet.removePropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String key,
                                         java.beans.PropertyChangeListener lstnr)
Description copied from interface: TupleSet
Remove a PropertyChangeListener from this TupleSet for a specific bound property.

Specified by:
removePropertyChangeListener in interface TupleSet
Parameters:
key - the specific key for which to remove the listener
lstnr - the PropertyChangeListener to remove
See Also:
TupleSet.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

putClientProperty

public void putClientProperty(java.lang.String key,
                              java.lang.Object value)
Description copied from interface: TupleSet
Set an arbitrary client property with this TupleSet

Specified by:
putClientProperty in interface TupleSet
Parameters:
key - the name of the property to set
value - the value of the property to use
See Also:
TupleSet.putClientProperty(java.lang.String, java.lang.Object)

getClientProperty

public java.lang.Object getClientProperty(java.lang.String key)
Description copied from interface: TupleSet
Get an client property bound to this TupleSet

Specified by:
getClientProperty in interface TupleSet
Parameters:
key - the name of the property to retrieve
Returns:
the client property value, or null if no value was found for the given key.
See Also:
TupleSet.getClientProperty(java.lang.String)


Copyright © 2007 Regents of the University of California