Sequence Chart Studio  svn HEAD revision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NodeFinder Class Reference

The class provides finding reference nodes in the neighbourhood of a node. See find_successors() and find_predecessors() for details. More...

#include <node_finder.h>

Inheritance diagram for NodeFinder:
Inheritance graph
Collaboration diagram for NodeFinder:
Collaboration graph

Public Member Functions

 NodeFinder (const std::string &color_attribute="rnf_color")
 
HMscNodePListPtr find_successors (HMscNode *node)
 Finds nearest (possibly indirect) successors of a node which satisfy the is_terminal() condition. More...
 
HMscNodePListPtr find_predecessors (HMscNode *node)
 Dual function to find_successors(). More...
 
virtual bool is_terminal (HMscNode *node)
 A predicate telling whether searching for successors should continue from the given node. It continues only if terminal(node) == false. More...
 
HMscNodePListPtr get_result (void)
 Returns the result of find_successors() or find_predecessors(). More...
 
HMscNodePListPtr get_skipped (void)
 Returns nodes skipped by find_successors() or find_predecessors(). Connection nodes are not stored. More...
 
void find_node (HMscNode *start, HMscNode *desired)
 Finds path from start to desired node. It always proceeds forward. More...
 
- Public Member Functions inherited from DFSBMscGraphTraverser
 DFSBMscGraphTraverser (const std::string &color_attribute="msc_graph_traverse_color")
 
virtual ~DFSBMscGraphTraverser ()
 
virtual void traverse (HMscPtr hmsc)
 
virtual void traverse (HMscNode *node)
 
virtual void cleanup_traversing_attributes ()
 
const MscElementPListListget_reached_elements ()
 
- Public Member Functions inherited from DFSListenersContainer
void add_node_finished_listener (NodeFinishedListenerP l)
 
void remove_node_finished_listeners ()
 
void add_white_node_found_listener (WhiteNodeFoundListenerP l)
 
void remove_white_node_found_listeners ()
 
void add_gray_node_found_listener (GrayNodeFoundListenerP l)
 
void remove_gray_node_found_listeners ()
 
void add_black_node_found_listener (BlackNodeFoundListenerP l)
 
void remove_black_node_found_listeners ()
 
void remove_all_listeners ()
 
virtual ~DFSListenersContainer ()
 

Static Public Member Functions

static HMscNodePListPtr successors (HMscNode *node, const std::string &color_attribute="rnf_color")
 Creates ReferenceNodeFinder and returns result of find_successors(). For derrived classes use the template version. More...
 
static HMscNodePListPtr predecessors (HMscNode *node, const std::string &color_attribute="rnf_color")
 Creates ReferenceNodeFinder and returns result of find_predecessors(). For derrived classes use the template version. More...
 
template<class T >
static HMscNodePListPtr successors (HMscNode *node, const std::string &color_attribute="rnf_color")
 Creates a finder of the type T and returns its result of find_successors(). More...
 
template<class T >
static HMscNodePListPtr predecessors (HMscNode *node, const std::string &color_attribute="rnf_color")
 Creates a finder of the type T and returns its result of find_predecessors(). More...
 

Protected Member Functions

bool traverse_node (HMscNode *node)
 Traverses from node to nearest StartNode,EndNodes or ReferenceNodes. More...
 
void traverse_predecessors (SuccessorNode *succ)
 Traverses predecessors of a given node. More...
 
- Protected Member Functions inherited from DFSBMscGraphTraverser
virtual void cleanup_top_attributes ()
 
virtual bool traverse_successors (PredecessorNode *predecessor)
 
virtual bool is_processed (HMscNode *node)
 
virtual bool traverse_reference_node (ReferenceNode *node)
 
void set_color (HMscNode *n, NodeColor c)
 
NodeColorget_color (HMscNode *n)
 
virtual void push_top_attributes ()
 
virtual void white_node_found (HMscNode *n)
 
virtual void gray_node_found (HMscNode *n)
 
virtual void black_node_found (HMscNode *n)
 
virtual void node_finished (HMscNode *n)
 

Protected Attributes

bool m_running_forward
 True when find_successors() is in progress, false if find_predecessors() works. More...
 
HMscNodePListPtr m_result
 Stores the result of find_successors() or find_predecessors() More...
 
HMscNodePListPtr m_skipped_nodes
 Stores nodes skipped by find_successors() or find_predecessors() More...
 
- Protected Attributes inherited from DFSBMscGraphTraverser
HMscNodePListList m_colored_nodes
 
MscElementPListList m_reached_elements
 
std::string m_color_attribute
 
- Protected Attributes inherited from DFSListenersContainer
NodeFinishedListenerPList m_node_finished_listeners
 
WhiteNodeFoundListenerPList m_white_node_found_listeners
 
GrayNodeFoundListenerPList m_gray_node_found_listeners
 
BlackNodeFoundListenerPList m_black_node_found_listeners
 
GrayNodeFoundListenerPList m_grey_node_found_listeners
 

Detailed Description

The class provides finding reference nodes in the neighbourhood of a node. See find_successors() and find_predecessors() for details.

