prefuse.data.search
Class SearchTupleSet

java.lang.Object
  extended by prefuse.data.tuple.AbstractTupleSet
      extended by prefuse.data.tuple.DefaultTupleSet
          extended by prefuse.data.search.SearchTupleSet
All Implemented Interfaces:
EventConstants, TupleSet
Direct Known Subclasses:
KeywordSearchTupleSet, PrefixSearchTupleSet, RegexSearchTupleSet

public abstract class SearchTupleSet
extends DefaultTupleSet

Abstract base class for TupleSet implementations that support text search. These sets provide search engine functionality -- Tuple data fields can be indexed and then searched over using text queries, the results of which populate the TupleSet. A range of search techniques are provided by subclasses of this class.

NOTE: The addTuple(Tuple) and removeTuple(Tuple), methods are not supported by this implementation or its derived classes. Calling these methods will result in thrown exceptions. Instead, membership is determined by the search matches found using the search method, which searches over the terms indexed using the index(Iterator, String) and index(Tuple, String) methods.

Author:
jeffrey heer
See Also:
SearchQueryBinding

Field Summary
 
Fields inherited from class prefuse.data.tuple.DefaultTupleSet
m_tuples
 
Fields inherited from interface prefuse.data.event.EventConstants
ALL_COLUMNS, DELETE, INSERT, UPDATE
 
Fields inherited from interface prefuse.data.tuple.TupleSet
EMPTY_ARRAY
 
Constructor Summary
SearchTupleSet()
           
 
Method Summary
 Tuple addTuple(Tuple t)
          This method is not supported by this implementation.
abstract  java.lang.String getQuery()
          Returns the current search query, if any.
 void index(java.util.Iterator tuples, java.lang.String field)
          Indexes the data values for the given field name for each Tuple in the provided Iterator.
abstract  void index(Tuple t, java.lang.String field)
          Index an individual Tuple field, so that it can be searched for.
abstract  boolean isUnindexSupported()
          Indicates if this TupleSearchSet supports the unindex operation.
 boolean removeTuple(Tuple t)
          This method is not supported by this implementation.
abstract  void search(java.lang.String query)
          Searches the indexed fields of this TupleSet for matching strings, adding the Tuple instances for each search match to the TupleSet.
abstract  void unindex(Tuple t, java.lang.String field)
          Un-index an individual Tuple field, so that it can no longer be searched for.
 
Methods inherited from class prefuse.data.tuple.DefaultTupleSet
addInternal, clear, clearInternal, containsTuple, getTupleCount, removeInternal, setTuple, toArray, tuples
 
Methods inherited from class prefuse.data.tuple.AbstractTupleSet
addColumn, addColumn, addColumn, addColumn, addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, isAddColumnSupported, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchTupleSet

public SearchTupleSet()
Method Detail

getQuery

public abstract java.lang.String getQuery()
Returns the current search query, if any.

Returns:
the currently active search query

search

public abstract void search(java.lang.String query)
Searches the indexed fields of this TupleSet for matching strings, adding the Tuple instances for each search match to the TupleSet. The details of how the query is matched to indexed fields is left to subclasses.

Parameters:
query - the query string to search for. Indexed fields with matching text will be added to the TupleSet.

index

public void index(java.util.Iterator tuples,
                  java.lang.String field)
Indexes the data values for the given field name for each Tuple in the provided Iterator. These values are used to construct an internal data structure allowing fast searches over these attributes. To index multiple fields, simply call this method multiple times with the desired field names.

Parameters:
tuples - an Iterator over Tuple instances to index
field - the name of the attribute to index
Throws:
java.lang.ClassCastException - is a non-Tuple instance is encountered in the iteration.

index

public abstract void index(Tuple t,
                           java.lang.String field)
Index an individual Tuple field, so that it can be searched for.

Parameters:
t - the Tuple
field - the data field to index

unindex

public abstract void unindex(Tuple t,
                             java.lang.String field)
Un-index an individual Tuple field, so that it can no longer be searched for.

Parameters:
t - the Tuple
field - the data field to unindex
See Also:
isUnindexSupported()

isUnindexSupported

public abstract boolean isUnindexSupported()
Indicates if this TupleSearchSet supports the unindex operation.

Returns:
true if unindex is supported, false otherwise.
See Also:
unindex(Tuple, String)

addTuple

public Tuple addTuple(Tuple t)
This method is not supported by this implementation. Don't call it! Instead, use the search or clear methods.

Specified by:
addTuple in interface TupleSet
Overrides:
addTuple in class DefaultTupleSet
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)

removeTuple

public boolean removeTuple(Tuple t)
This method is not supported by this implementation. Don't call it! Instead, use the search or clear methods.

Specified by:
removeTuple in interface TupleSet
Overrides:
removeTuple in class DefaultTupleSet
Parameters:
t - the Tuple to remove
Returns:
true if the Tuple was found and removed, false otherwise
See Also:
TupleSet.removeTuple(prefuse.data.Tuple)


Copyright © 2007 Regents of the University of California