sofya.mutator
Interface GroupableMutation

All Superinterfaces:
Mutation
All Known Implementing Classes:
AOC.AOCMutation, AOP.AOPMutation, LCC.LCCMutation, ROP.ROPMutation

public interface GroupableMutation
extends Mutation

Marks a mutation as groupable, which indicates that the mutation can be applied to the bytecode of a particular method at the same time as other mutations (usually of the same type).

Implementing this interface allows suitable mutations to be applied more efficiently, typically by allowing all of the mutations to be applied in one pass over the method's instruction list, rather than repeatedly seeking to the right position, applying the mutation, and committing the changed bytecode. Mutations implementing this interface are of course permitted to take advantage of other optimizations that may be feasible as well.

Note that a mutation implementing this interface must be added to a MutationGroup or the efficiency benefit is lost.

Version:
05/09/2006
Author:
Alex Kinneer

Nested Class Summary
 
Nested classes/interfaces inherited from interface sofya.mutator.Mutation
Mutation.Variant
 
Method Summary
 void apply(org.apache.bcel.generic.ClassGen cg, org.apache.bcel.generic.MethodGen mg, org.apache.bcel.generic.InstructionList il, java.util.Map linkData, Mutation.Variant variant)
          Applies the mutation; provides access to data to enable more efficient application.
 MutationGroup getParent()
          Gets the parent mutation group of which this mutation is a member.
 void setParent(MutationGroup mg)
          Sets the parent mutation group of which this mutation is a member.
 void undo(org.apache.bcel.generic.ClassGen cg, org.apache.bcel.generic.MethodGen mg, org.apache.bcel.generic.InstructionList il, java.util.Map linkData)
          Reverses the actions performed to apply this mutation; provides access to the additional data used by this mutation for appropriate reversal of changes.
 
Methods inherited from interface sofya.mutator.Mutation
accept, apply, getDefaultVariant, getID, getType, getVariants, print, serialize, setID, undo
 

Method Detail

apply

void apply(org.apache.bcel.generic.ClassGen cg,
           org.apache.bcel.generic.MethodGen mg,
           org.apache.bcel.generic.InstructionList il,
           java.util.Map linkData,
           Mutation.Variant variant)
           throws MutationException
Applies the mutation; provides access to data to enable more efficient application.

Parameters:
cg - BCEL classfile object for the class being mutated.
mg - BCEL method object for the method being mutated.
il - BCEL instruction list for the method being mutated.
linkData - Map to permit grouped mutations to pass information to each other.
variant - Index of the variant of the mutation to be applied.
Throws:
MutationException - If application of this mutation fails for any reason.

undo

void undo(org.apache.bcel.generic.ClassGen cg,
          org.apache.bcel.generic.MethodGen mg,
          org.apache.bcel.generic.InstructionList il,
          java.util.Map linkData)
Reverses the actions performed to apply this mutation; provides access to the additional data used by this mutation for appropriate reversal of changes. This method is used by the Mutator to automatically screen out illegal mutants when mutant verification is enabled.

Parameters:
cg - BCEL classfile object for the class to which this mutation was applied.
mg - BCEL method object for the method to which this mutation was applied.
il - BCEL instruction list for the method to which this mutation was applied.
linkData - Map used to permit grouped mutations to pass information to each other.

getParent

MutationGroup getParent()
Gets the parent mutation group of which this mutation is a member.

Returns:
The mutation group containing this mutation. This may be null, in which case efficiency benefits associated with implementing the GroupableMutation interface will be lost.

setParent

void setParent(MutationGroup mg)
Sets the parent mutation group of which this mutation is a member.

This method is automatically invoked when this mutation is added to a mutation group. It should not normally be called otherwise.

Parameters:
mg - Mutation group that now contains this mutation.