@@ -22,39 +22,42 @@ public boolean performMutation(MutationLocation location, BufferedWriter writer,
2222 ASTMutationLocation mLocation = (ASTMutationLocation ) location ;
2323 CommonTree parent = (CommonTree ) mLocation .getTree ().getParent ();
2424 List <CommonTree > hijos = (List <CommonTree >)parent .getChildren ();
25- int intentInstanceLine = -1 ;
25+ // int intentInstanceLine = -1;
2626 String intentInstanceLineVar = mLocation .getTree ().getChild (1 ).getChild (0 ).toString ();
27- int contextInstanceLine = -1 ;
28- String contextInstanceLineVar = mLocation .getTree ().getChild (1 ).getChild (1 ).toString ();
29- int classComponentLine = -1 ;
30- String classComponentLineVar = mLocation .getTree ().getChild (1 ).getChild (2 ).toString ();
31- int actualChild = mLocation .getTree ().getChildIndex ();
32- while (actualChild >0 && (intentInstanceLine == -1 || contextInstanceLine == -1 || classComponentLine == -1 )) {
33- CommonTree temp = (CommonTree ) hijos .get (actualChild );
34- List <CommonTree > hijoss = (List <CommonTree >) temp .getChildren ();
35- if (temp .getType ()==142
36- && hijoss .get (0 ).getText ().equals ("const-class" )
37- && hijoss .get (1 ).getText ().equals (classComponentLineVar )){
38- classComponentLine = temp .getLine ();
39- } else if (temp .getType ()==142
40- && hijoss .get (0 ).getText ().equals ("new-instance" )
41- && hijoss .get (1 ).getText ().equals (intentInstanceLineVar )){
42- intentInstanceLine = temp .getLine ();
43- } else if (temp .getType ()==148
44- && hijoss .get (0 ).getText ().equals ("iget-object" )
45- && hijoss .get (1 ).getText ().equals (contextInstanceLineVar )) {
46- contextInstanceLine = temp .getLine ();
47- }
48-
49- actualChild --;
50- }
27+ //
28+ // int contextInstanceLine = -1;
29+ // String contextInstanceLineVar = mLocation.getTree().getChild(1).getChild(1).toString();
30+ //
31+ // int classComponentLine = -1;
32+ //
33+ // String classComponentLineVar = mLocation.getTree().getChild(1).getChild(2).toString();
34+ // int actualChild = mLocation.getTree().getChildIndex();
35+ // while(actualChild>0 && (intentInstanceLine == -1 || contextInstanceLine == -1 || classComponentLine == -1)) {
36+ // CommonTree temp = (CommonTree) hijos.get(actualChild);
37+ // List<CommonTree> hijoss = (List<CommonTree>) temp.getChildren();
38+ // if(temp.getType()==142
39+ // && hijoss.get(0).getText().equals("const-class")
40+ // && hijoss.get(1).getText().equals(classComponentLineVar)){
41+ // classComponentLine = temp.getLine();
42+ // } else if(temp.getType()==142
43+ // && hijoss.get(0).getText().equals("new-instance")
44+ // && hijoss.get(1).getText().equals(intentInstanceLineVar)){
45+ // intentInstanceLine = temp.getLine();
46+ // } else if(temp.getType()==148
47+ // && hijoss.get(0).getText().equals("iget-object")
48+ // && hijoss.get(1).getText().equals(contextInstanceLineVar)) {
49+ // contextInstanceLine = temp.getLine();
50+ // }
51+ //
52+ // actualChild--;
53+ // }
5154
5255 List <String > newLines = new ArrayList <String >();
5356 List <String > lines = FileHelper .readLines (location .getFilePath ());
5457
5558
5659 //Add lines before the MutationLocation
57- for (int i =0 ; i < intentInstanceLine -1 ; i ++){
60+ for (int i =0 ; i < mLocation . getLine () -1 ; i ++){
5861 newLines .add (lines .get (i ));
5962 }
6063
@@ -80,16 +83,12 @@ public boolean performMutation(MutationLocation location, BufferedWriter writer,
8083
8184
8285 //Add lines after the MutationLocation
83- for (int i =location .getLine (); i < lines .size () ; i ++){
86+ for (int i =mLocation .getLine (); i < lines .size () ; i ++){
8487 newLines .add (lines .get (i ));
8588 }
8689
87- int [] mutatedlines = new int []{intentInstanceLine , contextInstanceLine , classComponentLine , mLocation .getLine ()};
88- String mutatedLines = "{ " ;
89- for (int i = 0 ; i < mutatedlines .length ; i ++) {
90- mutatedLines += mutatedlines [i ]+", " ;
91- }
92- mutatedLines = mutatedLines .substring (0 ,mutatedLines .length ()-2 )+" }" ;
90+ int [] mutatedlines = new int []{mLocation .getLine ()};
91+ String mutatedLines = "" +mLocation .getLine ();
9392 FileHelper .writeLines (location .getFilePath (), newLines );
9493 Helper .mutationSuccess (mutantIndex );
9594 Helper .writeBasicLogInfo (mutantIndex , location .getFilePath (), location .getType ().getName (), mutatedlines , writer );
0 commit comments