xgdsmileboy / SimFix

Automatically fix programs by leveraging existing patches from other projects and similar code snippets from the faulty project.
GNU General Public License v2.0
201 stars 27 forks source link

Question about code snippet size (default 10) #7

Closed DehengYang closed 5 years ago

DehengYang commented 5 years ago

Sorry for interrupting you with this question.

As shown in the SimFix paper, the code snippet size is 10. (i.e., given faulty line n, the snippet ranges from n-5 to n+4 ).

image

But when I use SimFix to repair Math 57, I got such log:

Sat Apr 20 13:15:33 PDT 2019 org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer,321
0 s for the statement.

Sat Apr 20 13:15:33 PDT 2019 **org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer,196**

----------------------------------------
----------------------------------------
Pass Single Test : [=>0,0]
while(resultSet.size()<k){
double sum=0;
for(int i=0;i<pointSet.size();i++){
 final T p=pointSet.get(i);
 final Cluster<T> nearest=getNearestCluster(resultSet,p);
 final double d=p.distanceFrom(nearest.getCenter());
sum+=d*d;
dx2[i]=sum;
}
 final double r=random.nextDouble()*sum;
for(int i=0;i<dx2.length;i++){
if(dx2[i]>=r){
 final T p=pointSet.remove(i);
resultSet.add(new Cluster<T>(p));
break;
}
}
}

Time : 19/04/20 13:17
----------------------------------------

----------------------------------------

This log indicates that SimFix chose the org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer,196 as buggy line, but the whole code snippet spans from KMeansPlusPlusClusterer:175 to KMeansPlusPlusClusterer:196. This is out of my expection and also the expected snippet size.

Therefore, I would like to ask that if there are some points I missed in the process.

Any help would be much appreciated.

Regards, Dale.

xgdsmileboy commented 5 years ago

solved offline.