-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Ahmedfir/experimental
bug fixing #2 and implementation of full conditions masking
- Loading branch information
Showing
32 changed files
with
749 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/edu/lu/uni/serval/javabusinesslocs/locations/DoConditionLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package edu.lu.uni.serval.javabusinesslocs.locations; | ||
|
||
import edu.lu.uni.serval.javabusinesslocs.locator.LocsUtils; | ||
import edu.lu.uni.serval.javabusinesslocs.output.CodePosition; | ||
import edu.lu.uni.serval.javabusinesslocs.output.Operators; | ||
import spoon.reflect.code.CtExpression; | ||
import spoon.reflect.cu.CompilationUnit; | ||
import spoon.reflect.cu.SourcePosition; | ||
import spoon.support.reflect.cu.position.SourcePositionImpl; | ||
|
||
import static edu.lu.uni.serval.javabusinesslocs.output.Operators.DoConditionLocation; | ||
|
||
public class DoConditionLocation extends BusinessLocation<CtExpression<Boolean>>{ | ||
|
||
protected DoConditionLocation(int firstMutantId, CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
super(firstMutantId, ctElement); | ||
} | ||
|
||
@Override | ||
protected CodePosition getCodePosition(CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
SourcePosition origPosition = LocsUtils.getSourcePosition(ctElement); | ||
int end = origPosition.getSourceEnd(); | ||
|
||
int start = end - (getOriginalValueOfTheNode(ctElement).length() - 1); | ||
CompilationUnit origUnit = origPosition.getCompilationUnit(); | ||
SourcePosition position = new SourcePositionImpl(origUnit,start,end,origUnit.getLineSeparatorPositions()); | ||
|
||
if (!position.isValidPosition()) return super.getCodePosition(ctElement); | ||
return new CodePosition(position.getSourceStart(), position.getSourceEnd()); | ||
} | ||
|
||
@Override | ||
protected String getOriginalValueOfTheNode(CtExpression<Boolean> ctElement) { | ||
return ctElement.toString(); | ||
} | ||
|
||
@Override | ||
protected Operators getOperatorByType(CtExpression<Boolean> ctElement) { | ||
return DoConditionLocation; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/edu/lu/uni/serval/javabusinesslocs/locations/ForConditionLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package edu.lu.uni.serval.javabusinesslocs.locations; | ||
|
||
import edu.lu.uni.serval.javabusinesslocs.locator.LocsUtils; | ||
import edu.lu.uni.serval.javabusinesslocs.output.CodePosition; | ||
import edu.lu.uni.serval.javabusinesslocs.output.Operators; | ||
import spoon.reflect.code.CtExpression; | ||
import spoon.reflect.cu.CompilationUnit; | ||
import spoon.reflect.cu.SourcePosition; | ||
import spoon.support.reflect.cu.position.SourcePositionImpl; | ||
|
||
import static edu.lu.uni.serval.javabusinesslocs.output.Operators.ForConditionLocation; | ||
|
||
public class ForConditionLocation extends BusinessLocation<CtExpression<Boolean>>{ | ||
protected ForConditionLocation(int firstMutantId, CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
super(firstMutantId, ctElement); | ||
} | ||
|
||
@Override | ||
protected CodePosition getCodePosition(CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
SourcePosition origPosition = LocsUtils.getSourcePosition(ctElement); | ||
int end = origPosition.getSourceEnd(); | ||
|
||
int start = end - (getOriginalValueOfTheNode(ctElement).length() - 1); | ||
CompilationUnit origUnit = origPosition.getCompilationUnit(); | ||
SourcePosition position = new SourcePositionImpl(origUnit,start,end,origUnit.getLineSeparatorPositions()); | ||
|
||
if (!position.isValidPosition()) return super.getCodePosition(ctElement); | ||
return new CodePosition(position.getSourceStart(), position.getSourceEnd()); | ||
} | ||
|
||
@Override | ||
protected String getOriginalValueOfTheNode(CtExpression<Boolean> ctElement) { | ||
return ctElement.toString(); | ||
} | ||
|
||
@Override | ||
protected Operators getOperatorByType(CtExpression<Boolean> ctElement) { | ||
return ForConditionLocation; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/edu/lu/uni/serval/javabusinesslocs/locations/WhileConditionLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package edu.lu.uni.serval.javabusinesslocs.locations; | ||
|
||
import edu.lu.uni.serval.javabusinesslocs.locator.LocsUtils; | ||
import edu.lu.uni.serval.javabusinesslocs.output.CodePosition; | ||
import edu.lu.uni.serval.javabusinesslocs.output.Operators; | ||
import spoon.reflect.code.CtExpression; | ||
import spoon.reflect.cu.CompilationUnit; | ||
import spoon.reflect.cu.SourcePosition; | ||
import spoon.support.reflect.cu.position.SourcePositionImpl; | ||
|
||
import static edu.lu.uni.serval.javabusinesslocs.output.Operators.WhileConditionLocation; | ||
|
||
public class WhileConditionLocation extends BusinessLocation<CtExpression<Boolean>>{ | ||
|
||
protected WhileConditionLocation(int firstMutantId, CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
super(firstMutantId, ctElement); | ||
} | ||
|
||
@Override | ||
protected CodePosition getCodePosition(CtExpression<Boolean> ctElement) throws BusinessLocation.UnhandledElementException { | ||
SourcePosition origPosition = LocsUtils.getSourcePosition(ctElement); | ||
int end = origPosition.getSourceEnd(); | ||
|
||
int start = end - (getOriginalValueOfTheNode(ctElement).length() - 1); | ||
CompilationUnit origUnit = origPosition.getCompilationUnit(); | ||
SourcePosition position = new SourcePositionImpl(origUnit,start,end,origUnit.getLineSeparatorPositions()); | ||
|
||
if (!position.isValidPosition()) return super.getCodePosition(ctElement); | ||
return new CodePosition(position.getSourceStart(), position.getSourceEnd()); | ||
} | ||
|
||
@Override | ||
protected String getOriginalValueOfTheNode(CtExpression<Boolean> ctElement) { | ||
return ctElement.toString(); | ||
} | ||
|
||
@Override | ||
protected Operators getOperatorByType(CtExpression<Boolean> ctElement) { | ||
return WhileConditionLocation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.