MCPcopy Create free account
hub / github.com/ActiveState/code / addLink

Method addLink

recipes/Python/577898_23_Tree/recipe-577898.py:184–195  ·  view source on GitHub ↗

Add link to another node

(self, anotherNode)

Source from the content-addressed store, hash-verified

182 return self.links.index(destNode)
183
184 def addLink(self, anotherNode):
185 """ Add link to another node """
186 if anotherNode is not None:
187 if self.links is None: self.links = [None] * 4
188 idx = self.__getlink(anotherNode.values[0])
189 if idx != -1:
190 if idx < self.refcnt and self.links[idx] is None:
191 self.links[idx] = anotherNode
192 else:
193 self.__insertLink(idx, anotherNode)
194 anotherNode.parent = self
195 return self
196
197 def contains(self, a):
198 """ Check if node contains a given value """

Callers 2

__fixNodeRemoveMethod · 0.80
__fixNodeInsertMethod · 0.80

Calls 2

__getlinkMethod · 0.95
__insertLinkMethod · 0.95

Tested by

no test coverage detected