@@ -196,6 +196,7 @@ public void evaluateFeatureData(Set<Method> methods) {
196196 for (FeatureSet .Type featureSet : featureSets )
197197 switch (featureSet ) {
198198 case CODE :
199+ codeFeatureHandler .evaluateCodeFeatureData (methods );
199200 break ;
200201 case DOC_MANUAL :
201202 docFeatureHandler .evaluateManualFeatureData (methods );
@@ -276,39 +277,27 @@ public ArrayList<Instance> getCodeInstances(Instances instances, Set<Method> met
276277 Instance inst = setClassValues (categories , method , instances , new DenseInstance (attributes .size ()));
277278 inst .setDataset (instances );
278279
279- for ( Category cat : categories ) {
280- if ( cat . isAuthentication () && ! method .getAuthSrm (). isEmpty ()) {
280+ //Set id attribute
281+ inst . setValue ( instances . attribute ( "id" ), method .getArffSafeSignature ());
281282
282- if (toolkit == ModelEvaluator .Toolkit .MEKA )
283- inst .setValue (instances .attribute (cat .getId ()), "1" );
284- else {
285- for (Category auth : method .getAuthSrm ()) {
286- inst .setValue (instances .attribute (cat .getId ()), getAuthClass (auth ));
287- }
288- }
289- } else if (method .getAllCategories ().contains (cat )) {
290- inst .setValue (instances .attribute (cat .getId ()), "1" );
291- } else
292- inst .setValue (instances .attribute (cat .getId ()), "0" );
293- }
283+ //TODO Add feature values
284+ //for (Class<? extends IDocFeature> feature : codeFeatureHandler.getClass()) {
294285
286+ // }
295287 for (Map .Entry <IFeature , Attribute > entry : codeAttributes .entrySet ()) {
296288
297289 switch (entry .getKey ().applies (method )) {
298290 case TRUE :
299- inst .setValue (instances .attribute (String . valueOf ( entry .getKey ())), "true" );
291+ inst .setValue (instances .attribute (entry .getKey (). toString ( )), "true" );
300292 break ;
301293 case FALSE :
302- inst .setValue (instances .attribute (String . valueOf ( entry .getKey ())), "false" );
294+ inst .setValue (instances .attribute (entry .getKey (). toString ( )), "false" );
303295 break ;
304296 default :
305- inst .setMissing (instances .attribute (String . valueOf ( entry .getKey ())));
297+ inst .setMissing (instances .attribute (entry .getKey (). toString ( )));
306298 }
307299 }
308300
309- //Set id attribute
310- inst .setValue (instances .attribute ("id" ), method .getArffSafeSignature ());
311-
312301 instanceList .add (inst );
313302 instanceMap .put (method .getArffSafeSignature (), instanceIndex ++);
314303 }
@@ -376,8 +365,12 @@ public ArrayList<Instance> getDocInstances(Instances instances, Set<Method> meth
376365 return instanceList ;
377366 }
378367
379-
380- String getAuthClass (Category category ){
368+ /**
369+ * Returns authentication class ID for a authentication category.
370+ * @param category
371+ * @return Class ID
372+ */
373+ String getAuthClass (Category category ) {
381374
382375 switch (category ) {
383376 case AUTHENTICATION_TO_LOW :
@@ -386,15 +379,17 @@ String getAuthClass(Category category){
386379 return "2" ;
387380 case AUTHENTICATION_TO_HIGH :
388381 default :
389- return "3" ;
382+ return "3" ;
390383 }
391384 }
392385
393386 Instance setClassValues (Set <Category > categories , Method method , Instances instances , Instance inst ) {
394387
395388 for (Category cat : categories ) {
396389
397- if (cat .isAuthentication () && !method .getAuthSrm ().isEmpty () && toolkit == ModelEvaluator .Toolkit .WEKA ) {
390+ if (instances .relationName ().endsWith ("test" )) {
391+ inst .setMissing (instances .attribute (cat .getId ()));
392+ } else if (cat .isAuthentication () && !method .getAuthSrm ().isEmpty () && toolkit == ModelEvaluator .Toolkit .WEKA ) {
398393
399394 for (Category auth : method .getAuthSrm ()) {
400395 inst .setValue (instances .attribute (cat .getId ()), getAuthClass (auth ));
@@ -455,4 +450,8 @@ public DocFeatureHandler getDocFeatureHandler() {
455450 public void setDocFeatureHandler (DocFeatureHandler docFeatureHandler ) {
456451 this .docFeatureHandler = docFeatureHandler ;
457452 }
453+
454+ public Dataset getDataset () {
455+ return dataset ;
456+ }
458457}
0 commit comments