Пример #1
0
    def __addAdjacencyNodesUpTo(self, conn, prevEndTimestamp, newEndTimestamp):
        knownPatches = KnownPatches(self.langHelper)
    
        print "\tProcessing adjacency. Adding adjacency edges to the graph..."
    
        c = conn.cursor()
        c.execute(self.ADJACENCY_QUERY, [prevEndTimestamp, newEndTimestamp])
        
        for row in c:
            target, referrer = self.langHelper.fixSlashes(row['target']), int(row['referrer'])
            
            knownPatches.addFilePatch(target);
            method = knownPatches.findMethodByFqn(target);
            method.startOffset = referrer
        
        c.close()
        
        adjacentMethodLists = knownPatches.getAdajecentMethods()
        
        for methods in adjacentMethodLists:
            for i in range(1, len(methods)):
                self._addEdge(methods[i].fqn, methods[i - 1].fqn,
                              NodeType.METHOD,
                              NodeType.METHOD,
                              EdgeType.ADJACENT)
#                 print '\t\tAdded edge from '
#                 print '\t\t\t' + methods[i - 1].fqn + ' to '
#                 print '\t\t\t' + methods[i].fqn
        
        print "\tDone processing adjacency."
        self.__printGraphStats()
Пример #2
0
 def __init__(self,
              dbFilePath,
              langHelper,
              projSrc,
              variantsDb,
              stopWords=[],
              verbose=False):
     PfisGraphWithVariants.__init__(self, dbFilePath, langHelper, projSrc,
                                    stopWords, verbose)
     self.variantsDb = variantsDb
     self.knownMethodPatches = KnownPatches(langHelper, variantsDb)