# Path: sourceutils/csvASTs/CSVRowAccessors.py
# def getCSVRowCondition(row):
#     return row[CONDITION]


from sourceutils.csvASTs.CSVRowAccessors import getCSVRowCondition
    def getNodeById(self, i):
        return self.nodes[i]
    
    def getCurrentNodeId(self):
        return len(self.nodes) - 1

    def appendToLatestNode(self, s):
        lastBasicBlock = self.nodes[-1]
        lastBasicBlock.rows.append(s)
    
    def registerSuccessors(self):
        for (src, dst, pred) in self.edges:
            self.nodes[src].successors.append((dst,pred))
      
        
class BasicBlock:
    def __init__(self, firstRow = None):
        self.rows =list()
        if firstRow:
            self.rows.append(firstRow)
        
        self.successors = []
      
        self.blockType = ''
      
      
    def getLastInstrType(self):
        return self.rows[-1][0]
    
    def getCondition(self):

# Path: sourceutils/csvASTs/CSVRowAccessors.py
# def getCSVRowCondition(row):
#     return row[CONDITION]


# Path: sourceutils/pythonCFGs/CFG.py
from sourceutils.csvASTs.CSVRowAccessors import getCSVRowCondition

    def getNodeById(self, i):
        return self.nodes[i]
    
    def getCurrentNodeId(self):
        return len(self.nodes) - 1

    def appendToLatestNode(self, s):
        lastBasicBlock = self.nodes[-1]
        lastBasicBlock.rows.append(s)
    
    def registerSuccessors(self):
        for (src, dst, pred) in self.edges:
            self.nodes[src].successors.append((dst,pred))
      
        
class BasicBlock:
    def __init__(self, firstRow = None):
        self.rows =list()
        if firstRow:
            self.rows.append(firstRow)
        
        self.successors = []
      
        self.blockType = ''
      
      
    def getLastInstrType(self):
        return self.rows[-1][0]
    
    def getCondition(self):

        return getCSVRowCondition(self.rows[0])