org.umber.bellows.query
Class IndexFilter

java.lang.Object
  extended byorg.umber.bellows.query.QueryProcessor
      extended byorg.umber.bellows.query.IndexFilter
All Implemented Interfaces:
INodeProcessor

public class IndexFilter
extends QueryProcessor

A query filter to extract Datum objects from a List based on an array index. Returns one result if a child Datum exists at that index, or empty results if the index is out of bounds.

Author:
jsheets
See Also:
DatumQuery

Constructor Summary
IndexFilter(int index)
          Creates a new instance of IndexFilter.
IndexFilter(int index, int count)
          Creates a new instance of IndexFilter with given index.
 
Method Summary
 boolean shouldProcess(java.lang.Object node)
          Determines if the given object should be processed during the traversal.
 void start(java.util.List nodes)
          Starts a new traversal.
 
Methods inherited from class org.umber.bellows.query.QueryProcessor
end, processNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexFilter

public IndexFilter(int index,
                   int count)
Creates a new instance of IndexFilter with given index.

Parameters:
index - index of node to select
count - the number of nodes in the selection to filter

IndexFilter

public IndexFilter(int index)
Creates a new instance of IndexFilter.

Parameters:
index - index of node to select
Method Detail

start

public void start(java.util.List nodes)
Starts a new traversal. This method initializes the processor for a new traversal over a set of nodes. The nodes are not actually traversed or processed at this point, but the processor is allowed to perform any pre-traversal calculations, for example storing the total number of nodes for index calculations.

Specified by:
start in interface INodeProcessor
Overrides:
start in class QueryProcessor
Parameters:
nodes - the list of nodes that will later be traversed

shouldProcess

public boolean shouldProcess(java.lang.Object node)
Determines if the given object should be processed during the traversal.

Specified by:
shouldProcess in class QueryProcessor
Parameters:
node - the object to test
Returns:
true if the object should be processed