public class DefUseFitnessCalculator extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
alternativeTime
Constant
alternativeTime=0l |
| Constructor and Description |
|---|
DefUseFitnessCalculator(DefUseCoverageTestFitness goal,
TestChromosome individual,
ExecutionResult result)
Constructor for DefUseFitnessCalculator.
|
| Modifier and Type | Method and Description |
|---|---|
double |
calculateDUFitness()
Calculates the DefinitionUseCoverage fitness for the given DUPair on the
given ExecutionResult
The fitness is calculated as follows:
If the goalDefinition is not passed in the result at all: This method
returns 1 + normalize(goalDefinitionFitness) where goalDefinition equals
the BranchCoverageTestFitness for the Branch that the CFGVertex of this
goals definition is control dependent on (goalDefinitionBranch)
If the goalDefinition is passed, but the goalUse is not passed at all:
This method returns the normalized BranchCoverageTestFitness for the
Branch that the CFGVertex of this goals Use is control dependent on
(goalUseBranch)
If both the goalDefinition and the goalUse were passed at least once in
the given result: 1.
|
double |
calculateFitnessForObjects() |
static Integer |
getMaxEntryLowerThan(List<Integer> list,
Integer border)
getMaxEntryLowerThan
|
static boolean |
hasEntriesForId(Map<Integer,HashMap<Integer,Integer>> objectDUMap,
int targetId)
hasEntriesForId
|
static boolean |
hasEntriesForId(Map<Integer,HashMap<Integer,Integer>> objectDUMap,
Integer objectId,
int targetId)
hasEntriesForId
|
static boolean |
hasEntryInBetween(List<Integer> list,
Integer start,
Integer end)
hasEntryInBetween
|
static boolean |
hasEntryLowerThan(List<Integer> list,
Integer border)
hasEntryLowerThan
|
static double |
normalize(double value)
normalize
|
static boolean |
traceCoversGoal(DefUseCoverageTestFitness goal,
Chromosome individual,
ExecutionTrace trace)
Only a sanity check function for testing purposes
|
public DefUseFitnessCalculator(DefUseCoverageTestFitness goal, TestChromosome individual, ExecutionResult result)
Constructor for DefUseFitnessCalculator.
goal - a
DefUseCoverageTestFitness
object.individual - a TestChromosome object.result - a ExecutionResult object.public double calculateDUFitness()
public double calculateFitnessForObjects()
public static double normalize(double value)
normalize
value - a double.public static boolean hasEntryLowerThan(List<Integer> list, Integer border)
hasEntryLowerThan
public static boolean hasEntryInBetween(List<Integer> list, Integer start, Integer end)
hasEntryInBetween
public static Integer getMaxEntryLowerThan(List<Integer> list, Integer border)
getMaxEntryLowerThan
public static boolean hasEntriesForId(Map<Integer,HashMap<Integer,Integer>> objectDUMap, int targetId)
hasEntriesForId
objectDUMap - a Map object.targetId - a int.public static boolean hasEntriesForId(Map<Integer,HashMap<Integer,Integer>> objectDUMap, Integer objectId, int targetId)
hasEntriesForId
public static boolean traceCoversGoal(DefUseCoverageTestFitness goal, Chromosome individual, ExecutionTrace trace)
goal - a
DefUseCoverageTestFitness
object.individual - a Chromosome object.trace - a ExecutionTrace object.Copyright © 2010–2017 EvoSuite. All rights reserved.