Package concurrent_tree_crawler :: Module abstract_tree_accessor :: Class AbstractTreeAccessor
[hide private]
[frames] | no frames]

Class AbstractTreeAccessor

source code


An interface for the tree made of AbstractNodes.

Instance Methods [hide private]
list of strings
get_path(self, node)
A convenience method.
source code
AbstractNode
get_root(self)
Returns: root node
source code
AbstractNode
get_sentinel(self)
Returns: sentinel node
source code
 
set_error(self, node)
Set the node state as NodeState.ERROR
source code
 
set_node_type(self, node, is_leaf)
Set the leaf state of the node
source code
(AbstractNode, NodeAction) pair or None
update_and_get_child(self, node, possible_children_names)
Append new children to the node and return a child that can be entered by the crawler.
source code
Method Details [hide private]

get_path(self, node)

source code 

A convenience method. Returns tree path to the given node.

Parameters:
Returns: list of strings
subsequent node names from the tree root to the current node

get_root(self)

source code 
Returns: AbstractNode
root node

get_sentinel(self)

source code 
Returns: AbstractNode
sentinel node

set_node_type(self, node, is_leaf)

source code 

Set the leaf state of the node

Parameters:
  • is_leaf - True iff the node is a leaf

update_and_get_child(self, node, possible_children_names)

source code 

Append new children to the node and return a child that can be entered by the crawler.

Parameters:
  • node (AbstractNode) - node considered
  • possible_children_names (list of strings) - list of children names
Returns: (AbstractNode, NodeAction) pair or None
children node along with information what the crawler should do with it. None instead is returned if all children have state NodeState.CLOSED or NodeState.ERROR or the node has no children.