def setVal(self, clone1, clone2, version, FileList): self.change1.setVal(clone1, version, FileList) self.change2.setVal(clone2, version, FileList) self.change_metric = ngram.cal_metric(self.change1.Operations, self.change2.Operations) # print "change_metric = " + str(self.change_metric) if DEBUG: print "self.change1.delta : " + str(self.change1.delta) print "self.change1.Operations : " print self.change1.Operations print self.change1.opMetric print "self.change2.delta : " + str(self.change2.delta) print "self.change2.Operations : " print self.change2.Operations print self.change2.opMetric print "self.change_metric : " + str(self.change_metric) print "================================================="
def split_by_cid(txtFile): global File1 global File2 getlineno(File1) getlineno(File2) str1 = [] str2 = [] clone1 = [] clone2 = [] for k,v in File1.iteritems(): # print k for i in range(len(v)): # print v[i] value1 = str(k) + "\t" + v[i].index + "." + str(v[i].org_start) + "-" + str(v[i].org_end) str1.append(value1) clone1.append(v[i]) for k,v in File2.iteritems(): # print k for i in range(len(v)): # print v[i] value2 = v[i].index + "." + str(v[i].org_start) + "-" + str(v[i].org_end) str2.append(value2) clone2.append(v[i]) for i in range(len(str1)): if DEBUG: print " op1 = " print clone1[i].Operations print " op2 = " print clone2[i].Operations change_metric = ngram.cal_metric(clone1[i].Operations,clone2[i].Operations) change_metric1= metric.calculate_metric(clone1[i].Operations,clone2[i].Operations) # ngram.compare_clones(clone1[i],clone2[i]) # txtFile.writelines(str1[i] + "\t" + str2[i] + "\t(" + str(change_metric) + ")\n") txtFile.writelines(str1[i] + "\t" + str2[i] + "\t(" + str(change_metric) + " : " + str(change_metric1) + ")\n")