diff --git a/pipeline-tlr/pom.xml b/pipeline-tlr/pom.xml index 13b4aa6..cbfe4c9 100644 --- a/pipeline-tlr/pom.xml +++ b/pipeline-tlr/pom.xml @@ -1,80 +1,71 @@ - - 4.0.0 - - io.github.ardoco.tlr - parent-tlr - ${revision} - ../pom.xml - + + 4.0.0 + + io.github.ardoco.tlr + parent-tlr + ${revision} + ../pom.xml + - pipeline-tlr + pipeline-tlr - - - io.github.ardoco.tlr - code-traceability - ${revision} - - - io.github.ardoco.tlr - connection-generator - ${revision} - - - io.github.ardoco.tlr - model-provider - ${revision} - - - io.github.ardoco.core - pipeline-core - ${revision} - - - io.github.ardoco.core - pipeline-core - ${revision} - test-jar - test - - - io.github.ardoco.tlr - recommendation-generator - ${revision} - - - io.github.ardoco.tlr - text-extraction - ${revision} - - - io.github.ardoco.tlr - text-preprocessing - ${revision} - - - - io.github.ardoco.core - common - ${revision} - - - - org.reflections - reflections - - - - org.slf4j - log4j-over-slf4j - - - org.slf4j - slf4j-simple - test - - + + + io.github.ardoco.core + common + ${revision} + + + io.github.ardoco.core + pipeline-core + ${revision} + + + io.github.ardoco.core + pipeline-core + ${revision} + test-jar + test + + + io.github.ardoco.tlr + code-traceability + ${revision} + + + io.github.ardoco.tlr + connection-generator + ${revision} + + + io.github.ardoco.tlr + model-provider + ${revision} + + + io.github.ardoco.tlr + recommendation-generator + ${revision} + + + io.github.ardoco.tlr + text-extraction + ${revision} + + + io.github.ardoco.tlr + text-preprocessing + ${revision} + + + org.reflections + reflections + + + org.slf4j + log4j-over-slf4j + + diff --git a/pom.xml b/pom.xml index ed877bb..889251d 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ scm:git:git://github.com/ArDoCo/TLR.git scm:git:ssh://github.com:ArDoCo/TLR.git HEAD - http://github.com/ArDoCo/TLR/tree/main + https://github.com/ArDoCo/TLR/tree/main GitHub Issues 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 650eb3d..720bd0c 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 @@ -62,7 +62,7 @@ private ImmutableSet> combineToTr String samCodeTraceLinkModelElementId = samCodeTraceLink.getFirstEndpoint().getId(); if (modelElementUid.equals(samCodeTraceLinkModelElementId)) { var transitiveTraceLinkOptional = TransitiveTraceLink.createTransitiveTraceLink(sadSamTraceLink, samCodeTraceLink); - transitiveTraceLinkOptional.ifPresent(it -> transitiveTraceLinks.add(it)); + transitiveTraceLinkOptional.ifPresent(transitiveTraceLinks::add); } } } 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 9632d69..b3c01f8 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 @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl; import java.util.ArrayList; @@ -115,7 +115,7 @@ public static List getMatchedPackages(Entity archEndpoint, CodeComp for (int i = p.size() - 1; i > 0; i--) { double similarity2 = NameComparisonUtils.getContainedRatio(archEndpoint, p.subList(0, i), PreprocessingMethod.STEMMING); if (similarity2 < similarity) { - matchedPackages.add(0, p2.get(i)); + matchedPackages.addFirst(p2.get(i)); } if (similarity2 == 0) { break; @@ -128,12 +128,12 @@ public static List getPackageList(CodeModule codePackage) { List parents = new ArrayList<>(); CodeModule parent = codePackage; if (parent instanceof CodePackage parentPackage) { - parents.add(0, parentPackage); + parents.addFirst(parentPackage); } while (parent.hasParent()) { parent = parent.getParent(); if (parent instanceof CodePackage parentPackage) { - parents.add(0, parentPackage); + parents.addFirst(parentPackage); } } return parents; @@ -193,9 +193,9 @@ public enum PreprocessingMethod { private static boolean areEqual(String name1, String name2, PreprocessingMethod methodToUse) { return switch (methodToUse) { - case NONE -> areEqual(name1, name2); - case STEMMING -> areEqualStemmed(name1, name2); - case LEMMATIZATION -> areEqualLemmatized(name1, name2); + case NONE -> areEqual(name1, name2); + case STEMMING -> areEqualStemmed(name1, name2); + case LEMMATIZATION -> areEqualLemmatized(name1, name2); }; } diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/Confidence.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/Confidence.java index d22afce..8493084 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/Confidence.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/Confidence.java @@ -91,10 +91,9 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (!(obj instanceof Confidence)) { + if (!(obj instanceof Confidence other)) { return false; } - Confidence other = (Confidence) obj; return Objects.equals(confidenceOptional, other.confidenceOptional); } diff --git a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/computationtree/Node.java b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/computationtree/Node.java index ef260ff..8f5b557 100644 --- a/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/computationtree/Node.java +++ b/stages-tlr/code-traceability/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/codetraceability/informants/arcotl/computation/computationtree/Node.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.computation.computationtree; import java.util.ArrayList; @@ -63,7 +63,7 @@ public Node getChild() { if (children.size() != 1) { throw new IllegalStateException("Not exactly one child exists"); } - return children.get(0); + return children.getFirst(); } /** 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 5ec1243..0582d95 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 @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.functions.aggregation; import java.util.ArrayList; @@ -39,12 +39,12 @@ public static AggregationNode getFilterAlwaysNode(Node... children) { @Override protected NodeResult matchEndpoint(Entity endpointToMatch, List childrenResults) { - NodeResult unfiltered = childrenResults.get(0).getResultForEndpoint(endpointToMatch); + NodeResult unfiltered = childrenResults.getFirst().getResultForEndpoint(endpointToMatch); NodeResult filtered = new NodeResult(); filtered.addAll(unfiltered); List resultsToFilter = new ArrayList<>(childrenResults); - resultsToFilter.remove(0); + resultsToFilter.removeFirst(); for (NodeResult resultToFilter : resultsToFilter) { filtered = filtered.filter(resultToFilter); } 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 cffd1af..68b7313 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 @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.functions.heuristics; import java.util.List; @@ -90,7 +90,7 @@ private SortedSet getPackages(Entity ae, SortedSet getPackage(Entity ae, CodeCompilationUnit ce) { List cePackages = NameComparisonUtils.getMatchedPackages(ae, ce); if (!cePackages.isEmpty()) { - return new TreeSet<>(List.of(cePackages.get(cePackages.size() - 1))); + return new TreeSet<>(List.of(cePackages.getLast())); } if (ce.hasParent()) { return new TreeSet<>(List.of(ce.getParent())); 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 c7da8ef..c6de224 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 @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.codetraceability.informants.arcotl.functions.heuristics; import java.util.List; @@ -42,9 +42,9 @@ private Confidence calculateSubpackageFilter(ArchitectureItem archEndpoint, Code if (thisPackages.isEmpty() || otherPackages.isEmpty()) { return new Confidence(); } - List parentPackages = NameComparisonUtils.getPackageList(thisPackages.get(0)); - parentPackages.remove(thisPackages.get(0)); - if (parentPackages.contains(otherPackages.get(otherPackages.size() - 1))) { + List parentPackages = NameComparisonUtils.getPackageList(thisPackages.getFirst()); + parentPackages.remove(thisPackages.getFirst()); + if (parentPackages.contains(otherPackages.getLast())) { return new Confidence(1.0); } } 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 abe07b6..d332e52 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 @@ -208,7 +208,7 @@ private ModelInstance tryToIdentify(TextState textExtractionState, ImmutableList matchingInstances = matchingInstances.select(i -> SimilarityUtils.getInstance().areWordsOfListsSimilar(i.getNameParts(), Lists.immutable.with(text))); if (!matchingInstances.isEmpty()) { - return matchingInstances.get(0); + return matchingInstances.getFirst(); } return null; } diff --git a/stages-tlr/model-provider/pom.xml b/stages-tlr/model-provider/pom.xml index 6f94306..3ff3aa4 100644 --- a/stages-tlr/model-provider/pom.xml +++ b/stages-tlr/model-provider/pom.xml @@ -48,11 +48,5 @@ xml-object-mapper 0.7.0 - - - org.slf4j - slf4j-simple - test - 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 5447712..1d937b8 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 @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators.code.java; import java.nio.file.Path; @@ -306,7 +306,7 @@ private CodePackage getPackage(List packageNames, CodeCompilationUnit co return null; } List packageNamesCopy = new ArrayList<>(packageNames); - String name = packageNamesCopy.remove(0); + String name = packageNamesCopy.removeFirst(); CodePackage codePackage = new CodePackage(codeItemRepository, name); CodePackage childCodePackage = getPackage(packageNamesCopy, codeCompilationUnit); if (null == childCodePackage) { diff --git a/stages-tlr/text-extraction/pom.xml b/stages-tlr/text-extraction/pom.xml index 48d8ff0..9b7b9ab 100644 --- a/stages-tlr/text-extraction/pom.xml +++ b/stages-tlr/text-extraction/pom.xml @@ -46,11 +46,6 @@ mockito-junit-jupiter test - - org.slf4j - slf4j-simple - test - diff --git a/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/PhraseMappingImpl.java b/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/PhraseMappingImpl.java index 195f709..42b66a5 100644 --- a/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/PhraseMappingImpl.java +++ b/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/PhraseMappingImpl.java @@ -60,7 +60,7 @@ public PhraseType getPhraseType() { if (phrases.isEmpty()) { throw new IllegalStateException("A phrase mapping should always contain some phrases!"); } - return phrases.iterator().next().getPhraseType(); + return phrases.getFirst().getPhraseType(); } @Override diff --git a/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/informants/MappingCombinerInformant.java b/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/informants/MappingCombinerInformant.java index c16845a..d2e646b 100644 --- a/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/informants/MappingCombinerInformant.java +++ b/stages-tlr/text-extraction/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/textextraction/informants/MappingCombinerInformant.java @@ -124,7 +124,7 @@ private NounMapping getMostSimilarNounMappingOverThreshold(NounMapping nounMappi return null; } - return similarNounMappings.get(0); + return similarNounMappings.getFirst(); } @Override diff --git a/stages-tlr/text-preprocessing/pom.xml b/stages-tlr/text-preprocessing/pom.xml index ff7296d..6e9ceaf 100644 --- a/stages-tlr/text-preprocessing/pom.xml +++ b/stages-tlr/text-preprocessing/pom.xml @@ -55,10 +55,5 @@ org.slf4j log4j-over-slf4j - - org.slf4j - slf4j-simple - test - diff --git a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/PhraseImpl.java b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/PhraseImpl.java index 5686d25..3f0153c 100644 --- a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/PhraseImpl.java +++ b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/PhraseImpl.java @@ -37,7 +37,7 @@ public PhraseImpl(Tree tree, ImmutableList words, SentenceImpl parent) { @Override public int getSentenceNo() { - return words.get(0).getSentenceNo(); + return words.getFirst().getSentenceNo(); } @Override diff --git a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/SentenceImpl.java b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/SentenceImpl.java index fa0d3a2..f40b79e 100644 --- a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/SentenceImpl.java +++ b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/SentenceImpl.java @@ -86,7 +86,7 @@ public void addPhrase(Phrase phrase) { protected List getWordsForPhrase(Tree phrase) { List phraseWords = Lists.mutable.empty(); var coreLabels = phrase.taggedLabeledYield(); - var index = findIndexOfFirstWordInPhrase(coreLabels.get(0), this); + var index = findIndexOfFirstWordInPhrase(coreLabels.getFirst(), this); logger.debug("phrase starting position: {}", index); for (int wordIndexInSentence = 0; wordIndexInSentence < coreLabels.size(); wordIndexInSentence++) { var phraseWord = parent.words().get(index++); diff --git a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/WordImpl.java b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/WordImpl.java index 70c85fb..1000aa7 100644 --- a/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/WordImpl.java +++ b/stages-tlr/text-preprocessing/src/main/java/edu/kit/kastel/mcse/ardoco/tlr/text/providers/informants/corenlp/WordImpl.java @@ -64,7 +64,7 @@ private Phrase loadPhrase() { var currentPhrase = getSentence().getPhrases().stream().filter(p -> p.getContainedWords().contains(this)).findFirst().orElseThrow(); var subPhrases = List.of(currentPhrase); while (!subPhrases.isEmpty()) { - currentPhrase = subPhrases.get(0); + currentPhrase = subPhrases.getFirst(); subPhrases = currentPhrase.getSubPhrases().stream().filter(p -> p.getContainedWords().contains(this)).toList(); } return currentPhrase;