cgl.narada.matching.tagvalue
Class MatchingTreeNode

java.lang.Object
  extended by cgl.narada.matching.tagvalue.MatchingTreeNode
All Implemented Interfaces:
MatchingDebugFlags

public class MatchingTreeNode
extends Object
implements MatchingDebugFlags

This class implements the matching tree node. This node has edges originating from it, some of which could be pure destination edges and some of which could connect this tag node to some other tag node.


Field Summary
 
Fields inherited from interface cgl.narada.matching.tagvalue.MatchingDebugFlags
EdgeAttributes_Debug, EventID_Debug, Matching_Debug, MatchingTreeEdge_Debug, MatchingTreeNode_Debug, MEvent_Debug, Predicate_Debug
 
Constructor Summary
MatchingTreeNode(String tag)
          Constructor for the matching tree node.
 
Method Summary
 MatchingTreeEdge createEdgeLeadingIntoNode(String value, String tagTwo, int destination)
          This method is responsible for the creation of an edge between two tags, with the edge having a certain value.
 boolean createEdgeWithDestinations(String value, int destinations)
          Returns true if a new dge has been created, else it returns false if a new edge in not created
 MatchingTreeEdge getEdgeLeadingIntoTag(String tag, String value)
          This method retrieves the edge (of a certain value) emanating from this particular node, and leading into another tag.
 MatchingTreeEdge[] getListOfEdgesWithValue(String value)
          This method is used to handle subscriptions that end at this particular value of the edge.
 String getTag()
          This method returns the tag associated with the node.
 int matchEvent(MEvent e, int _destinationsComputedSoFar)
          This method is responsible for matching an event to the profile graph that is stored at the node.
 void matchEventForStorage(MEvent e, EventDestinations _destinationsComputedSoFar)
          This method is responsible for matching an event to the profile graph that is stored at the node.
 MatchingTreeEdge removeEdgeLeadingIntoNode(String value, String tagTwo, int destinations)
          This method is responsible for the removal of an edge leading into the node that would have a tag of tagTwo.
 boolean removeEdgeWithDestinations(String value, int destinations)
          This method returns true if the change needs to be propagated, and false otherwise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchingTreeNode

public MatchingTreeNode(String tag)
Constructor for the matching tree node. This initializes a tag node for the profile graph that is being hosted at this node. This tag node would be reused if the sequence of tag-value pairs entering this node is identical to the one responsible for the creation of this node.

Parameters:
tag - The tag for the node in the graph.
Method Detail

getTag

public String getTag()
This method returns the tag associated with the node.

Returns:
The tag associated with the node.

matchEvent

public int matchEvent(MEvent e,
                      int _destinationsComputedSoFar)
This method is responsible for matching an event to the profile graph that is stored at the node. If there are any pure destination edges originating from this node - both *, and the value contained in the tag value pair, those destinations need to be added to the destination list. The matching then proceeds recursively through the profile graph computing destinations assocaited with the ordered set of tag-value pairs.

Parameters:
e - The event that needs to be matched.
_destinationsComputedSoFar - The destinations that have been computed so far. This is needed since the method in question is a recursive method.
Returns:
The destinations computed so far.

matchEventForStorage

public void matchEventForStorage(MEvent e,
                                 EventDestinations _destinationsComputedSoFar)
This method is responsible for matching an event to the profile graph that is stored at the node. If there are any pure destination edges originating from this node - both *, and the value contained in the tag value pair, those destinations need to be added to the destination list. The matching then proceeds recursively through the profile graph computing destinations assocaited with the ordered set of tag-value pairs. The results returned are specific to facilitating the storing of the event, along with its associated destinations and predicateCount list, to stable storage.

Parameters:
e - The event that needs to be matched.
_destinationsComputedSoFar - The destinations that have been computed so far. This is needed since the method in question is a recursive method.

createEdgeLeadingIntoNode

public MatchingTreeEdge createEdgeLeadingIntoNode(String value,
                                                  String tagTwo,
                                                  int destination)
This method is responsible for the creation of an edge between two tags, with the edge having a certain value. The two tags involved in the creation of the edge are (a) The tag for this node (b) The tagTwo for the subscription in question.

Parameters:
value - The value of the tag for the node in question
tagTwo - The next tag in the tag-value pair.
destination - The destinations associated with the edge.

createEdgeWithDestinations

public boolean createEdgeWithDestinations(String value,
                                          int destinations)
Returns true if a new dge has been created, else it returns false if a new edge in not created


removeEdgeLeadingIntoNode

public MatchingTreeEdge removeEdgeLeadingIntoNode(String value,
                                                  String tagTwo,
                                                  int destinations)
This method is responsible for the removal of an edge leading into the node that would have a tag of tagTwo. The edge is removed only if the predicate count associated with all the destinations contained within the edge is reduced to zero.

Parameters:
value - The value of the tag for the node in question
tagTwo - The next tag in the tag-value pair.
destinations - The destinations associated with the edge.
Returns:
NULL If the edge is removed completely, since the predicate count is zero. Otherwise
Returns the edge created using this value.

removeEdgeWithDestinations

public boolean removeEdgeWithDestinations(String value,
                                          int destinations)
This method returns true if the change needs to be propagated, and false otherwise

Parameters:
value - The value of the destination edge from a node.
destinations - The destination that is associated with the value
Returns:
true if the change needs to be propagated

getListOfEdgesWithValue

public MatchingTreeEdge[] getListOfEdgesWithValue(String value)
This method is used to handle subscriptions that end at this particular value of the edge. We use this list of matching tree edges and update the destinations assocaited with these edges in case of an addition/deletion of the subscription predicate


getEdgeLeadingIntoTag

public MatchingTreeEdge getEdgeLeadingIntoTag(String tag,
                                              String value)
This method retrieves the edge (of a certain value) emanating from this particular node, and leading into another tag. If such an edge exists, this method returns that edge. If such a node does not exist this method should return a null value



For comments and suggestions please send e-mail to The NaradaBrokering Project