-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MutationOperator is now an interface and the construction methods wer…
…e placed in the MutationOperatorCreator class.
- Loading branch information
Showing
11 changed files
with
62 additions
and
53 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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/fr/inria/stamp/mutationtest/descartes/operators/MutationOperatorCreator.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,29 @@ | ||
package fr.inria.stamp.mutationtest.descartes.operators; | ||
|
||
import fr.inria.stamp.mutationtest.descartes.operators.parsing.OperatorParser; | ||
|
||
public final class MutationOperatorCreator { | ||
|
||
private MutationOperatorCreator() {} | ||
|
||
public static MutationOperator fromID(String id) { | ||
OperatorParser parser = new OperatorParser(id); | ||
Object value = parser.parse(); | ||
if(parser.hasErrors()) | ||
throw new WrongOperatorException("Invalid operator id: " + parser.getErrors().get(0)); | ||
if(value == null) | ||
return NullMutationOperator.getInstance(); | ||
if(value.equals(Void.class)) { | ||
return VoidMutationOperator.getInstance(); | ||
} | ||
if(value.equals(EmptyArrayMutationOperator.getInstance().getID())) { | ||
return EmptyArrayMutationOperator.getInstance(); | ||
} | ||
try { | ||
return new ConstantMutationOperator(id, value); | ||
}catch (IllegalArgumentException exc) { | ||
throw new WrongOperatorException("Invalid operator id", exc); | ||
} | ||
} | ||
|
||
} |
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
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