Definition at line 89 of file node_finder.h.

Constructor & Destructor Documentation

NodeFinder::NodeFinder ( const std::string color_attribute = "rnf_color")

Definition at line 21 of file node_finder.cpp.

Member Function Documentation

void NodeFinder::find_node ( HMscNode start,
HMscNode desired 
)
HMscNodePListPtr NodeFinder::find_predecessors ( HMscNode node)
HMscNodePListPtr NodeFinder::find_successors ( HMscNode node)

Finds nearest (possibly indirect) successors of a node which satisfy the is_terminal() condition.

As a default, only ConnectionNodes are skipped. Write an inherited class and redefine is_terminal() to change the behavior. Connection nodes are never present in the resulting list.

References in nodes are not followed, neighbouring nodes are not searched in referenced MSCs.

Note that it is neccessary to call cleanup_traversing_attributes() in case you want to reuse this traverser while traversing HMsc.

Definition at line 69 of file node_finder.cpp.

References DFSListenersContainer::add_gray_node_found_listener(), DFSListenersContainer::add_white_node_found_listener(), DFSBMscGraphTraverser::cleanup_traversing_attributes(), GRAY, is_terminal(), DFSBMscGraphTraverser::m_reached_elements, m_result, m_running_forward, m_skipped_nodes, DFSBMscGraphTraverser::push_top_attributes(), DFSListenersContainer::remove_all_listeners(), MscElement::remove_attribute(), result, MscElement::set_attribute(), DFSBMscGraphTraverser::set_color(), and DFSBMscGraphTraverser::traverse_successors().

Referenced by ProcessListener::process_successor_transitions(), successors(), DFSRefNodeHMscTraverser::traverse_successors(), and DFSRefNodeFlatHMscTraverser::traverse_successors().

HMscNodePListPtr NodeFinder::get_result ( void  )
inline

Returns the result of find_successors() or find_predecessors().

Definition at line 128 of file node_finder.h.

HMscNodePListPtr NodeFinder::get_skipped ( void  )
inline

Returns nodes skipped by find_successors() or find_predecessors(). Connection nodes are not stored.

Definition at line 134 of file node_finder.h.

bool NodeFinder::is_terminal ( HMscNode node)
virtual

A predicate telling whether searching for successors should continue from the given node. It continues only if terminal(node) == false.

Reimplemented in RefNodeFinder, and NonemptyNodeFinder.

Definition at line 27 of file node_finder.cpp.

Referenced by find_predecessors(), find_successors(), and traverse_node().

HMscNodePListPtr NodeFinder::predecessors ( HMscNode node,
const std::string color_attribute = "rnf_color" 
)
static

Creates ReferenceNodeFinder and returns result of find_predecessors(). For derrived classes use the template version.

Definition at line 154 of file node_finder.cpp.

References find_predecessors().

Referenced by find_predecessors().

template<class T >
HMscNodePListPtr NodeFinder::predecessors ( HMscNode node,
const std::string color_attribute = "rnf_color" 
)
static

Creates a finder of the type T and returns its result of find_predecessors().

Definition at line 161 of file node_finder.cpp.

HMscNodePListPtr NodeFinder::successors ( HMscNode node,
const std::string color_attribute = "rnf_color" 
)
static

Creates ReferenceNodeFinder and returns result of find_successors(). For derrived classes use the template version.

Definition at line 141 of file node_finder.cpp.

References find_successors().

Referenced by IsEndingNode::check(), FindDeadlockListener::on_white_node_found(), FindNonLocalListener::on_white_node_found(), and IterationListener::on_white_node_found().

template<class T >
HMscNodePListPtr NodeFinder::successors ( HMscNode node,
const std::string color_attribute = "rnf_color" 
)
static

Creates a finder of the type T and returns its result of find_successors().

Definition at line 148 of file node_finder.cpp.

bool NodeFinder::traverse_node ( HMscNode node)
protectedvirtual
void NodeFinder::traverse_predecessors ( SuccessorNode succ)
protected

Traverses predecessors of a given node.

Definition at line 203 of file node_finder.cpp.

References SuccessorNode::get_predecessors(), DFSBMscGraphTraverser::m_reached_elements, and traverse_node().

Referenced by find_predecessors(), and traverse_node().

Member Data Documentation

HMscNodePListPtr NodeFinder::m_result
protected

Stores the result of find_successors() or find_predecessors()

Definition at line 187 of file node_finder.h.

Referenced by find_predecessors(), and find_successors().

bool NodeFinder::m_running_forward
protected

True when find_successors() is in progress, false if find_predecessors() works.

Definition at line 174 of file node_finder.h.

Referenced by find_predecessors(), find_successors(), and traverse_node().

HMscNodePListPtr NodeFinder::m_skipped_nodes
protected

Stores nodes skipped by find_successors() or find_predecessors()

Definition at line 190 of file node_finder.h.

Referenced by find_predecessors(), and find_successors().


The documentation for this class was generated from the following files:

SourceForge.net Logo
Generated on Fri Jan 15 2016 16:26:59 for Sequence Chart Studio by  doxygen