Package concurrent_tree_crawler :: Module tree_accessor :: Class TreeAccessor
[hide private]
[frames] | no frames]

Class TreeAccessor

source code


An interface for the tree made of AbstractNodes. Access to sensitive methods is protected by concurrent programming objects: locks and conditions.

Instance Methods [hide private]
 
__init__(self, sentinel) source code
AbstractNode
get_sentinel(self)
Returns: sentinel node
source code
AbstractNode
get_root(self)
Returns: root 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
 
set_node_type(self, node, is_leaf)
Set the leaf state of the node
source code
 
set_error(self, node)
Set the node state as NodeState.ERROR
source code
 
__set_node_state_and_update(self, node, new_state) source code
 
__internal_update_node_state(self, node) source code
 
__log(self, message) source code

Inherited from abstract_tree_accessor.AbstractTreeAccessor: get_path

Instance Variables [hide private]
  __sentinel
The sentinel is a purely technical object.
  __root
The main business-level element of the tree
Method Details [hide private]

__init__(self, sentinel)
(Constructor)

source code 
Parameters:
  • sentinel (AbstractNode) - a technical node which will be made parent of the root node.

get_sentinel(self)

source code 
Returns: AbstractNode
sentinel node
Overrides: abstract_tree_accessor.AbstractTreeAccessor.get_sentinel
(inherited documentation)

get_root(self)

source code 
Returns: AbstractNode
root node
Overrides: abstract_tree_accessor.AbstractTreeAccessor.get_root
(inherited documentation)

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 - node considered
  • possible_children_names - 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.
Overrides: abstract_tree_accessor.AbstractTreeAccessor.update_and_get_child
(inherited documentation)

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
Overrides: abstract_tree_accessor.AbstractTreeAccessor.set_node_type
(inherited documentation)

set_error(self, node)

source code 

Set the node state as NodeState.ERROR

Overrides: abstract_tree_accessor.AbstractTreeAccessor.set_error
(inherited documentation)

__internal_update_node_state(self, node)

source code 
Parameters:

__log(self, message)

source code 
Parameters:
  • message (string)

Instance Variable Details [hide private]

__sentinel

The sentinel is a purely technical object. It shouldn't be analyzed by the navigator. It is here just to make sure that the root of the tree has a parent. This is because it is required by our algorithm that all of the nodes in the tree have a parent.