Exemplo n.º 1
0
 def step_to(self, node):
     """
     steps to a node connected to the current node and marks all the components connecting the two nodes as seen
     :param node:
     :type node: Node
     :return: the list of components stepped over (connecting to the current node and the next node)
     """
     connecting_list = helper_funcs.connecting(node, self.location)
     if node not in self.directions():
         return self.location
     self.location = node
     self.components_seen.extend(connecting_list)
     self.nodes_seen.append(self.location)
     return connecting_list
Exemplo n.º 2
0
 def step_along(self, node):
     """
     steps to a node connected to the current node and marks only
     the first unseen component as read (as if stepping along that component)
     :param node:
     :type node: Node
     :return: the component stepped along (the one marked as seen)
     """
     unseen_connecting_list = self.unseen(helper_funcs.connecting(node, self.location))
     if node not in self.directions():
         raise ValueError
     self.location = node
     if not unseen_connecting_list:
         return []
     self.components_seen.append(unseen_connecting_list[0])
     self.nodes_seen.append(self.location)
     return unseen_connecting_list[0]
Exemplo n.º 3
0
 def step_to(self, node):
     for comp in helper_funcs.connecting(self.location, node):
         self.branch.add_comp(comp)
     super(BranchCreatorCursor, self).step_to(node)
     self.branch.add_node(node)
     return helper_funcs.connecting(self.last_node_seen(), node)