|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Mutation
A mutation implements the transformation(s) that create a "mutated" variant of a Java class.
A mutation class should also provide a static method named
deserialize
that takes a single parameter of type
DataInput
and returns a Mutation. This method is
used by the framework to provide transparent automatic support
for new mutation operators, though it cannot be enforced by
the interface due to the need for a static method.
MutationOperator
,
MutationGenerator
,
Mutator
Nested Class Summary | |
---|---|
static interface |
Mutation.Variant
A variant of a mutation representing one of a number of mutually exclusive substitutions that can be used to produce a mutant. |
Method Summary | |
---|---|
void |
accept(MutationVisitor visitor)
Accepts a mutation visitor to perform some operation using this mutation. |
void |
apply(org.apache.bcel.generic.ClassGen cg,
Mutation.Variant variant)
Applies this mutation to the class file. |
Mutation.Variant |
getDefaultVariant()
Gets the default variant selected by the mutation generator when the mutation table was generated. |
MutationID |
getID()
Gets the ID associated with this mutation. |
java.lang.String |
getType()
Gets the operator type abbreviation associated with this mutation. |
Mutation.Variant[] |
getVariants()
Gets all of the possible variants of this mutation. |
java.lang.String |
print()
Prints this mutation in a format suitable for display. |
void |
serialize(java.io.DataOutput out)
Serializes this mutation. |
void |
setID(MutationID mid)
Sets the ID associated with this mutation. |
void |
undo(org.apache.bcel.generic.ClassGen cg)
Reverses the actions performed to apply this mutation. |
Method Detail |
---|
void accept(MutationVisitor visitor) throws MutationException
visitor
- Mutation visitor that is visiting this mutation.
MutationException
- If an action performed on this mutation by the
visitor fails (this permits the exception to propagate).void apply(org.apache.bcel.generic.ClassGen cg, Mutation.Variant variant) throws MutationException
cg
- BCEL classfile object for the class being mutated.variant
- Index of the variant of the mutation to be applied.
MutationException
- If application of this mutation fails for any
reason.void undo(org.apache.bcel.generic.ClassGen cg)
Mutator
to automatically screen out illegal
mutants when mutant verification is enabled.
cg
- BCEL classfile object for the class to which this mutation
was applied.Mutation.Variant[] getVariants()
A variant is one of set of mutually exclusive mutations that can be applied at the same code location. The simplest example of this is an operator mutation, where mutliple alternate operators can be substituted to produce a mutant.
Mutation.Variant getDefaultVariant()
A default variant ensures that a mutation can be applied without requiring user intervention. The policy for selecting an initial default is determined by the generating mutation operator, and is typically random.
null
from this method.java.lang.String getType()
MutationID getID()
Mutation IDs are automatically assigned and managed by the framework.
void setID(MutationID mid)
This method is called automatically by the framework, and should not be called anywhere else.
mid
- ID to be assigned to this mutation.void serialize(java.io.DataOutput out) throws java.io.IOException
A mutation class should also provide a static method named
deserialize
that takes a single parameter of type
DataInput
and returns a Mutation. This method is
used by the framework to provide transparent automatic support
for new mutation operators, though it cannot be enforced by
the interface due to the need for a static method.
out
- Data output sink to which the mutation should be serialized.
java.io.IOException
- If serialization of this mutation fails for any
I/O related reason.java.lang.String print()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |