ostore.dispatch
Class TrieNode

java.lang.Object
  |
  +--ostore.dispatch.TrieNode
Direct Known Subclasses:
TrieRoot

public class TrieNode
extends Object

A node of a trie for use with a Classifier object.

A TrieNode stores the SinkIFs associated with the Filter defined by the path from the root of the trie. It also stores enough information about its children to recursively classify QueueElementIFs. Information about the requirement represented by this TrieNode is stored on the edge to this node from its parent, not internally to this data structure.

Version:
$Id: TrieNode.java,v 1.16 2002/07/22 20:54:53 srhea Exp $
Author:
Dennis Geels

Field Summary
protected  Vector fields
          Contains the set of Fields checked by this node's children.
protected  Vector priorities
          Contains the priorities for the SinkIFs.
protected  Vector rates
          Contains the pass rates for the SinkIFs.
protected  Vector sinks
          Contains all of the SinkIFs to receive events which satisfy this node's requirement.
protected  Vector value_maps
          Contains the set of value->child mappings for each Field.
 
Constructor Summary
protected TrieNode()
          Creates a new TrieNode with no sinks or children.
 
Method Summary
 void addChild(TrieNode child, Field field, Object value)
          Add a child node with a specified field-value restriction.
 void addSink(SinkIF sink, Integer priority, double acceptance_rate)
          Add a new SinkIF to receive for all QueueElementIF satisfying this node in the trie.
 Object clone()
          Performs a deeper copy than Object.clone would.
 void collectSinks(QueueElementIF event, HashMap found)
          Recursively find all TrieNodes which pass the specified event, collecting all the SinkIFs subscribed at each node.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sinks

protected Vector sinks
Contains all of the SinkIFs to receive events which satisfy this node's requirement.


priorities

protected Vector priorities
Contains the priorities for the SinkIFs. This Vector is parallel to sinks.


rates

protected Vector rates
Contains the pass rates for the SinkIFs. This Vector is parallel to sinks.


fields

protected Vector fields
Contains the set of Fields checked by this node's children.


value_maps

protected Vector value_maps
Contains the set of value->child mappings for each Field. This Vector is parallel to fields.

Constructor Detail

TrieNode

protected TrieNode()
Creates a new TrieNode with no sinks or children.

Method Detail

collectSinks

public void collectSinks(QueueElementIF event,
                         HashMap found)
Recursively find all TrieNodes which pass the specified event, collecting all the SinkIFs subscribed at each node.

Parameters:
event - The QueueElementIF to evaluate.
found - The set of SinkIFs collected. Each SinkIF maps to its priority.

addChild

public void addChild(TrieNode child,
                     Field field,
                     Object value)
Add a child node with a specified field-value restriction. Any QueueElementIF which satisfies this node's restriction should test the new child's as well.

Parameters:
child - The node to add.
field - The Field restricted by the child.
value - The value that Field should have.

addSink

public void addSink(SinkIF sink,
                    Integer priority,
                    double acceptance_rate)
Add a new SinkIF to receive for all QueueElementIF satisfying this node in the trie.

Parameters:
sink - the SinkIF.
priority - a number between 0 (lowest priority) and 10 (highest).
acceptance_rate - the fraction of qualifying events to pass on to the sink. Useful for sampling the input stream.

clone

public Object clone()
Performs a deeper copy than Object.clone would. The entire trie is cloned, and may be modified independently of the original. The Fields and SinkIFs referenced by the TrieNodes are not cloned.

Overrides:
clone in class Object
Returns:
A new TrieNode with cloned internal data structures.

toString

public String toString()
Overrides:
toString in class Object