|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.mutator.MutationGroup
public class MutationGroup
A group of related mutations that can be applied together.
A mutation group also has an associated ID. When selecting mutations by ID, mutations in a mutation group can only be selected if the ID of the mutation group is also selected. However, selecting a mutation group does not automatically cause all member mutations to be selected (mutations in the group can be selectively applied).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface sofya.mutator.Mutation |
---|
Mutation.Variant |
Constructor Summary | |
---|---|
MutationGroup(java.lang.String className)
Creates a new mutation group for mutations that apply to a given class. |
|
MutationGroup(java.lang.String className,
java.lang.String methodName,
java.lang.String signature)
Creates a new mutation group for mutations that apply to a given method in a class. |
Method Summary | |
---|---|
void |
accept(MutationVisitor visitor)
Accepts a mutation visitor to perform some operation using this mutation. |
void |
addMutation(GroupableMutation mutation)
Adds a mutation to this mutation group. |
void |
apply(org.apache.bcel.generic.ClassGen cg,
Mutation.Variant variant)
The mutations contained in this group can be selected and applied individually, therefore this method does nothing. |
static MutationGroup |
deserialize(java.io.DataInput in)
|
java.lang.String |
getClassName()
Gets the class name to which the contained mutants apply. |
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 |
getMethodName()
Gets the method name to which the contained mutants apply. |
java.lang.String |
getSignature()
Gets the signature of the method to which the contained mutants apply. |
java.lang.String |
getType()
Gets the type string associated with a mutation group. |
Mutation.Variant[] |
getVariants()
Gets all of the possible variants of this mutation. |
java.util.Iterator |
iterator()
Returns an iterator over the mutations in this group. |
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 id)
Sets the ID associated with this mutation. |
int |
size()
Gets the number of mutations in this group. |
java.lang.String |
toString()
|
void |
undo(org.apache.bcel.generic.ClassGen cg)
The mutations contained in this group can be selected and applied individually, therefore this method does nothing. |
void |
visitMembers(boolean b)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MutationGroup(java.lang.String className)
className
- Name of the class to which the contained mutants will
apply.public MutationGroup(java.lang.String className, java.lang.String methodName, java.lang.String signature)
className
- Name of the class to which the contained mutants will
apply.methodName
- Name of the method to which the contained mutants
will apply.signature
- Signature of the method to which the contained mutants
will apply.Method Detail |
---|
public void addMutation(GroupableMutation mutation)
mutation
- Mutation to be added to this group.public java.lang.String getClassName()
public java.lang.String getMethodName()
public java.lang.String getSignature()
public int size()
public java.util.Iterator iterator()
public java.lang.String getType()
getType
in interface Mutation
public MutationID getID()
Mutation
Mutation IDs are automatically assigned and managed by the framework.
getID
in interface Mutation
public void setID(MutationID id)
Mutation
This method is called automatically by the framework, and should not be called anywhere else.
setID
in interface Mutation
id
- ID to be assigned to this mutation.public void visitMembers(boolean b)
public void accept(MutationVisitor visitor) throws MutationException
Mutation
accept
in interface Mutation
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).public Mutation.Variant getDefaultVariant()
Mutation
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.
getDefaultVariant
in interface Mutation
null
from this method.public Mutation.Variant[] getVariants()
Mutation
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.
getVariants
in interface Mutation
public void apply(org.apache.bcel.generic.ClassGen cg, Mutation.Variant variant) throws MutationException
apply
in interface Mutation
cg
- BCEL classfile object for the class being mutated.variant
- Variant of the mutation to be applied.
MutationException
- Never.public void undo(org.apache.bcel.generic.ClassGen cg)
undo
in interface Mutation
cg
- BCEL classfile object for the class being mutated.public void serialize(java.io.DataOutput out) throws java.io.IOException
Mutation
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.
serialize
in interface Mutation
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.public static MutationGroup deserialize(java.io.DataInput in) throws java.io.IOException
java.io.IOException
public java.lang.String print()
Mutation
print
in interface Mutation
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |