Exemple #1
0
    def __addNode(self, current_time, nodeStatData):
        # adding nodes
        key = nodeStatData[0] #(file_path, ligne_number, method_name)
        value = nodeStatData[1] #(count, countWithRecursive, exclusiveTime, cummulatedTime, callersData)
        node = self.__searchNode(key)
        count_data = StampedData(value[0], value[1], value[2], value[3])
        if node is None:
            node = Node(key[0], key[1], key[2], self.__program_folder, self.__program_path)
            self.__nodes.append(node)
        node.setStats(current_time, count_data)

        # adding edges
        callersData = value[4]
        for c in callersData.items():
            caller = c[0] # same structure as key: (file_path, ligne_number, method_name)
            callerStats = c[1] # same structure as value (without callersData): (count, countWithRecursive, exclusiveTime, cummulatedTime)
            count_data = StampedData(callerStats[0], callerStats[1], callerStats[2], callerStats[3])

            callerNode = self.__searchNode(caller)   
            if callerNode is None:
                callerNode = Node(caller[0], caller[1], caller[2], self.__program_folder, self.__program_path)
                self.__nodes.append(callerNode)

            edge = self.__searchEdge(callerNode.getId(), node.getId())
            if edge is None:
                edge = Edge(callerNode.getId(), node.getId())
                self.__edges.append(edge)
            edge.setStats(current_time, count_data)