14
14
import java .util .Map ;
15
15
16
16
import fr .inria .coming .core .entities .interfaces .IRevisionPair ;
17
+ import fr .inria .prophet4j .feature .extended .ExtendedFeatureCross ;
17
18
import org .apache .log4j .Logger ;
18
19
19
20
import com .google .gson .JsonObject ;
26
27
import fr .inria .coming .main .ComingProperties ;
27
28
import fr .inria .prophet4j .feature .Feature ;
28
29
import fr .inria .prophet4j .feature .FeatureCross ;
29
- import fr .inria .prophet4j .feature .original .OriginalFeatureCross ;
30
30
import fr .inria .prophet4j .utility .CodeDiffer ;
31
31
import fr .inria .prophet4j .utility .Option ;
32
32
import fr .inria .prophet4j .utility .Option .FeatureOption ;
@@ -98,7 +98,7 @@ public JsonObject extractFeatures(Map<String, File> filePaths) {
98
98
return null ;
99
99
}
100
100
Option option = new Option ();
101
- option .featureOption = FeatureOption .ORIGINAL ;
101
+ option .featureOption = FeatureOption .EXTENDED ;
102
102
//We set the first parameter of CodeDiffer as False to not allow the code generation at buggy location
103
103
//By default, coming extracts simple P4J features, so the cross sets to false
104
104
Boolean cross = ComingProperties .getPropertyBoolean ("cross" );
@@ -109,27 +109,26 @@ public JsonObject extractFeatures(Map<String, File> filePaths) {
109
109
//Get feature vector
110
110
JsonObject jsonfile = null ;
111
111
// csvfile = genVectorsCSV(option,target,featureMatrix);
112
- jsonfile = getSimleP4JJSON (option ,target ,featureMatrix ,true );
112
+ jsonfile = getP4JJSON (option ,target ,featureMatrix ,true );
113
113
return jsonfile ;
114
114
}
115
115
116
116
117
- public JsonObject getSimleP4JJSON (Option option , File target , List <FeatureMatrix > featureMatrix , Boolean numericalIndixator ) {
117
+ public JsonObject getP4JJSON (Option option , File target , List <FeatureMatrix > featureMatrix , Boolean numericalIndixator ) {
118
118
119
119
JsonObject jsonfile = new JsonObject ();
120
120
121
121
for (FeatureVector featureVector : featureMatrix .get (0 ).getFeatureVectors ()) {
122
122
List <FeatureCross > featureCrosses = featureVector .getNonSortedFeatureCrosses ();
123
123
124
124
for (FeatureCross featureCross : featureCrosses ) {
125
- List <Feature > simpleP4JFeatures = featureCross .getSimpleP4JFeatures ();
126
- OriginalFeatureCross ofc = (OriginalFeatureCross ) featureCross ;
125
+ List <Feature > simpleP4JFeatures = featureCross .getFeatures ();
127
126
for (Feature f : simpleP4JFeatures ) {
128
- Boolean positive = ofc .containFeature (f );
127
+ Boolean positive = featureCross .containFeature (f );
129
128
if (numericalIndixator ) {
130
- jsonfile .addProperty ("P4J_" +ofc . getCrossType ()+ "_" + f , positive ?"1" :"0" );
129
+ jsonfile .addProperty ("P4J_" +f , positive ?"1" :"0" );
131
130
}else {
132
- jsonfile .addProperty ("P4J_" +ofc . getCrossType ()+ "_" + f , positive ?"true" :"false" );
131
+ jsonfile .addProperty ("P4J_" +f , positive ?"true" :"false" );
133
132
}
134
133
}
135
134
@@ -156,7 +155,7 @@ public JsonObject genVectorsCSV(Option option, File patchedFile, List<FeatureMat
156
155
//Initial all vector as 0.
157
156
for (int idx = 0 ; idx < parameterVector .size (); idx ++) {
158
157
FeatureCross featureCross ;
159
- featureCross = new OriginalFeatureCross (idx );
158
+ featureCross = new ExtendedFeatureCross (idx );
160
159
header .add (featureCross .getFeatures ().toString ());
161
160
values .add ("0" );
162
161
}
0 commit comments