Skip to content

Commit

Permalink
Add push script
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Dec 5, 2024
1 parent 60f1f8e commit 4472286
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 121 deletions.
141 changes: 66 additions & 75 deletions pipeline-tlr/pom.xml
Original file line number Diff line number Diff line change
@@ -1,80 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>parent-tlr</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>parent-tlr</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>pipeline-tlr</artifactId>
<artifactId>pipeline-tlr</artifactId>

<dependencies>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>code-traceability</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>connection-generator</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>model-provider</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>pipeline-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>pipeline-core</artifactId>
<version>${revision}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>recommendation-generator</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>text-extraction</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>text-preprocessing</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>common</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>common</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>pipeline-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.core</groupId>
<artifactId>pipeline-core</artifactId>
<version>${revision}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>code-traceability</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>connection-generator</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>model-provider</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>recommendation-generator</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>text-extraction</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>io.github.ardoco.tlr</groupId>
<artifactId>text-preprocessing</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<connection>scm:git:git://github.com/ArDoCo/TLR.git</connection>
<developerConnection>scm:git:ssh://github.com:ArDoCo/TLR.git</developerConnection>
<tag>HEAD</tag>
<url>http://github.com/ArDoCo/TLR/tree/main</url>
<url>https://github.com/ArDoCo/TLR/tree/main</url>
</scm>
<issueManagement>
<system>GitHub Issues</system>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private ImmutableSet<TraceLink<SentenceEntity, CodeCompilationUnit>> 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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -115,7 +115,7 @@ public static List<CodePackage> 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;
Expand All @@ -128,12 +128,12 @@ public static List<CodePackage> getPackageList(CodeModule codePackage) {
List<CodePackage> 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;
Expand Down Expand Up @@ -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);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -39,12 +39,12 @@ public static AggregationNode getFilterAlwaysNode(Node... children) {

@Override
protected NodeResult matchEndpoint(Entity endpointToMatch, List<NodeResult> childrenResults) {
NodeResult unfiltered = childrenResults.get(0).getResultForEndpoint(endpointToMatch);
NodeResult unfiltered = childrenResults.getFirst().getResultForEndpoint(endpointToMatch);
NodeResult filtered = new NodeResult();
filtered.addAll(unfiltered);

List<NodeResult> resultsToFilter = new ArrayList<>(childrenResults);
resultsToFilter.remove(0);
resultsToFilter.removeFirst();
for (NodeResult resultToFilter : resultsToFilter) {
filtered = filtered.filter(resultToFilter);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -90,7 +90,7 @@ private SortedSet<CodeModule> getPackages(Entity ae, SortedSet<CodeCompilationUn
private SortedSet<CodeModule> getPackage(Entity ae, CodeCompilationUnit ce) {
List<CodePackage> 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()));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -42,9 +42,9 @@ private Confidence calculateSubpackageFilter(ArchitectureItem archEndpoint, Code
if (thisPackages.isEmpty() || otherPackages.isEmpty()) {
return new Confidence();
}
List<CodePackage> parentPackages = NameComparisonUtils.getPackageList(thisPackages.get(0));
parentPackages.remove(thisPackages.get(0));
if (parentPackages.contains(otherPackages.get(otherPackages.size() - 1))) {
List<CodePackage> parentPackages = NameComparisonUtils.getPackageList(thisPackages.getFirst());
parentPackages.remove(thisPackages.getFirst());
if (parentPackages.contains(otherPackages.getLast())) {
return new Confidence(1.0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 0 additions & 6 deletions stages-tlr/model-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,5 @@
<artifactId>xml-object-mapper</artifactId>
<version>0.7.0</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -306,7 +306,7 @@ private CodePackage getPackage(List<String> packageNames, CodeCompilationUnit co
return null;
}
List<String> 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) {
Expand Down
5 changes: 0 additions & 5 deletions stages-tlr/text-extraction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private NounMapping getMostSimilarNounMappingOverThreshold(NounMapping nounMappi
return null;
}

return similarNounMappings.get(0);
return similarNounMappings.getFirst();
}

@Override
Expand Down
5 changes: 0 additions & 5 deletions stages-tlr/text-preprocessing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,5 @@
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public PhraseImpl(Tree tree, ImmutableList<Word> words, SentenceImpl parent) {

@Override
public int getSentenceNo() {
return words.get(0).getSentenceNo();
return words.getFirst().getSentenceNo();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void addPhrase(Phrase phrase) {
protected List<Word> getWordsForPhrase(Tree phrase) {
List<Word> 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++);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4472286

Please sign in to comment.