Skip to content

Commit 4815da5

Browse files
Franco CastagnaFranco Castagna
authored andcommitted
Inject IdMapper into LIPSAlgorithm
1 parent 25a6a38 commit 4815da5

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

core/src/main/kotlin/org/evomaster/core/search/algorithms/LIPSAlgorithm.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.evomaster.core.search.algorithms
22

3+
import com.google.inject.Inject
34
import org.evomaster.core.EMConfig
4-
import org.evomaster.core.search.FitnessValue
55
import org.evomaster.core.search.Individual
66
import org.evomaster.core.search.algorithms.wts.WtsEvalIndividual
77
import org.evomaster.client.java.instrumentation.shared.ObjectiveNaming
@@ -18,6 +18,9 @@ import org.evomaster.core.search.service.IdMapper
1818
*/
1919
class LIPSAlgorithm<T> : AbstractGeneticAlgorithm<T>() where T : Individual {
2020

21+
@Inject
22+
private lateinit var idMapper: IdMapper
23+
2124
private var currentTarget: Int? = null
2225
private lateinit var budget: LipsBudget
2326

@@ -120,7 +123,7 @@ class LIPSAlgorithm<T> : AbstractGeneticAlgorithm<T>() where T : Individual {
120123
val orderedIds = snapshot.keys.sortedDescending()
121124

122125
for (targetId in orderedIds) {
123-
val description = archive.getIdMapper().getDescriptiveId(targetId)
126+
val description = idMapper.getDescriptiveId(targetId)
124127
val isBranch = description.startsWith(ObjectiveNaming.BRANCH)
125128
val covered = archive.isCovered(targetId)
126129
if (isBranch) {

core/src/main/kotlin/org/evomaster/core/search/service/Archive.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,6 @@ class Archive<T> where T : Individual {
616616
return samplingCounter
617617
}
618618

619-
/**
620-
* Expose the IdMapper used by the archive (read-only access pattern).
621-
*/
622-
fun getIdMapper(): IdMapper = idMapper
623-
624619
/**
625620
* @return a list of pairs which is composed of target id (first) and corresponding tests (second)
626621
*/

0 commit comments

Comments
 (0)