Commit aceb07d3 authored by Aurélien's avatar Aurélien
Browse files

documentation de code

parent eef99976
Loading
Loading
Loading
Loading
+79.2 KiB
Loading image diff...
+12 −1
Original line number Diff line number Diff line
@@ -118,10 +118,12 @@ class BinaryNode(Node):
    def __init__(self, left, right):
        super(Node, self).__init__()
        self.left = left
        self.left.setParent(self, 0)
        self.right = right
        # in a few funtions, we need that each node knows its parent
        self.left.setParent(self, 0)
        self.right.setParent(self, 1)
        self.parent = None
        # we need the position of the node compared with the others nodes of the tree to draw a tree
        self.x = 0
        self.y = 0
        self.height = 0
@@ -129,6 +131,15 @@ class BinaryNode(Node):
        self.offset = 0

    def setup(self, depth=0, places=None, offsets=None):
        """
        this function permeats to give the position of the node compared with the others nodes of the tree in which it
        is part by filling the fields x, y and offset of the node

        :param depth: the depth of the node in the tree
        :param places:
        :param offsets:
        :return:
        """
        if places is None:
            places = defaultdict(lambda: 0)
        if offsets is None: