diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/CodeTraceabilityStateImpl.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/CodeTraceabilityStateImpl.java index d1bb698..a380144 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/CodeTraceabilityStateImpl.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/CodeTraceabilityStateImpl.java @@ -10,48 +10,50 @@ import org.eclipse.collections.impl.factory.Sets; import edu.kit.kastel.mcse.ardoco.core.api.codetraceability.CodeTraceabilityState; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadCodeTraceLink; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SamCodeTraceLink; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.ArchitectureEntity; +import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.TraceLink; +import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; import edu.kit.kastel.mcse.ardoco.core.data.AbstractState; @Deterministic public class CodeTraceabilityStateImpl extends AbstractState implements CodeTraceabilityState { - private MutableList samCodeTraceLinks = Lists.mutable.empty(); - private MutableList transitiveTraceLinks = Lists.mutable.empty(); + private MutableList> samCodeTraceLinks = Lists.mutable.empty(); + private MutableList> transitiveTraceLinks = Lists.mutable.empty(); public CodeTraceabilityStateImpl() { super(); } @Override - public boolean addSamCodeTraceLink(SamCodeTraceLink traceLink) { + public boolean addSamCodeTraceLink(TraceLink traceLink) { return this.samCodeTraceLinks.add(traceLink); } @Override - public boolean addSamCodeTraceLinks(Collection traceLinks) { + public boolean addSamCodeTraceLinks(Collection> traceLinks) { return this.samCodeTraceLinks.addAll(traceLinks); } @Override - public ImmutableSet getSamCodeTraceLinks() { + public ImmutableSet> getSamCodeTraceLinks() { return Sets.immutable.withAll(new LinkedHashSet<>(this.samCodeTraceLinks)); } @Override - public boolean addSadCodeTraceLink(SadCodeTraceLink traceLink) { + public boolean addSadCodeTraceLink(TraceLink traceLink) { return this.transitiveTraceLinks.add(traceLink); } @Override - public boolean addSadCodeTraceLinks(Collection traceLinks) { + public boolean addSadCodeTraceLinks(Collection> traceLinks) { return this.transitiveTraceLinks.addAll(traceLinks); } @Override - public ImmutableSet getSadCodeTraceLinks() { + public ImmutableSet> getSadCodeTraceLinks() { return this.transitiveTraceLinks.toImmutableSet(); } diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArCoTLInformant.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArCoTLInformant.java index 6ed9946..962394f 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArCoTLInformant.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArCoTLInformant.java @@ -6,13 +6,14 @@ import edu.kit.kastel.mcse.ardoco.core.api.models.ArchitectureModelType; import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; -import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.TraceLinkGenerator; -import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.Node; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; import edu.kit.kastel.mcse.ardoco.core.data.DataRepository; import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Informant; +import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.TraceLinkGenerator; +import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.Node; public class ArCoTLInformant extends Informant { public ArCoTLInformant(DataRepository dataRepository) { @@ -21,16 +22,16 @@ public ArCoTLInformant(DataRepository dataRepository) { @Override public void process() { - var dataRepository = getDataRepository(); + var dataRepository = this.getDataRepository(); var modelStates = DataRepositoryHelper.getModelStatesData(dataRepository); var samCodeTraceabilityState = DataRepositoryHelper.getCodeTraceabilityState(dataRepository); ArchitectureModel architectureModel = null; CodeModel codeModel = null; for (var modelId : modelStates.modelIds()) { - if (isAnArchitectureModel(modelId)) { + if (ArCoTLInformant.isAnArchitectureModel(modelId)) { architectureModel = (ArchitectureModel) modelStates.getModel(modelId); - } else if (isACodeModel(modelId)) { + } else if (ArCoTLInformant.isACodeModel(modelId)) { codeModel = (CodeModel) modelStates.getModel(modelId); } } @@ -40,12 +41,12 @@ public void process() { samCodeTraceabilityState.addSamCodeTraceLinks(traceLinks); } - private static boolean isACodeModel(String modelId) { - return Arrays.stream(CodeModelType.values()).anyMatch(codeModelType -> codeModelType.getModelId().equals(modelId)); + private static boolean isACodeModel(Metamodel modelId) { + return Arrays.stream(CodeModelType.values()).anyMatch(codeModelType -> codeModelType.getMetamodel().equals(modelId)); } - private static boolean isAnArchitectureModel(String modelId) { - return Arrays.stream(ArchitectureModelType.values()).anyMatch(architectureModelType -> architectureModelType.getModelId().equals(modelId)); + private static boolean isAnArchitectureModel(Metamodel modelId) { + return Arrays.stream(ArchitectureModelType.values()).anyMatch(architectureModelType -> architectureModelType.getMetamodel().equals(modelId)); } @Override diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArchitectureLinkToCodeLinkTransformerInformant.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArchitectureLinkToCodeLinkTransformerInformant.java index 51306d8..23936f9 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArchitectureLinkToCodeLinkTransformerInformant.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/ArchitectureLinkToCodeLinkTransformerInformant.java @@ -14,13 +14,12 @@ import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadCodeTraceLink; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; -import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.CodeTraceabilityStateImpl; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; import edu.kit.kastel.mcse.ardoco.core.data.DataRepository; import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Informant; +import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.CodeTraceabilityStateImpl; @Deterministic public class ArchitectureLinkToCodeLinkTransformerInformant extends Informant { @@ -33,33 +32,33 @@ public ArchitectureLinkToCodeLinkTransformerInformant(DataRepository dataReposit public void process() { MutableSet sadCodeTracelinks = Sets.mutable.empty(); - ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(getDataRepository()); - ConnectionStates connectionStates = DataRepositoryHelper.getConnectionStates(getDataRepository()); + ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(this.getDataRepository()); + ConnectionStates connectionStates = DataRepositoryHelper.getConnectionStates(this.getDataRepository()); if (modelStatesData == null || connectionStates == null) { return; } - CodeModel codeModel = findCodeModel(modelStatesData); + CodeModel codeModel = this.findCodeModel(modelStatesData); for (var traceLink : connectionStates.getConnectionState(Metamodel.CODE).getTraceLinks()) { - var modelElement = traceLink.getModelElementUid(); - var mentionedCodeModelElements = findMentionedCodeModelElementsById(modelElement, codeModel); + var modelElement = traceLink.getSecondEndpoint().getId(); + var mentionedCodeModelElements = this.findMentionedCodeModelElementsById(modelElement, codeModel); for (var mid : mentionedCodeModelElements) { - sadCodeTracelinks.add(new SadCodeTraceLink(new EndpointTuple(traceLink.getEndpointTuple().firstEndpoint(), mid))); + sadCodeTracelinks.add(new SadCodeTraceLink(traceLink.getFirstEndpoint(), mid)); } } CodeTraceabilityState codeTraceabilityState = new CodeTraceabilityStateImpl(); - getDataRepository().addData(CodeTraceabilityState.ID, codeTraceabilityState); + this.getDataRepository().addData(CodeTraceabilityState.ID, codeTraceabilityState); codeTraceabilityState.addSadCodeTraceLinks(sadCodeTracelinks); } private List findMentionedCodeModelElementsById(String modelElementId, CodeModel codeModel) { boolean isPackage = modelElementId.endsWith("/"); if (isPackage) { - return findAllClassesInPackage(modelElementId, codeModel); + return this.findAllClassesInPackage(modelElementId, codeModel); } - return findCompilationUnitById(modelElementId, codeModel); + return this.findCompilationUnitById(modelElementId, codeModel); } private List findAllClassesInPackage(String modelElementId, CodeModel codeModel) { diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/TraceLinkCombiner.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/TraceLinkCombiner.java index a9cc097..be58799 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/TraceLinkCombiner.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/TraceLinkCombiner.java @@ -10,10 +10,11 @@ import edu.kit.kastel.mcse.ardoco.core.api.codetraceability.CodeTraceabilityState; import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.ConnectionStates; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadCodeTraceLink; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadSamTraceLink; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SamCodeTraceLink; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.ArchitectureEntity; +import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.TraceLink; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.TransitiveTraceLink; +import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; import edu.kit.kastel.mcse.ardoco.core.data.DataRepository; @@ -28,10 +29,10 @@ public TraceLinkCombiner(DataRepository dataRepository) { @Override public void process() { - MutableSet transitiveTraceLinks = Sets.mutable.empty(); - CodeTraceabilityState codeTraceabilityState = DataRepositoryHelper.getCodeTraceabilityState(getDataRepository()); - ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(getDataRepository()); - ConnectionStates connectionStates = DataRepositoryHelper.getConnectionStates(getDataRepository()); + MutableSet> transitiveTraceLinks = Sets.mutable.empty(); + CodeTraceabilityState codeTraceabilityState = DataRepositoryHelper.getCodeTraceabilityState(this.getDataRepository()); + ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(this.getDataRepository()); + ConnectionStates connectionStates = DataRepositoryHelper.getConnectionStates(this.getDataRepository()); if (codeTraceabilityState == null || modelStatesData == null || connectionStates == null) { return; @@ -42,23 +43,26 @@ public void process() { var connectionState = connectionStates.getConnectionState(metamodel); var sadSamTraceLinks = connectionState.getTraceLinks(); - var combinedLinks = combineToTransitiveTraceLinks(sadSamTraceLinks, samCodeTraceLinks); + var combinedLinks = this.combineToTransitiveTraceLinks(sadSamTraceLinks, samCodeTraceLinks); transitiveTraceLinks.addAll(combinedLinks.toList()); } codeTraceabilityState.addSadCodeTraceLinks(transitiveTraceLinks); } - private ImmutableSet combineToTransitiveTraceLinks(ImmutableSet sadSamTraceLinks, - ImmutableSet samCodeTraceLinks) { - MutableSet transitiveTraceLinks = Sets.mutable.empty(); - for (var sadSamTraceLink : sadSamTraceLinks) { - String modelElementUid = sadSamTraceLink.getModelElementUid(); - for (var samCodeTraceLink : samCodeTraceLinks) { + private ImmutableSet> combineToTransitiveTraceLinks( + ImmutableSet> sadSamTraceLinks, + ImmutableSet> samCodeTraceLinks) { + + MutableSet> transitiveTraceLinks = Sets.mutable.empty(); + + for (TraceLink sadSamTraceLink : sadSamTraceLinks) { + String modelElementUid = sadSamTraceLink.getSecondEndpoint().getId(); + for (TraceLink samCodeTraceLink : samCodeTraceLinks) { String samCodeTraceLinkModelElementId = samCodeTraceLink.getEndpointTuple().firstEndpoint().getId(); if (modelElementUid.equals(samCodeTraceLinkModelElementId)) { var transitiveTraceLinkOptional = TransitiveTraceLink.createTransitiveTraceLink(sadSamTraceLink, samCodeTraceLink); - transitiveTraceLinkOptional.ifPresent(transitiveTraceLinks::add); + transitiveTraceLinkOptional.ifPresent(it -> transitiveTraceLinks.add(it)); } } } diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/NameComparisonUtils.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/NameComparisonUtils.java index b821680..56b33b6 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/NameComparisonUtils.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/NameComparisonUtils.java @@ -7,10 +7,10 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeModule; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodePackage; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.pipeline.CoreDocument; import edu.stanford.nlp.pipeline.StanfordCoreNLP; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/NodeResult.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/NodeResult.java index be84d3d..cdbe14b 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/NodeResult.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/NodeResult.java @@ -8,11 +8,11 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SamCodeTraceLink; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Filter.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Filter.java index b7c75ad..d257720 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Filter.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Filter.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.NodeResult; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.AggregationNode; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchBest.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchBest.java index 55951a4..a066dd5 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchBest.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchBest.java @@ -3,7 +3,7 @@ import java.util.List; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.NodeResult; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.AggregationNode; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchSequentially.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchSequentially.java index 2411ff2..5790908 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchSequentially.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/MatchSequentially.java @@ -3,7 +3,7 @@ import java.util.List; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.NodeResult; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.AggregationNode; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree.Node; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Matcher.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Matcher.java index 54bbc7d..8f6d974 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Matcher.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/aggregation/Matcher.java @@ -4,9 +4,9 @@ import java.util.List; import java.util.Objects; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.NodeResult; public abstract class Matcher extends Aggregation { diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblance.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblance.java index 37666cd..e424b3b 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblance.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblance.java @@ -3,13 +3,13 @@ import java.util.Objects; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.InterfaceUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblanceTest.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblanceTest.java index 1190af0..24c115f 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblanceTest.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ComponentNameResemblanceTest.java @@ -5,12 +5,12 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItem; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PackageResemblance.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PackageResemblance.java index cf2e54c..1b9d0d2 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PackageResemblance.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PackageResemblance.java @@ -4,10 +4,10 @@ import java.util.List; import java.util.Objects; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PathResemblance.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PathResemblance.java index 2d9357c..2628d53 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PathResemblance.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/PathResemblance.java @@ -6,11 +6,11 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodePackage; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ProvidedInterfaceCorrespondence.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ProvidedInterfaceCorrespondence.java index 6df2407..8f90abe 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ProvidedInterfaceCorrespondence.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/ProvidedInterfaceCorrespondence.java @@ -5,13 +5,13 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeModule; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodePackage; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.Datatype; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/Required.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/Required.java index bf2cd12..b953322 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/Required.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/Required.java @@ -4,10 +4,10 @@ import java.util.SortedSet; import java.util.TreeSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter.java index 509a359..28f08ca 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter.java @@ -4,12 +4,12 @@ import java.util.List; import java.util.SortedSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodePackage; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.NameComparisonUtils; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter2.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter2.java index 569d08d..46c720f 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter2.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/functions/heuristics/SubpackageFilter2.java @@ -3,11 +3,11 @@ import java.util.SortedSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.EndpointTuple; import edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.Confidence; diff --git a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/ConnectionStateImpl.java b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/ConnectionStateImpl.java index a2600cc..28312c6 100644 --- a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/ConnectionStateImpl.java +++ b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/ConnectionStateImpl.java @@ -6,8 +6,8 @@ import org.eclipse.collections.api.list.MutableList; import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.ConnectionState; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.InstanceLink; +import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.InstanceLink; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendedInstance; import edu.kit.kastel.mcse.ardoco.core.data.AbstractState; import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant; diff --git a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ExtractionDependentOccurrenceInformant.java b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ExtractionDependentOccurrenceInformant.java index 1981656..2a51709 100644 --- a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ExtractionDependentOccurrenceInformant.java +++ b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ExtractionDependentOccurrenceInformant.java @@ -3,8 +3,8 @@ import java.util.SortedMap; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.text.Word; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.MappingKind; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.TextState; diff --git a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/InstantConnectionInformant.java b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/InstantConnectionInformant.java index fdae97b..417c135 100644 --- a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/InstantConnectionInformant.java +++ b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/InstantConnectionInformant.java @@ -4,9 +4,9 @@ import java.util.SortedMap; import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.ConnectionState; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationState; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; import edu.kit.kastel.mcse.ardoco.core.configuration.Configurable; diff --git a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/NameTypeConnectionInformant.java b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/NameTypeConnectionInformant.java index 0816472..710605b 100644 --- a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/NameTypeConnectionInformant.java +++ b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/NameTypeConnectionInformant.java @@ -7,9 +7,9 @@ import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.list.MutableList; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationState; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationStates; import edu.kit.kastel.mcse.ardoco.core.api.text.Word; diff --git a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ReferenceInformant.java b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ReferenceInformant.java index 225ebfd..0a66c57 100644 --- a/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ReferenceInformant.java +++ b/stages-tlr/connection-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/connectiongenerator/informants/ReferenceInformant.java @@ -5,8 +5,8 @@ import org.eclipse.collections.api.list.ImmutableList; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationState; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.MappingKind; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.NounMapping; diff --git a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/Extractor.java b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/Extractor.java index 514ba8d..701432f 100644 --- a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/Extractor.java +++ b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/Extractor.java @@ -3,6 +3,7 @@ import java.io.Serializable; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelType; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; @@ -14,18 +15,18 @@ protected Extractor(String path) { } public String getPath() { - return path; + return this.path; } public final Model extractModel(String path) { this.path = path; - return extractModel(); + return this.extractModel(); } public abstract Model extractModel(); - public String getModelId() { - return getModelType().getModelId(); + public Metamodel getModelId() { + return this.getModelType().getMetamodel(); } public abstract ModelType getModelType(); diff --git a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/AllLanguagesExtractor.java b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/AllLanguagesExtractor.java index 0ea459f..f74f195 100644 --- a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/AllLanguagesExtractor.java +++ b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/AllLanguagesExtractor.java @@ -10,7 +10,7 @@ import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItemRepository; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguage; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguages; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.java.JavaExtractor; import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.shell.ShellExtractor; @@ -18,21 +18,21 @@ @Deterministic public final class AllLanguagesExtractor extends CodeExtractor { - private final Map codeExtractors; + private final Map codeExtractors; private CodeModel extractedModel = null; public AllLanguagesExtractor(CodeItemRepository codeItemRepository, String path) { super(codeItemRepository, path); - codeExtractors = Map.of(ProgrammingLanguage.JAVA, new JavaExtractor(codeItemRepository, path), ProgrammingLanguage.SHELL, new ShellExtractor( + this.codeExtractors = Map.of(ProgrammingLanguages.JAVA, new JavaExtractor(codeItemRepository, path), ProgrammingLanguages.SHELL, new ShellExtractor( codeItemRepository, path)); } @Override public synchronized CodeModel extractModel() { - if (extractedModel == null) { + if (this.extractedModel == null) { List models = new ArrayList<>(); - for (CodeExtractor extractor : codeExtractors.values()) { + for (CodeExtractor extractor : this.codeExtractors.values()) { var model = extractor.extractModel(); models.add(model); } @@ -40,9 +40,9 @@ public synchronized CodeModel extractModel() { for (CodeModel model : models) { codeEndpoints.addAll(model.getContent()); } - this.extractedModel = new CodeModel(codeItemRepository, codeEndpoints); + this.extractedModel = new CodeModel(this.codeItemRepository, codeEndpoints); } - return extractedModel; + return this.extractedModel; } } diff --git a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/java/JavaModel.java b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/java/JavaModel.java index 880d637..5447712 100644 --- a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/java/JavaModel.java +++ b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/java/JavaModel.java @@ -38,7 +38,7 @@ import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ControlElement; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.Datatype; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.InterfaceUnit; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguage; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguages; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.java.finder.EnumDeclarationFinder; import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.java.finder.MethodDeclarationFinder; @@ -205,7 +205,7 @@ private void initModel(SortedMap compUnitMap) { packageNames = getPackageNames(fullName); } CodeCompilationUnit codeCompilationUnit = new CodeCompilationUnit(codeItemRepository, fileNameWithoutExtension, new TreeSet<>(), pathElements, - extension, ProgrammingLanguage.JAVA); + extension, ProgrammingLanguages.JAVA); codeCompilationUnits.add(codeCompilationUnit); if (null != packageDeclaration) { CodePackage codePackage = getPackage(packageNames, codeCompilationUnit); diff --git a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/shell/ShellVisitor.java b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/shell/ShellVisitor.java index 1dc9963..c6b3cae 100644 --- a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/shell/ShellVisitor.java +++ b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/connectors/generators/code/shell/ShellVisitor.java @@ -22,7 +22,7 @@ import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItem; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItemRepository; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguage; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.ProgrammingLanguages; public class ShellVisitor implements FileVisitor { private static final Logger logger = LoggerFactory.getLogger(ShellVisitor.class); @@ -87,7 +87,7 @@ private CodeCompilationUnit extractShellFile(Path path, String fileNameWithoutEx for (int i = 0; i < relativePath.getNameCount() - 1; i++) { pathElements.add(relativePath.getName(i).toString()); } - return new CodeCompilationUnit(codeItemRepository, fileNameWithoutExtension, new TreeSet<>(), pathElements, extension, ProgrammingLanguage.SHELL); + return new CodeCompilationUnit(codeItemRepository, fileNameWithoutExtension, new TreeSet<>(), pathElements, extension, ProgrammingLanguages.SHELL); } private static boolean isShellFile(String fileName, String code) { diff --git a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/informants/ArCoTLModelProviderInformant.java b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/informants/ArCoTLModelProviderInformant.java index ed64778..42ebe96 100644 --- a/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/informants/ArCoTLModelProviderInformant.java +++ b/stages-tlr/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/models/informants/ArCoTLModelProviderInformant.java @@ -5,7 +5,7 @@ import java.util.Optional; import java.util.SortedMap; -import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; @@ -59,31 +59,31 @@ public ArCoTLModelProviderInformant(DataRepository dataRepository, Extractor ext public void process() { Model extractedModel; - if (fromFile != null) { + if (this.fromFile != null) { extractedModel = CodeExtractor.readInCodeModel(this.fromFile); - addModelStateToDataRepository(CodeModelType.CODE_MODEL.getModelId(), extractedModel); + this.addModelStateToDataRepository(Metamodel.CODE, extractedModel); return; } IdentifierProvider.reset(); - logger.info("Extracting code model."); - extractedModel = extractor.extractModel(); - if (extractor instanceof CodeExtractor codeExtractor && extractedModel instanceof CodeModel codeModel) { - logger.info("Writing out code model to file in directory."); + this.logger.info("Extracting code model."); + extractedModel = this.extractor.extractModel(); + if (this.extractor instanceof CodeExtractor codeExtractor && extractedModel instanceof CodeModel codeModel) { + this.logger.info("Writing out code model to file in directory."); codeExtractor.writeOutCodeModel(codeModel); } - addModelStateToDataRepository(extractor.getModelId(), extractedModel); + this.addModelStateToDataRepository(this.extractor.getModelId(), extractedModel); } - private void addModelStateToDataRepository(String modelId, Model model) { - var dataRepository = getDataRepository(); - Optional modelStatesOptional = dataRepository.getData(MODEL_STATES_DATA, ModelStates.class); + private void addModelStateToDataRepository(Metamodel modelId, Model model) { + var dataRepository = this.getDataRepository(); + Optional modelStatesOptional = dataRepository.getData(ArCoTLModelProviderInformant.MODEL_STATES_DATA, ModelStates.class); var modelStates = modelStatesOptional.orElseGet(ModelStates::new); modelStates.addModel(modelId, model); if (modelStatesOptional.isEmpty()) { - dataRepository.addData(MODEL_STATES_DATA, modelStates); + dataRepository.addData(ArCoTLModelProviderInformant.MODEL_STATES_DATA, modelStates); } } diff --git a/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/ArchitectureExtractorTest.java b/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/ArchitectureExtractorTest.java index b4247a7..7385c4c 100644 --- a/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/ArchitectureExtractorTest.java +++ b/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/ArchitectureExtractorTest.java @@ -9,11 +9,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; @Deterministic diff --git a/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/java/JavaExtractorTest.java b/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/java/JavaExtractorTest.java index 3137398..49cad9d 100644 --- a/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/java/JavaExtractorTest.java +++ b/stages-tlr/model-provider/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/models/generators/java/JavaExtractorTest.java @@ -6,9 +6,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.kit.kastel.mcse.ardoco.core.api.models.Entity; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItemRepository; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.java.JavaExtractor; class JavaExtractorTest { diff --git a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/DefaultRecommendationStateStrategy.java b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/DefaultRecommendationStateStrategy.java index b1c2296..575992b 100644 --- a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/DefaultRecommendationStateStrategy.java +++ b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/DefaultRecommendationStateStrategy.java @@ -12,12 +12,12 @@ public DefaultRecommendationStateStrategy(GlobalConfiguration globalConfiguratio } @Override - public boolean areRITypesSimilar(String typeA, String typeB) { + public boolean areRecommendedInstanceTypesSimilar(String typeA, String typeB) { return globalConfiguration.getSimilarityUtils().areWordsSimilar(typeA, typeB); } @Override - public boolean areRINamesSimilar(String nameA, String nameB) { + public boolean areRecommendedInstanceNamesSimilar(String nameA, String nameB) { return globalConfiguration.getSimilarityUtils().areWordsSimilar(nameA, nameB); } } diff --git a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendationStateImpl.java b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendationStateImpl.java index f2357a1..6f0cd76 100644 --- a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendationStateImpl.java +++ b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendationStateImpl.java @@ -98,7 +98,7 @@ private void processRecommendedInstancesWithNoExactNameAndType(RecommendedInstan var added = false; for (RecommendedInstance riWithExactName : risWithExactName) { - var areWordsSimilar = recommendationStateStrategy.areRITypesSimilar(riWithExactName.getType(), ri.getType()); + var areWordsSimilar = recommendationStateStrategy.areRecommendedInstanceTypesSimilar(riWithExactName.getType(), ri.getType()); if (areWordsSimilar || recommendedInstancesHasEmptyType(ri, riWithExactName)) { riWithExactName.addMappings(ri.getNameMappings(), ri.getTypeMappings()); added = true; @@ -161,7 +161,7 @@ public ImmutableList getRecommendedInstancesByName(String n public ImmutableList getRecommendedInstancesBySimilarName(String name) { MutableList ris = Lists.mutable.empty(); for (RecommendedInstance ri : recommendedInstances) { - if (recommendationStateStrategy.areRINamesSimilar(ri.getName(), name)) { + if (recommendationStateStrategy.areRecommendedInstanceNamesSimilar(ri.getName(), name)) { ris.add(ri); } } @@ -188,6 +188,6 @@ public ImmutableList getRecommendedInstancesByType(String t */ @Override public ImmutableList getRecommendedInstancesBySimilarType(String type) { - return recommendedInstances.select(ri -> recommendationStateStrategy.areRITypesSimilar(ri.getType(), type)).toImmutableList(); + return recommendedInstances.select(ri -> recommendationStateStrategy.areRecommendedInstanceTypesSimilar(ri.getType(), type)).toImmutableList(); } } diff --git a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendedInstanceImpl.java b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendedInstanceImpl.java index 0a918fb..33e9860 100644 --- a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendedInstanceImpl.java +++ b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/RecommendedInstanceImpl.java @@ -13,7 +13,7 @@ import org.eclipse.collections.api.set.sorted.ImmutableSortedSet; import org.eclipse.collections.api.set.sorted.MutableSortedSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelElement; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.Entity; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendedInstance; import edu.kit.kastel.mcse.ardoco.core.api.text.Word; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.MappingKind; @@ -48,14 +48,15 @@ private RecommendedInstanceImpl(String name, String type) { this.type = type; this.name = name; this.internalConfidence = new Confidence(AggregationFunctions.AVERAGE); - nameMappings = Lists.mutable.empty(); - typeMappings = Lists.mutable.empty(); + this.nameMappings = Lists.mutable.empty(); + this.typeMappings = Lists.mutable.empty(); } @Override public void onDelete(NounMapping deletedNounMapping, NounMapping replacement) { - if (replacement == null) + if (replacement == null) { throw new IllegalArgumentException("Replacement should not be null!"); + } if (this.nameMappings.remove(deletedNounMapping)) { this.nameMappings.add(replacement); @@ -82,11 +83,11 @@ public RecommendedInstanceImpl(String name, String type, Claimant claimant, doub this(name, type); this.internalConfidence.addAgentConfidence(claimant, probability); - nameMappings.addAll(nameNodes.castToCollection()); - typeMappings.addAll(typeNodes.castToCollection()); + this.nameMappings.addAll(nameNodes.castToCollection()); + this.typeMappings.addAll(typeNodes.castToCollection()); - nameMappings.forEach(nm -> nm.registerChangeListener(this)); - typeMappings.forEach(nm -> nm.registerChangeListener(this)); + this.nameMappings.forEach(nm -> nm.registerChangeListener(this)); + this.typeMappings.forEach(nm -> nm.registerChangeListener(this)); } private static double calculateMappingProbability(ImmutableList nameMappings, ImmutableList typeMappings) { @@ -103,7 +104,7 @@ private static double calculateMappingProbability(ImmutableList nam */ @Override public ImmutableList getNameMappings() { - return Lists.immutable.withAll(nameMappings); + return Lists.immutable.withAll(this.nameMappings); } /** @@ -113,7 +114,7 @@ public ImmutableList getNameMappings() { */ @Override public ImmutableList getTypeMappings() { - return Lists.immutable.withAll(typeMappings); + return Lists.immutable.withAll(this.typeMappings); } /** @@ -123,20 +124,20 @@ public ImmutableList getTypeMappings() { */ @Override public double getProbability() { - var mappingProbability = calculateMappingProbability(getNameMappings(), getTypeMappings()); - var ownProbability = internalConfidence.getConfidence(); + var mappingProbability = RecommendedInstanceImpl.calculateMappingProbability(this.getNameMappings(), this.getTypeMappings()); + var ownProbability = this.internalConfidence.getConfidence(); List probabilities = new ArrayList<>(); probabilities.add(mappingProbability); probabilities.add(ownProbability); - if (Math.abs(weightInternalConfidence) > 1) { - var element = weightInternalConfidence > 0 ? ownProbability : mappingProbability; - for (int i = 0; i < Math.abs(weightInternalConfidence) - 1; i++) { + if (Math.abs(this.weightInternalConfidence) > 1) { + var element = this.weightInternalConfidence > 0 ? ownProbability : mappingProbability; + for (int i = 0; i < Math.abs(this.weightInternalConfidence) - 1; i++) { probabilities.add(element); } } - return GLOBAL_AGGREGATOR.applyAsDouble(probabilities); + return RecommendedInstanceImpl.GLOBAL_AGGREGATOR.applyAsDouble(probabilities); } /** @@ -147,8 +148,8 @@ public double getProbability() { */ @Override public void addMappings(NounMapping nameMapping, NounMapping typeMapping) { - addName(nameMapping); - addType(typeMapping); + this.addName(nameMapping); + this.addType(typeMapping); } /** @@ -170,9 +171,10 @@ public void addMappings(ImmutableList nameMapping, ImmutableList getSentenceNumbers() { - MutableSortedSet sentenceNos = getNameMappings().flatCollect(nm -> nm.getWords().collect(Word::getSentenceNo)).toSortedSet(); + MutableSortedSet sentenceNos = this.getNameMappings().flatCollect(nm -> nm.getWords().collect(Word::getSentenceNo)).toSortedSet(); return sentenceNos.toImmutableSortedSet(); } @@ -244,22 +247,22 @@ public ImmutableSortedSet getSentenceNumbers() { public String toString() { var separator = "\n\t\t\t\t\t"; MutableList typeNodeVals = Lists.mutable.empty(); - for (NounMapping typeMapping : typeMappings) { + for (NounMapping typeMapping : this.typeMappings) { typeNodeVals.add(typeMapping.toString()); } MutableList nameNodeVals = Lists.mutable.empty(); - for (NounMapping nameMapping : nameMappings) { + for (NounMapping nameMapping : this.nameMappings) { nameNodeVals.add(nameMapping.toString()); } - return "RecommendationInstance [" + " name=" + name + ", type=" + type + ", probability=" + getProbability() + // + return "RecommendationInstance [" + " name=" + this.name + ", type=" + this.type + ", probability=" + this.getProbability() + // ", mappings:]= " + separator + String.join(separator, nameNodeVals) + separator + String.join(separator, typeNodeVals) + "\n"; } //FIXME Uses mutable properties @Override public int hashCode() { - return Objects.hash(name, type); + return Objects.hash(this.name, this.type); } //FIXME Uses mutable properties @@ -271,13 +274,14 @@ public boolean equals(Object obj) { if (!(obj instanceof RecommendedInstanceImpl other)) { return false; } - return Objects.equals(name, other.name) && Objects.equals(type, other.type); + return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); } @Override - public int compareTo(ModelElement o) { - if (this == o) + public int compareTo(Entity o) { + if (this == o) { return 0; + } if (o instanceof RecommendedInstance ri) { return Comparator.comparing(RecommendedInstance::getName).thenComparing(RecommendedInstance::getType).compare(this, ri); } diff --git a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/CompoundRecommendationInformant.java b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/CompoundRecommendationInformant.java index 70cc73a..834d6bd 100644 --- a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/CompoundRecommendationInformant.java +++ b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/CompoundRecommendationInformant.java @@ -9,7 +9,7 @@ import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.set.sorted.MutableSortedSet; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationState; import edu.kit.kastel.mcse.ardoco.core.api.text.Word; import edu.kit.kastel.mcse.ardoco.core.api.textextraction.MappingKind; diff --git a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/NameTypeInformant.java b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/NameTypeInformant.java index 718fa89..3173448 100644 --- a/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/NameTypeInformant.java +++ b/stages-tlr/recommendation-generator/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/recommendationgenerator/informants/NameTypeInformant.java @@ -3,8 +3,8 @@ import java.util.SortedMap; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationState; import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendationStates; import edu.kit.kastel.mcse.ardoco.core.api.text.Word; diff --git a/tests/integration-tests/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandard.java b/tests/integration-tests/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandard.java index bfab8b2..9aa6068 100644 --- a/tests/integration-tests/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandard.java +++ b/tests/integration-tests/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandard.java @@ -12,8 +12,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelElement; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; public class GoldStandard { private Logger logger = LoggerFactory.getLogger(GoldStandard.class); @@ -21,16 +21,16 @@ public class GoldStandard { private File goldStandard; private ArchitectureModel model; - private MutableList> sentence2instance = Lists.mutable.empty(); + private MutableList> sentence2instance = Lists.mutable.empty(); public GoldStandard(File goldStandard, ArchitectureModel model) { this.goldStandard = goldStandard; this.model = model; - load(); + this.load(); } private void load() { - try (Scanner scan = new Scanner(goldStandard, StandardCharsets.UTF_8)) { + try (Scanner scan = new Scanner(this.goldStandard, StandardCharsets.UTF_8)) { while (scan.hasNextLine()) { String line = scan.nextLine(); if (line == null || line.isBlank() || line.startsWith("modelElement") || line.contains("modelElementID")) { @@ -39,31 +39,31 @@ private void load() { } String[] idXline = line.strip().split(",", -1); - ModelElement instance = Lists.immutable.withAll(model.getContent()).select(i -> i.getId().equals(idXline[0])).getFirst(); + ArchitectureItem instance = Lists.immutable.withAll(this.model.getContent()).select(i -> i.getId().equals(idXline[0])).getFirst(); if (instance == null) { System.err.println("No instance found for id \"" + idXline[0] + "\""); continue; } int sentence = Integer.parseInt(idXline[1]); - while (sentence2instance.size() <= sentence) { - sentence2instance.add(Lists.mutable.empty()); + while (this.sentence2instance.size() <= sentence) { + this.sentence2instance.add(Lists.mutable.empty()); } - sentence2instance.get(sentence).add(instance); + this.sentence2instance.get(sentence).add(instance); } } catch (IOException e) { - logger.warn(e.getMessage(), e.getCause()); + this.logger.warn(e.getMessage(), e.getCause()); } } - public ImmutableList getModelInstances(int sentenceNo) { + public ImmutableList getModelInstances(int sentenceNo) { // Index starts at 1 - return sentence2instance.get(sentenceNo).toImmutable(); + return this.sentence2instance.get(sentenceNo).toImmutable(); } - public ImmutableList getSentencesWithElement(ModelElement elem) { + public ImmutableList getSentencesWithElement(ArchitectureItem elem) { MutableList sentences = Lists.mutable.empty(); - for (int i = 0; i < sentence2instance.size(); i++) { - var instances = sentence2instance.get(i); + for (int i = 0; i < this.sentence2instance.size(); i++) { + var instances = this.sentence2instance.get(i); if (instances.anySatisfy(e -> e.getId().equals(elem.getId()))) { sentences.add(i); } diff --git a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/eval/baseline/InconsistencyBaselineInformant.java b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/eval/baseline/InconsistencyBaselineInformant.java index d7080b0..fc6e146 100644 --- a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/eval/baseline/InconsistencyBaselineInformant.java +++ b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/eval/baseline/InconsistencyBaselineInformant.java @@ -9,7 +9,6 @@ import edu.kit.kastel.mcse.ardoco.core.api.inconsistency.InconsistencyState; import edu.kit.kastel.mcse.ardoco.core.api.inconsistency.InconsistencyStates; import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; -import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadSamTraceLink; import edu.kit.kastel.mcse.ardoco.core.api.text.Sentence; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; import edu.kit.kastel.mcse.ardoco.core.data.DataRepository; @@ -28,7 +27,7 @@ protected InconsistencyBaselineInformant(DataRepository dataRepository) { @Override public void process() { var inconsistencyStates = InconsistencyStatesImpl.build(); - DataRepository dataRepository = getDataRepository(); + DataRepository dataRepository = this.getDataRepository(); dataRepository.addData(InconsistencyStates.ID, inconsistencyStates); var text = DataRepositoryHelper.getAnnotatedText(dataRepository); @@ -40,7 +39,7 @@ public void process() { var modelState = modelStates.getModelExtractionState(model); Metamodel metamodel = modelState.getMetamodel(); var traceLinks = connectionStates.getConnectionState(metamodel).getTraceLinks(); - var sentencesWithTraceLinks = traceLinks.collect(SadSamTraceLink::getSentenceNumber).toSet(); + var sentencesWithTraceLinks = traceLinks.collect(it -> it.getFirstEndpoint().getSentence().getSentenceNumber()).toSet(); MutableSet sentencesWithoutTraceLinks = sentences.withoutAll(sentencesWithTraceLinks); InconsistencyState inconsistencyState = inconsistencyStates.getInconsistencyState(metamodel); diff --git a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/InconsistencyDetectionEvaluationIT.java b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/InconsistencyDetectionEvaluationIT.java index c3f57b8..6a4013d 100644 --- a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/InconsistencyDetectionEvaluationIT.java +++ b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/InconsistencyDetectionEvaluationIT.java @@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory; import edu.kit.kastel.mcse.ardoco.core.api.inconsistency.ModelInconsistency; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelElement; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; @@ -75,21 +74,21 @@ class InconsistencyDetectionEvaluationIT { @EnumSource(Project.class) @Order(1) void missingModelElementInconsistencyIT(GoldStandardProject goldStandardProject) { - runMissingModelElementInconsistencyEval(goldStandardProject, goldStandardProject.getExpectedInconsistencyResults()); + this.runMissingModelElementInconsistencyEval(goldStandardProject, goldStandardProject.getExpectedInconsistencyResults()); } protected void runMissingModelElementInconsistencyEval(GoldStandardProject goldStandardProject, ExpectedResults expectedInconsistencyResults) { - logger.info("Start evaluation of MME-inconsistency for {}", goldStandardProject.getProjectName()); - Map runs = produceRuns(goldStandardProject); + InconsistencyDetectionEvaluationIT.logger.info("Start evaluation of MME-inconsistency for {}", goldStandardProject.getProjectName()); + Map runs = this.produceRuns(goldStandardProject); - var results = calculateEvaluationResults(goldStandardProject, runs); + var results = this.calculateEvaluationResults(goldStandardProject, runs); EvaluationResults weightedResults = ResultCalculatorUtil.calculateMicroAverageResults(results.toImmutable()); - logResultsMissingModelInconsistency(goldStandardProject, weightedResults, expectedInconsistencyResults); - checkResults(weightedResults, expectedInconsistencyResults); + this.logResultsMissingModelInconsistency(goldStandardProject, weightedResults, expectedInconsistencyResults); + this.checkResults(weightedResults, expectedInconsistencyResults); - writeOutResults(goldStandardProject, results, runs); + this.writeOutResults(goldStandardProject, results, runs); } /** @@ -104,24 +103,24 @@ protected void runMissingModelElementInconsistencyEval(GoldStandardProject goldS @EnumSource(Project.class) @Order(5) void missingModelElementInconsistencyBaselineIT(GoldStandardProject goldStandardProject) { - runMissingModelElementInconsistencyBaselineEval(goldStandardProject); + this.runMissingModelElementInconsistencyBaselineEval(goldStandardProject); } protected void runMissingModelElementInconsistencyBaselineEval(GoldStandardProject goldStandardProject) { - logger.info("Start evaluation of MME-inconsistency baseline for {}", goldStandardProject.getProjectName()); + InconsistencyDetectionEvaluationIT.logger.info("Start evaluation of MME-inconsistency baseline for {}", goldStandardProject.getProjectName()); HoldBackRunResultsProducer holdBackRunResultsProducer = new HoldBackRunResultsProducer(); - Map runs = holdBackRunResultsProducer.produceHoldBackRunResults(goldStandardProject, true); + Map runs = holdBackRunResultsProducer.produceHoldBackRunResults(goldStandardProject, true); Assertions.assertTrue(runs != null && !runs.isEmpty()); - var results = calculateEvaluationResults(goldStandardProject, runs); + var results = this.calculateEvaluationResults(goldStandardProject, runs); var weightedResults = ResultCalculatorUtil.calculateWeightedAverageResults(results.toImmutable()); - if (logger.isInfoEnabled()) { + if (InconsistencyDetectionEvaluationIT.logger.isInfoEnabled()) { String name = goldStandardProject.getProjectName() + " missing model inconsistency"; - TestUtil.logResults(logger, name, weightedResults); + TestUtil.logResults(InconsistencyDetectionEvaluationIT.logger, name, weightedResults); } } @@ -135,14 +134,14 @@ protected void runMissingModelElementInconsistencyBaselineEval(GoldStandardProje @EnumSource(Project.class) @Order(10) void missingTextInconsistencyIT(GoldStandardProject goldStandardProject) { - runMissingTextInconsistencyEval(goldStandardProject); + this.runMissingTextInconsistencyEval(goldStandardProject); } private void runMissingTextInconsistencyEval(GoldStandardProject goldStandardProject) { - var projectResults = arDoCoResults.get(goldStandardProject); + var projectResults = InconsistencyDetectionEvaluationIT.arDoCoResults.get(goldStandardProject); if (projectResults == null) { - produceRuns(goldStandardProject); - projectResults = arDoCoResults.get(goldStandardProject); + this.produceRuns(goldStandardProject); + projectResults = InconsistencyDetectionEvaluationIT.arDoCoResults.get(goldStandardProject); } Assertions.assertNotNull(projectResults, "No results found."); @@ -151,18 +150,18 @@ private void runMissingTextInconsistencyEval(GoldStandardProject goldStandardPro var results = TestUtil.compareInconsistencies(projectResults, inconsistentModelElements.toImmutable(), expectedInconsistentModelElements.toImmutable()); String name = goldStandardProject.getProjectName() + " missing text inconsistency"; - TestUtil.logExplicitResults(logger, name, results); - writeOutResults(goldStandardProject, results); + TestUtil.logExplicitResults(InconsistencyDetectionEvaluationIT.logger, name, results); + this.writeOutResults(goldStandardProject, results); } - private Map produceRuns(GoldStandardProject goldStandardProject) { - HoldBackRunResultsProducer holdBackRunResultsProducer = getHoldBackRunResultsProducer(); + private Map produceRuns(GoldStandardProject goldStandardProject) { + HoldBackRunResultsProducer holdBackRunResultsProducer = this.getHoldBackRunResultsProducer(); - Map runs = holdBackRunResultsProducer.produceHoldBackRunResults(goldStandardProject, false); + Map runs = holdBackRunResultsProducer.produceHoldBackRunResults(goldStandardProject, false); ArDoCoResult baseArDoCoResult = runs.get(null); - saveOutput(goldStandardProject, baseArDoCoResult); - arDoCoResults.put(goldStandardProject, baseArDoCoResult); + InconsistencyDetectionEvaluationIT.saveOutput(goldStandardProject, baseArDoCoResult); + InconsistencyDetectionEvaluationIT.arDoCoResults.put(goldStandardProject, baseArDoCoResult); return runs; } @@ -170,24 +169,25 @@ protected HoldBackRunResultsProducer getHoldBackRunResultsProducer() { return new HoldBackRunResultsProducer(); } - private MutableList> calculateEvaluationResults(GoldStandardProject goldStandardProject, Map runs) { + private MutableList> calculateEvaluationResults(GoldStandardProject goldStandardProject, + Map runs) { - Map> results = Maps.mutable.empty(); + Map> results = Maps.mutable.empty(); for (var run : runs.entrySet()) { - ModelElement modelInstance = run.getKey(); + ArchitectureItem modelInstance = run.getKey(); ArDoCoResult arDoCoResult = run.getValue(); - var runEvalResults = evaluateRun(goldStandardProject, modelInstance, arDoCoResult); + var runEvalResults = this.evaluateRun(goldStandardProject, modelInstance, arDoCoResult); if (runEvalResults != null) { results.put(modelInstance, runEvalResults); } else { - logger.error("Evaluation results for {} are null.", modelInstance); + InconsistencyDetectionEvaluationIT.logger.error("Evaluation results for {} are null.", modelInstance); } } return Lists.mutable.ofAll(results.values()); } - private EvaluationResults evaluateRun(GoldStandardProject goldStandardProject, ModelElement removedElement, ArDoCoResult arDoCoResult) { + private EvaluationResults evaluateRun(GoldStandardProject goldStandardProject, ArchitectureItem removedElement, ArDoCoResult arDoCoResult) { var modelId = arDoCoResult.getModelIds().getFirst(); ImmutableList inconsistencies = arDoCoResult.getInconsistenciesOfTypeForModel(modelId, @@ -197,11 +197,11 @@ private EvaluationResults evaluateRun(GoldStandardProject goldStandardPr return null; } - var goldStandard = goldStandardProject.getTlrGoldStandard(getPcmModel(goldStandardProject)); + var goldStandard = goldStandardProject.getTlrGoldStandard(InconsistencyDetectionEvaluationIT.getPcmModel(goldStandardProject)); var expectedLines = goldStandard.getSentencesWithElement(removedElement).distinct().collect(Object::toString); var actualSentences = inconsistencies.collect(MissingModelInstanceInconsistency::sentence).distinct().collect(Object::toString); - return calculateEvaluationResults(arDoCoResult, expectedLines, actualSentences); + return InconsistencyDetectionEvaluationIT.calculateEvaluationResults(arDoCoResult, expectedLines, actualSentences); } private static EvaluationResults calculateEvaluationResults(ArDoCoResult arDoCoResult, ImmutableList expectedLines, @@ -215,9 +215,9 @@ private static ArchitectureModel getPcmModel(GoldStandardProject goldStandardPro private void logResultsMissingModelInconsistency(GoldStandardProject goldStandardProject, EvaluationResults weightedAverageResult, ExpectedResults expectedResults) { - if (logger.isInfoEnabled()) { + if (InconsistencyDetectionEvaluationIT.logger.isInfoEnabled()) { String name = goldStandardProject.getProjectName() + " missing model inconsistency"; - TestUtil.logExtendedResultsWithExpected(logger, this, name, weightedAverageResult, expectedResults); + TestUtil.logExtendedResultsWithExpected(InconsistencyDetectionEvaluationIT.logger, this, name, weightedAverageResult, expectedResults); } } @@ -235,18 +235,18 @@ private void checkResults(EvaluationResults results, ExpectedResults exp .phiCoefficient() + " is below the expected " + "minimum value " + expectedResults.phiCoefficient())); } - private void writeOutResults(GoldStandardProject goldStandardProject, List> results, Map runs) { - var outputs = createOutput(goldStandardProject, results, runs); + private void writeOutResults(GoldStandardProject goldStandardProject, List> results, Map runs) { + var outputs = InconsistencyDetectionEvaluationIT.createOutput(goldStandardProject, results, runs); var outputBuilder = outputs.getOne(); var detailedOutputBuilder = outputs.getTwo(); - Path outputPath = Path.of(OUTPUT); - Path idEvalPath = outputPath.resolve(DIRECTORY_NAME); + Path outputPath = Path.of(InconsistencyDetectionEvaluationIT.OUTPUT); + Path idEvalPath = outputPath.resolve(InconsistencyDetectionEvaluationIT.DIRECTORY_NAME); try { Files.createDirectories(outputPath); Files.createDirectories(idEvalPath); } catch (IOException e) { - logger.warn("Could not create directories.", e); + InconsistencyDetectionEvaluationIT.logger.warn("Could not create directories.", e); } String projectFileName = "inconsistencies_" + goldStandardProject.getProjectName() + ".txt"; @@ -259,22 +259,22 @@ private void writeOutResults(GoldStandardProject goldStandardProject, List results) { - Path outputPath = Path.of(OUTPUT); - Path idEvalPath = outputPath.resolve(DIRECTORY_NAME); + Path outputPath = Path.of(InconsistencyDetectionEvaluationIT.OUTPUT); + Path idEvalPath = outputPath.resolve(InconsistencyDetectionEvaluationIT.DIRECTORY_NAME); try { Files.createDirectories(outputPath); Files.createDirectories(idEvalPath); } catch (IOException e) { - logger.warn("Could not create directories.", e); + InconsistencyDetectionEvaluationIT.logger.warn("Could not create directories.", e); } - var outputBuilder = createStringBuilderWithHeader(goldStandardProject); + var outputBuilder = InconsistencyDetectionEvaluationIT.createStringBuilderWithHeader(goldStandardProject); outputBuilder.append(TestUtil.createResultLogString("Inconsistent Model Elements", results)); - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); outputBuilder.append("Number of True Positives: ").append(results.truePositives().size()); - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); outputBuilder.append("Number of False Positives: ").append(results.falsePositives().size()); - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); outputBuilder.append("Number of False Negatives: ").append(results.falseNegatives().size()); String projectFileName = "inconsistentModelElements_" + goldStandardProject.getProjectName() + ".txt"; @@ -287,7 +287,7 @@ private static void saveOutput(GoldStandardProject goldStandardProject, ArDoCoRe Objects.requireNonNull(arDoCoResult); String projectName = goldStandardProject.getProjectName(); - var outputDir = Path.of(OUTPUT); + var outputDir = Path.of(InconsistencyDetectionEvaluationIT.OUTPUT); var filename = projectName + ".txt"; var outputFileTLR = outputDir.resolve("traceLinks_" + filename).toFile(); @@ -297,58 +297,60 @@ private static void saveOutput(GoldStandardProject goldStandardProject, ArDoCoRe } private static Pair createOutput(GoldStandardProject goldStandardProject, List> results, - Map runs) { - StringBuilder outputBuilder = createStringBuilderWithHeader(goldStandardProject); - var resultCalculatorStringBuilderPair = inspectResults(results, runs, outputBuilder); + Map runs) { + StringBuilder outputBuilder = InconsistencyDetectionEvaluationIT.createStringBuilderWithHeader(goldStandardProject); + var resultCalculatorStringBuilderPair = InconsistencyDetectionEvaluationIT.inspectResults(results, runs, outputBuilder); var resultCalculator = resultCalculatorStringBuilderPair.getOne(); - outputBuilder.append(getOverallResultsString(resultCalculator)); + outputBuilder.append(InconsistencyDetectionEvaluationIT.getOverallResultsString(resultCalculator)); var detailedOutputBuilder = resultCalculatorStringBuilderPair.getTwo(); return Tuples.pair(outputBuilder, detailedOutputBuilder); } private static String getOverallResultsString(MutableList> results) { StringBuilder outputBuilder = new StringBuilder(); - outputBuilder.append("###").append(LINE_SEPARATOR); + outputBuilder.append("###").append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); var weightedAverageResults = ResultCalculatorUtil.calculateWeightedAverageResults(results.toImmutable()); - var resultString = TestUtil.createResultLogString("### OVERALL RESULTS ###" + LINE_SEPARATOR + "Weighted" + " Average", weightedAverageResults); + var resultString = TestUtil.createResultLogString( + "### OVERALL RESULTS ###" + InconsistencyDetectionEvaluationIT.LINE_SEPARATOR + "Weighted" + " Average", weightedAverageResults); outputBuilder.append(resultString); - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); return outputBuilder.toString(); } private static StringBuilder createStringBuilderWithHeader(GoldStandardProject goldStandardProject) { StringBuilder outputBuilder = new StringBuilder(); outputBuilder.append("### ").append(goldStandardProject.getProjectName()).append(" ###"); - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); return outputBuilder; } private static Pair>, StringBuilder> inspectResults(List> results, - Map runs, StringBuilder outputBuilder) { + Map runs, StringBuilder outputBuilder) { var detailedOutputBuilder = new StringBuilder(); MutableList> resultsWithWeight = Lists.mutable.empty(); int counter = 0; for (var run : runs.entrySet()) { ArDoCoResult arDoCoResult = run.getValue(); - ArchitectureItem instance = (ArchitectureItem) run.getKey(); + ArchitectureItem instance = run.getKey(); if (instance == null) { - inspectBaseCase(outputBuilder, arDoCoResult); + InconsistencyDetectionEvaluationIT.inspectBaseCase(outputBuilder, arDoCoResult); } else { - outputBuilder.append("###").append(LINE_SEPARATOR); - detailedOutputBuilder.append("###").append(LINE_SEPARATOR); + outputBuilder.append("###").append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); + detailedOutputBuilder.append("###").append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); outputBuilder.append("Removed Instance: ").append(instance.getName()); detailedOutputBuilder.append("Removed Instance: ").append(instance.getName()); - outputBuilder.append(LINE_SEPARATOR); - detailedOutputBuilder.append(LINE_SEPARATOR); - var result = results.get(counter++); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); + detailedOutputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); + var result = results.get(counter); + counter++; var resultString = String.format(Locale.ENGLISH, "Precision: %.3f, Recall: %.3f, F1: %" + ".3f, Accuracy: %.3f, Phi Coef.: %.3f", result .precision(), result.recall(), result.f1(), result.accuracy(), result.phiCoefficient()); outputBuilder.append(resultString); detailedOutputBuilder.append(resultString); - inspectRun(outputBuilder, detailedOutputBuilder, resultsWithWeight, arDoCoResult, result); + InconsistencyDetectionEvaluationIT.inspectRun(outputBuilder, detailedOutputBuilder, resultsWithWeight, arDoCoResult, result); } - outputBuilder.append(LINE_SEPARATOR); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR); } return Tuples.pair(resultsWithWeight, detailedOutputBuilder); @@ -357,38 +359,43 @@ private static Pair>, StringBuilder> inspe private static void inspectRun(StringBuilder outputBuilder, StringBuilder detailedOutputBuilder, MutableList> allResults, ArDoCoResult arDoCoResult, EvaluationResults result) { var truePositives = result.truePositives(); - appendResults(truePositives, detailedOutputBuilder, "True Positives", arDoCoResult, outputBuilder); + InconsistencyDetectionEvaluationIT.appendResults(truePositives, detailedOutputBuilder, "True Positives", arDoCoResult, outputBuilder); var falsePositives = result.falsePositives(); - appendResults(falsePositives, detailedOutputBuilder, "False Positives", arDoCoResult, outputBuilder); + InconsistencyDetectionEvaluationIT.appendResults(falsePositives, detailedOutputBuilder, "False Positives", arDoCoResult, outputBuilder); var falseNegatives = result.falseNegatives(); - appendResults(falseNegatives, detailedOutputBuilder, "False Negatives", arDoCoResult, outputBuilder); + InconsistencyDetectionEvaluationIT.appendResults(falseNegatives, detailedOutputBuilder, "False Negatives", arDoCoResult, outputBuilder); allResults.add(result); } private static void appendResults(List resultList, StringBuilder detailedOutputBuilder, String type, ArDoCoResult arDoCoResult, StringBuilder outputBuilder) { - resultList = sortIntegerStrings(resultList); - detailedOutputBuilder.append(LINE_SEPARATOR).append("== ").append(type).append(" =="); - detailedOutputBuilder.append(LINE_SEPARATOR).append(createDetailedOutputString(arDoCoResult, resultList)); - outputBuilder.append(LINE_SEPARATOR).append(type).append(": ").append(listToString(resultList)); + resultList = InconsistencyDetectionEvaluationIT.sortIntegerStrings(resultList); + detailedOutputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR).append("== ").append(type).append(" =="); + detailedOutputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR) + .append(InconsistencyDetectionEvaluationIT.createDetailedOutputString(arDoCoResult, resultList)); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR) + .append(type) + .append(": ") + .append(InconsistencyDetectionEvaluationIT.listToString(resultList)); } private static void inspectBaseCase(StringBuilder outputBuilder, ArDoCoResult data) { - var initialInconsistencies = getInitialInconsistencies(data); + var initialInconsistencies = InconsistencyDetectionEvaluationIT.getInitialInconsistencies(data); outputBuilder.append("Initial Inconsistencies: ").append(initialInconsistencies.size()); var initialInconsistenciesSentences = initialInconsistencies.collect(MissingModelInstanceInconsistency::sentence) .toSortedSet() .collect(Object::toString); - outputBuilder.append(LINE_SEPARATOR).append(listToString(initialInconsistenciesSentences)); + outputBuilder.append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR) + .append(InconsistencyDetectionEvaluationIT.listToString(initialInconsistenciesSentences)); } private static String createDetailedOutputString(ArDoCoResult result, List sentenceNumbers) { var outputBuilder = new StringBuilder(); if (sentenceNumbers.isEmpty()) { - return outputBuilder.append("None").append(LINE_SEPARATOR).toString(); + return outputBuilder.append("None").append(InconsistencyDetectionEvaluationIT.LINE_SEPARATOR).toString(); } for (var inconsistentSentence : result.getInconsistentSentences()) { @@ -396,7 +403,7 @@ private static String createDetailedOutputString(ArDoCoResult result, List it instanceof ArchitectureComponent) + .filter(ArchitectureComponent.class::isInstance) .map(it -> (ArchitectureComponent) it)); } private Extractor getExtractor() { - return new PcmExtractor(inputArchitectureModel.getAbsolutePath()); + return new PcmExtractor(this.inputArchitectureModel.getAbsolutePath()); } /** @@ -59,7 +58,7 @@ public void setCurrentHoldBackIndex(int currentHoldBackIndex) { * @return the number of actual instances (including all held back elements) */ public int numberOfActualInstances() { - return components.size(); + return this.components.size(); } /** @@ -67,19 +66,19 @@ public int numberOfActualInstances() { * * @return the ModelInstance that is held back. If nothing is held back, returns null */ - public ModelElement getCurrentHoldBack() { - if (currentHoldBackIndex < 0) { + public ArchitectureComponent getCurrentHoldBack() { + if (this.currentHoldBackIndex < 0) { return null; } - return components.get(currentHoldBackIndex); + return this.components.get(this.currentHoldBackIndex); } public PipelineAgent get(SortedMap additionalConfigs, DataRepository dataRepository) { PipelineAgent agent = new PipelineAgent(List.of(new ArCoTLModelProviderInformant(dataRepository, new Extractor("") { @Override public Model extractModel() { - var elements = new ArrayList<>(initialModel.getContent()); - var elementToRemove = getCurrentHoldBack(); + var elements = new ArrayList<>(HoldBackArCoTLModelProvider.this.initialModel.getContent()); + var elementToRemove = HoldBackArCoTLModelProvider.this.getCurrentHoldBack(); elements.remove(elementToRemove); return new ArchitectureModel(elements); } @@ -89,6 +88,9 @@ public ModelType getModelType() { return ArchitectureModelType.PCM; } })), ArCoTLModelProviderAgent.class.getSimpleName(), dataRepository) { + + private static final long serialVersionUID = -816629373178698328L; + @Override protected void delegateApplyConfigurationToInternalObjects(SortedMap additionalConfiguration) { // empty diff --git a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/inconsistencyhelper/HoldBackRunResultsProducer.java b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/inconsistencyhelper/HoldBackRunResultsProducer.java index 495f236..d038b51 100644 --- a/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/inconsistencyhelper/HoldBackRunResultsProducer.java +++ b/tests/integration-tests/tests-inconsistency/src/test/java/edu/kit/kastel/mcse/ardoco/id/tests/integration/inconsistencyhelper/HoldBackRunResultsProducer.java @@ -9,7 +9,7 @@ import java.util.Map; import java.util.SortedMap; -import edu.kit.kastel.mcse.ardoco.core.api.models.ModelElement; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; import edu.kit.kastel.mcse.ardoco.core.common.util.CommonUtilities; import edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper; @@ -47,23 +47,24 @@ public HoldBackRunResultsProducer() { * @return a map containing the mapping from ModelElement that was held back to the DataStructure that was produced when running ArDoCo without the * ModelElement */ - public Map produceHoldBackRunResults(GoldStandardProject goldStandardProject, boolean useBaselineApproach) { - Map runs = new LinkedHashMap<>(); - inputModel = goldStandardProject.getModelFile(); - inputText = goldStandardProject.getTextFile(); - additionalConfigs = goldStandardProject.getAdditionalConfigurations(); + public Map produceHoldBackRunResults(GoldStandardProject goldStandardProject, boolean useBaselineApproach) { + Map runs = new LinkedHashMap<>(); + this.inputModel = goldStandardProject.getModelFile(); + this.inputText = goldStandardProject.getTextFile(); + this.additionalConfigs = goldStandardProject.getAdditionalConfigurations(); - HoldBackArCoTLModelProvider holdBackArCoTLModelProvider = new HoldBackArCoTLModelProvider(inputModel); + HoldBackArCoTLModelProvider holdBackArCoTLModelProvider = new HoldBackArCoTLModelProvider(this.inputModel); - var preRunDataRepository = runShared(goldStandardProject); + var preRunDataRepository = this.runShared(goldStandardProject); - var baseRunData = new ArDoCoResult(runUnshared(goldStandardProject, holdBackArCoTLModelProvider, preRunDataRepository.deepCopy(), useBaselineApproach)); + var baseRunData = new ArDoCoResult(this.runUnshared(goldStandardProject, holdBackArCoTLModelProvider, preRunDataRepository.deepCopy(), + useBaselineApproach)); runs.put(null, baseRunData); for (int i = 0; i < holdBackArCoTLModelProvider.numberOfActualInstances(); i++) { holdBackArCoTLModelProvider.setCurrentHoldBackIndex(i); var currentHoldBack = holdBackArCoTLModelProvider.getCurrentHoldBack(); - var currentRunData = runUnshared(goldStandardProject, holdBackArCoTLModelProvider, preRunDataRepository.deepCopy(), useBaselineApproach); + var currentRunData = this.runUnshared(goldStandardProject, holdBackArCoTLModelProvider, preRunDataRepository.deepCopy(), useBaselineApproach); var result = new ArDoCoResult(currentRunData); runs.put(currentHoldBack, result); } @@ -83,13 +84,13 @@ protected DataRepository runShared(GoldStandardProject goldStandardProject) { public List initializePipelineSteps(DataRepository dataRepository) { var pipelineSteps = new ArrayList(); - var text = CommonUtilities.readInputText(inputText); + var text = CommonUtilities.readInputText(HoldBackRunResultsProducer.this.inputText); if (text.isBlank()) { throw new IllegalArgumentException("Cannot deal with empty input text. Maybe there was an error reading the file."); } DataRepositoryHelper.putInputText(dataRepository, text); - pipelineSteps.add(TextPreprocessingAgent.get(additionalConfigs, dataRepository)); - pipelineSteps.add(TextExtraction.get(additionalConfigs, dataRepository)); + pipelineSteps.add(TextPreprocessingAgent.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); + pipelineSteps.add(TextExtraction.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); return pipelineSteps; } @@ -112,14 +113,14 @@ protected DataRepository runUnshared(GoldStandardProject goldStandardProject, Ho public List initializePipelineSteps(DataRepository dataRepository) { var pipelineSteps = new ArrayList(); - pipelineSteps.add(holdElementsBackModelConnector.get(additionalConfigs, dataRepository)); - pipelineSteps.add(RecommendationGenerator.get(additionalConfigs, dataRepository)); - pipelineSteps.add(ConnectionGenerator.get(additionalConfigs, dataRepository)); + pipelineSteps.add(holdElementsBackModelConnector.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); + pipelineSteps.add(RecommendationGenerator.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); + pipelineSteps.add(ConnectionGenerator.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); if (useInconsistencyBaseline) { pipelineSteps.add(new InconsistencyBaseline(dataRepository)); } else { - pipelineSteps.add(InconsistencyChecker.get(additionalConfigs, dataRepository)); + pipelineSteps.add(InconsistencyChecker.get(HoldBackRunResultsProducer.this.additionalConfigs, dataRepository)); } return pipelineSteps; diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadCodeTraceabilityLinkRecoveryEvaluation.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadCodeTraceabilityLinkRecoveryEvaluation.java index dbc44cd..566ba6b 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadCodeTraceabilityLinkRecoveryEvaluation.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadCodeTraceabilityLinkRecoveryEvaluation.java @@ -1,8 +1,6 @@ /* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.tests.integration; -import static edu.kit.kastel.mcse.ardoco.tlr.tests.integration.TraceLinkEvaluationIT.OUTPUT; - import java.io.File; import java.util.SortedMap; import java.util.TreeMap; @@ -10,7 +8,7 @@ import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.ImmutableList; -import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; @@ -43,9 +41,9 @@ protected boolean resultHasRequiredData(ArDoCoResult arDoCoResult) { protected ArDoCoRunner getAndSetupRunner(CodeProject codeProject) { String name = codeProject.name().toLowerCase(); File textInput = codeProject.getTextFile(); - File inputCode = getInputCode(codeProject, acmFile); + File inputCode = this.getInputCode(codeProject, this.acmFile); SortedMap additionalConfigsMap = new TreeMap<>(); - File outputDir = new File(OUTPUT); + File outputDir = new File(TraceLinkEvaluationIT.OUTPUT); var runner = new ArDoCoForSadCodeTraceabilityLinkRecovery(name); runner.setUp(textInput, inputCode, additionalConfigsMap, outputDir); @@ -54,7 +52,7 @@ protected ArDoCoRunner getAndSetupRunner(CodeProject codeProject) { @Override protected void compareResults(EvaluationResults results, ExpectedResults expectedResults) { - logger.debug("Disable comparison, because transitive tracelinks are better"); + TraceabilityLinkRecoveryEvaluation.logger.debug("Disable comparison, because transitive tracelinks are better"); } @Override @@ -70,7 +68,7 @@ protected ImmutableList getGoldStandard(CodeProject codeProject) { @Override protected ImmutableList enrollGoldStandard(ImmutableList goldStandard, ArDoCoResult result) { - return enrollGoldStandardForCode(goldStandard, result); + return TraceabilityLinkRecoveryEvaluation.enrollGoldStandardForCode(goldStandard, result); } @Override @@ -86,7 +84,7 @@ protected int getConfusionMatrixSum(ArDoCoResult arDoCoResult) { int sentences = text.getSentences().size(); ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(dataRepository); - Model codeModel = modelStatesData.getModel(CodeModelType.CODE_MODEL.getModelId()); + Model codeModel = modelStatesData.getModel(Metamodel.CODE); var codeModelEndpoints = codeModel.getEndpoints().size(); return sentences * codeModelEndpoints; diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadSamCodeTraceabilityLinkRecoveryEvaluation.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadSamCodeTraceabilityLinkRecoveryEvaluation.java index d8a50b2..b712546 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadSamCodeTraceabilityLinkRecoveryEvaluation.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SadSamCodeTraceabilityLinkRecoveryEvaluation.java @@ -1,8 +1,6 @@ /* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.tests.integration; -import static edu.kit.kastel.mcse.ardoco.tlr.tests.integration.TraceLinkEvaluationIT.OUTPUT; - import java.io.File; import java.util.SortedMap; import java.util.TreeMap; @@ -11,7 +9,7 @@ import org.eclipse.collections.api.list.ImmutableList; import edu.kit.kastel.mcse.ardoco.core.api.models.ArchitectureModelType; -import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; @@ -43,9 +41,9 @@ protected ArDoCoRunner getAndSetupRunner(CodeProject codeProject) { String name = codeProject.name().toLowerCase(); File textInput = codeProject.getTextFile(); File inputArchitectureModel = codeProject.getModelFile(); - File inputCode = getInputCode(codeProject, acmFile); + File inputCode = this.getInputCode(codeProject, this.acmFile); SortedMap additionalConfigsMap = new TreeMap<>(); - File outputDir = new File(OUTPUT); + File outputDir = new File(TraceLinkEvaluationIT.OUTPUT); var runner = new ArDoCoForSadSamCodeTraceabilityLinkRecovery(name); runner.setUp(textInput, inputArchitectureModel, ArchitectureModelType.PCM, inputCode, additionalConfigsMap, outputDir); @@ -66,7 +64,7 @@ protected ImmutableList getGoldStandard(CodeProject codeProject) { @Override protected ImmutableList enrollGoldStandard(ImmutableList goldStandard, ArDoCoResult result) { - return enrollGoldStandardForCode(goldStandard, result); + return TraceabilityLinkRecoveryEvaluation.enrollGoldStandardForCode(goldStandard, result); } @Override @@ -82,7 +80,7 @@ protected int getConfusionMatrixSum(ArDoCoResult arDoCoResult) { int sentences = text.getSentences().size(); ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(dataRepository); - Model codeModel = modelStatesData.getModel(CodeModelType.CODE_MODEL.getModelId()); + Model codeModel = modelStatesData.getModel(Metamodel.CODE); var codeModelEndpoints = codeModel.getEndpoints().size(); return sentences * codeModelEndpoints; diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SamCodeTraceabilityLinkRecoveryEvaluation.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SamCodeTraceabilityLinkRecoveryEvaluation.java index 8316364..ec2caf7 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SamCodeTraceabilityLinkRecoveryEvaluation.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/SamCodeTraceabilityLinkRecoveryEvaluation.java @@ -1,8 +1,6 @@ /* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.tests.integration; -import static edu.kit.kastel.mcse.ardoco.tlr.tests.integration.TraceLinkEvaluationIT.OUTPUT; - import java.io.File; import java.util.SortedMap; import java.util.TreeMap; @@ -11,7 +9,7 @@ import org.eclipse.collections.api.list.ImmutableList; import edu.kit.kastel.mcse.ardoco.core.api.models.ArchitectureModelType; -import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; @@ -39,10 +37,10 @@ protected boolean resultHasRequiredData(ArDoCoResult arDoCoResult) { @Override protected ArDoCoForSamCodeTraceabilityLinkRecovery getAndSetupRunner(CodeProject codeProject) { String name = codeProject.name().toLowerCase(); - File inputCode = getInputCode(codeProject, acmFile); + File inputCode = this.getInputCode(codeProject, this.acmFile); File inputArchitectureModel = codeProject.getModelFile(); SortedMap additionalConfigsMap = new TreeMap<>(); - File outputDir = new File(OUTPUT); + File outputDir = new File(TraceLinkEvaluationIT.OUTPUT); var runner = new ArDoCoForSamCodeTraceabilityLinkRecovery(name); runner.setUp(inputArchitectureModel, ArchitectureModelType.PCM, inputCode, additionalConfigsMap, outputDir); @@ -63,7 +61,7 @@ protected ImmutableList getGoldStandard(CodeProject codeProject) { @Override protected ImmutableList enrollGoldStandard(ImmutableList goldStandard, ArDoCoResult result) { - return enrollGoldStandardForCode(goldStandard, result); + return TraceabilityLinkRecoveryEvaluation.enrollGoldStandardForCode(goldStandard, result); } @Override @@ -74,8 +72,8 @@ protected ExpectedResults getExpectedResults(CodeProject codeProject) { @Override protected int getConfusionMatrixSum(ArDoCoResult arDoCoResult) { ModelStates modelStatesData = DataRepositoryHelper.getModelStatesData(arDoCoResult.dataRepository()); - Model codeModel = modelStatesData.getModel(CodeModelType.CODE_MODEL.getModelId()); - Model architectureModel = modelStatesData.getModel(ArchitectureModelType.PCM.getModelId()); + Model codeModel = modelStatesData.getModel(Metamodel.CODE); + Model architectureModel = modelStatesData.getModel(Metamodel.ARCHITECTURE); var codeModelEndpoints = codeModel.getEndpoints().size(); var architectureModelEndpoints = architectureModel.getEndpoints().size(); return codeModelEndpoints * architectureModelEndpoints; diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/TraceabilityLinkRecoveryEvaluation.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/TraceabilityLinkRecoveryEvaluation.java index aafee0d..8c54143 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/TraceabilityLinkRecoveryEvaluation.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/TraceabilityLinkRecoveryEvaluation.java @@ -18,7 +18,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.kit.kastel.mcse.ardoco.core.api.models.CodeModelType; +import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; import edu.kit.kastel.mcse.ardoco.core.common.RepositoryHandler; @@ -44,20 +44,20 @@ public abstract class TraceabilityLinkRecoveryEvaluation resultMap = new LinkedHashMap<>(); protected final ArDoCoResult runTraceLinkEvaluation(T project) { - ArDoCoResult result = resultMap.get(project); - if (result == null || !resultHasRequiredData(result)) { - ArDoCoRunner runner = getAndSetupRunner(project); + ArDoCoResult result = TraceabilityLinkRecoveryEvaluation.resultMap.get(project); + if (result == null || !this.resultHasRequiredData(result)) { + ArDoCoRunner runner = this.getAndSetupRunner(project); result = runner.run(); } Assertions.assertNotNull(result); - var goldStandard = getGoldStandard(project); - goldStandard = enrollGoldStandard(goldStandard, result); - var evaluationResults = calculateEvaluationResults(result, goldStandard); + var goldStandard = this.getGoldStandard(project); + goldStandard = this.enrollGoldStandard(goldStandard, result); + var evaluationResults = this.calculateEvaluationResults(result, goldStandard); - ExpectedResults expectedResults = getExpectedResults(project); - TestUtil.logExtendedResultsWithExpected(logger, this, project.getProjectName(), evaluationResults, expectedResults); - compareResults(evaluationResults, expectedResults); + ExpectedResults expectedResults = this.getExpectedResults(project); + TestUtil.logExtendedResultsWithExpected(TraceabilityLinkRecoveryEvaluation.logger, this, project.getProjectName(), evaluationResults, expectedResults); + this.compareResults(evaluationResults, expectedResults); return result; } @@ -66,7 +66,7 @@ protected final ArDoCoResult runTraceLinkEvaluation(T project) { protected File getInputCode(CodeProject codeProject, boolean acmFile) { File inputCode; if (!acmFile) { - prepareCode(codeProject); + this.prepareCode(codeProject); inputCode = codeProject.getCodeLocation(false); } else { inputCode = codeProject.getCodeLocation(true); @@ -95,18 +95,18 @@ protected static ImmutableList enrollGoldStandardForCode(ImmutableList enrollTraceLink(Model codeModel, String traceLink) { var splitTraceLink = traceLink.split(","); var codeEntry = splitTraceLink[1].strip(); - if (codeEntry.endsWith(GOLD_STANDARD_PATH_SEPARATOR)) { + if (codeEntry.endsWith(TraceabilityLinkRecoveryEvaluation.GOLD_STANDARD_PATH_SEPARATOR)) { for (var endpoint : codeModel.getEndpoints()) { var endpointPath = endpoint.toString(); if (endpointPath.startsWith(codeEntry)) { @@ -156,12 +156,12 @@ protected void compareResults(EvaluationResults results, ExpectedResults * @return the result of the comparison */ protected EvaluationResults calculateEvaluationResults(ArDoCoResult arDoCoResult, ImmutableCollection goldStandard) { - ImmutableList results = createTraceLinkStringList(arDoCoResult); + ImmutableList results = this.createTraceLinkStringList(arDoCoResult); Assertions.assertFalse(results.isEmpty()); Set distinctTraceLinks = new LinkedHashSet<>(results.castToCollection()); Set distinctGoldStandard = new LinkedHashSet<>(goldStandard.castToCollection()); - int confusionMatrixSum = getConfusionMatrixSum(arDoCoResult); + int confusionMatrixSum = this.getConfusionMatrixSum(arDoCoResult); var calculator = ClassificationMetricsCalculator.getInstance(); var classification = calculator.calculateMetrics(distinctTraceLinks, distinctGoldStandard, confusionMatrixSum); diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/ModelElementSentenceLink.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/ModelElementSentenceLink.java index 04ed6d4..cb2dfff 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/ModelElementSentenceLink.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/ModelElementSentenceLink.java @@ -3,7 +3,10 @@ import java.util.Comparator; +import edu.kit.kastel.mcse.ardoco.core.api.models.entity.ArchitectureEntity; import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadSamTraceLink; +import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity; +import edu.kit.kastel.mcse.ardoco.core.common.Internal; /** * Represents a simple trace link by the id of the model and number of the sentence involved. @@ -11,7 +14,12 @@ public record ModelElementSentenceLink(String modelElementId, int sentenceNumber) implements Comparable { public ModelElementSentenceLink(SadSamTraceLink traceLink) { - this(traceLink.getModelElementUid(), traceLink.getSentenceNumber()); + this(traceLink.getArchitectureEntityId(), traceLink.getSentenceNumber()); + } + + @Internal + public ModelElementSentenceLink(SentenceEntity sentence, ArchitectureEntity architectureEntity) { + this(architectureEntity.getId(), sentence.getSentence().getSentenceNumber()); } @Override diff --git a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/TLRUtil.java b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/TLRUtil.java index e21bf0d..8d61441 100644 --- a/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/TLRUtil.java +++ b/tests/integration-tests/tests-tlr/src/test/java/edu/kit/kastel/mcse/ardoco/tlr/tests/integration/tlrhelper/TLRUtil.java @@ -8,8 +8,8 @@ import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.ConnectionState; import edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator.ConnectionStates; -import edu.kit.kastel.mcse.ardoco.core.api.models.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; +import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.data.DataRepository; import edu.kit.kastel.mcse.ardoco.core.tests.eval.results.EvaluationResults; @@ -24,7 +24,7 @@ private TLRUtil() { /** * extracts the trace links from a {@link DataRepository} - * + * * @param data the {@link EvaluationResults} * @return the trace links */ @@ -40,7 +40,10 @@ public static ImmutableList getTraceLinks(DataReposito .map(connectionStates::getConnectionState) .toList(); for (var connectionState : connectionStatesList) { - traceLinks.addAll(connectionState.getTraceLinks().stream().map(ModelElementSentenceLink::new).toList()); + traceLinks.addAll(connectionState.getTraceLinks() + .stream() + .map(it -> new ModelElementSentenceLink(it.getFirstEndpoint(), it.getSecondEndpoint())) + .toList()); } return traceLinks.toImmutable(); }