sofya.mutator.selectors
Class IDMutationSelector

java.lang.Object
  extended by sofya.mutator.selectors.IDMutationSelector
All Implemented Interfaces:
MutationSelector

public class IDMutationSelector
extends java.lang.Object
implements MutationSelector

Mutation selector that selects by ID.

Version:
05/23/2006
Author:
Alex Kinneer

Nested Class Summary
static class IDMutationSelector.ID
          Utility class to correlate mutants with selected variants.
 
Constructor Summary
IDMutationSelector(IDMutationSelector.ID[] ids)
          Creates a new mutation selector.
IDMutationSelector(gnu.trove.TIntIntHashMap ids)
          Creates a new mutation selector.
 
Method Summary
 Mutation.Variant getVariant(Mutation mutation)
          Gets the selected variant.
 boolean isSelected(Mutation mutation)
          Reports whether a mutation is selected.
 void setMutationCount(int count)
          Sets the total number of mutations that may be passed to this selector (typically the number of mutations in a mutation table).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDMutationSelector

public IDMutationSelector(IDMutationSelector.ID[] ids)
Creates a new mutation selector.

Parameters:
ids - Array of selected IDs.

IDMutationSelector

public IDMutationSelector(gnu.trove.TIntIntHashMap ids)
Creates a new mutation selector.

Parameters:
ids - Set of selected IDs, where each selected mutant is mapped to a selected variant, if applicable.
Method Detail

isSelected

public boolean isSelected(Mutation mutation)
Description copied from interface: MutationSelector
Reports whether a mutation is selected.

Specified by:
isSelected in interface MutationSelector
Parameters:
mutation - Mutation to be checked for selection.
Returns:
true if this selector implements a selection criteria that the given mutation meets, false otherwise.

getVariant

public Mutation.Variant getVariant(Mutation mutation)
Description copied from interface: MutationSelector
Gets the selected variant.

Some mutation operators, such as the arithmetic operator change (AOP), generate multiple variants at a single location.

Specified by:
getVariant in interface MutationSelector
Parameters:
mutation - Mutation for which to retrieve the selected variant.
Returns:
The selected mutation variant.

setMutationCount

public void setMutationCount(int count)
Description copied from interface: MutationSelector
Sets the total number of mutations that may be passed to this selector (typically the number of mutations in a mutation table).

This is useful for some selectors, such as those that implement random selection criteria.

Specified by:
setMutationCount in interface MutationSelector
Parameters:
count - Total number of mutations from which this selector may select.