Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Dec 2, 2024
1 parent 5a51689 commit 6c4ae8e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/* Licensed under MIT 2023-2024. */
package edu.kit.kastel.mcse.ardoco.tlr.models.connectors.generators;

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;

public abstract class Extractor implements Serializable {
public abstract class Extractor {
protected String path;

protected Extractor(String path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Licensed under MIT 2022-2024. */
package edu.kit.kastel.mcse.ardoco.tlr.textextraction;

import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.Collectors;

Expand All @@ -20,7 +19,7 @@
import edu.kit.kastel.mcse.ardoco.core.data.Confidence;
import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;

public class OriginalTextStateStrategy extends DefaultTextStateStrategy implements Serializable {
public class OriginalTextStateStrategy extends DefaultTextStateStrategy {

protected OriginalTextStateStrategy() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.MissingResourceException;
import java.util.Objects;
import java.util.Optional;
Expand All @@ -23,7 +22,7 @@
/**
* Interface for all Project extensions
*/
public interface GoldStandardProject extends Serializable {
public interface GoldStandardProject {
/**
* {@return the project the instance is based on}
*/
Expand All @@ -38,7 +37,7 @@ public interface GoldStandardProject extends Serializable {
* {@return the version of the source files of this project}
*/
default long getSourceFilesVersion() {
getResourceNames().forEach(this::validateResourceChecksum);
this.getResourceNames().forEach(this::validateResourceChecksum);
return Preferences.userNodeForPackage(getClass()).getLong("version", -1L);
}

Expand All @@ -53,8 +52,9 @@ private boolean validateResourceChecksum(String resourceName) {
var cls = getClass();
var logger = LoggerFactory.getLogger(cls);
try (var resource = cls.getResourceAsStream(resourceName)) {
if (resource == null)
if (resource == null) {
throw new MissingResourceException("No such resource at path " + resourceName, File.class.getSimpleName(), resourceName);
}
String md5 = DigestUtils.md5Hex(resource);
if (!Objects.equals(Preferences.userNodeForPackage(cls).get(resourceName, null), md5)) {
Preferences.userNodeForPackage(cls).put(resourceName, md5);
Expand All @@ -74,7 +74,7 @@ private boolean validateResourceChecksum(String resourceName) {
* {@return the project alias}
*/
default String getAlias() {
return getProjectOrThrow().getAlias();
return this.getProjectOrThrow().getAlias();
}

/**
Expand All @@ -83,14 +83,14 @@ default String getAlias() {
* @return the File that represents the model for this project
*/
default File getModelFile() {
return getProjectOrThrow().getModelFile();
return this.getProjectOrThrow().getModelFile();
}

/**
* {@return the resource name that represents the model for this project}
*/
default String getModelResourceName() {
return getProjectOrThrow().getModelResourceName();
return this.getProjectOrThrow().getModelResourceName();
}

/**
Expand All @@ -100,7 +100,7 @@ default String getModelResourceName() {
* @return the File that represents the model for this project
*/
default File getModelFile(ArchitectureModelType modelType) {
return getProjectOrThrow().getModelFile(modelType);
return this.getProjectOrThrow().getModelFile(modelType);
}

/**
Expand All @@ -109,7 +109,7 @@ default File getModelFile(ArchitectureModelType modelType) {
* @param modelType the model type
*/
default String getModelResourceName(ArchitectureModelType modelType) {
return getProjectOrThrow().getModelResourceName(modelType);
return this.getProjectOrThrow().getModelResourceName(modelType);
}

/**
Expand All @@ -118,14 +118,14 @@ default String getModelResourceName(ArchitectureModelType modelType) {
* @return the File that represents the text for this project
*/
default File getTextFile() {
return getProjectOrThrow().getTextFile();
return this.getProjectOrThrow().getTextFile();
}

/**
* {@return the resource name that represents the text for this project}
*/
default String getTextResourceName() {
return getProjectOrThrow().getTextResourceName();
return this.getProjectOrThrow().getTextResourceName();
}

/**
Expand All @@ -134,7 +134,7 @@ default String getTextResourceName() {
* @return the map of additional configuration options
*/
default SortedMap<String, String> getAdditionalConfigurations() {
return getProjectOrThrow().getAdditionalConfigurations();
return this.getProjectOrThrow().getAdditionalConfigurations();
}

/**
Expand All @@ -143,14 +143,14 @@ default SortedMap<String, String> getAdditionalConfigurations() {
* @return the file for additional configurations
*/
default File getAdditionalConfigurationsFile() {
return getProjectOrThrow().getAdditionalConfigurationsFile();
return this.getProjectOrThrow().getAdditionalConfigurationsFile();
}

/**
* {@return the resource name that represents the additional configurations for this project}
*/
default String getAdditionalConfigurationsResourceName() {
return getProjectOrThrow().getAdditionalConfigurationsResourceName();
return this.getProjectOrThrow().getAdditionalConfigurationsResourceName();
}

/**
Expand All @@ -159,14 +159,14 @@ default String getAdditionalConfigurationsResourceName() {
* @return the File that represents the gold standard for this project
*/
default File getTlrGoldStandardFile() {
return getProjectOrThrow().getTlrGoldStandardFile();
return this.getProjectOrThrow().getTlrGoldStandardFile();
}

/**
* {@return the resource name that represents the TLR {@link GoldStandard} for this project}
*/
default String getTlrGoldStandardResourceName() {
return getProjectOrThrow().getTlrGoldStandardResourceName();
return this.getProjectOrThrow().getTlrGoldStandardResourceName();
}

/**
Expand All @@ -175,7 +175,7 @@ default String getTlrGoldStandardResourceName() {
* @return a list with the entries of the goldstandard for TLR
*/
default ImmutableList<String> getTlrGoldStandard() {
return getProjectOrThrow().getTlrGoldStandard();
return this.getProjectOrThrow().getTlrGoldStandard();
}

/**
Expand All @@ -185,39 +185,39 @@ default ImmutableList<String> getTlrGoldStandard() {
* @return the {@link GoldStandard} for this project
*/
default GoldStandard getTlrGoldStandard(ArchitectureModel architectureModel) {
return getProjectOrThrow().getTlrGoldStandard(architectureModel);
return this.getProjectOrThrow().getTlrGoldStandard(architectureModel);
}

default MutableList<String> getMissingTextForModelElementGoldStandard() {
return getProjectOrThrow().getMissingTextForModelElementGoldStandard();
return this.getProjectOrThrow().getMissingTextForModelElementGoldStandard();
}

/**
* {@return the {@link GoldStandard} for this project}
*/
default File getMissingTextForModelElementGoldStandardFile() {
return getProjectOrThrow().getMissingTextForModelElementGoldStandardFile();
return this.getProjectOrThrow().getMissingTextForModelElementGoldStandardFile();
}

/**
* {@return the resource name that represents the MME {@link GoldStandard} for this project}
*/
default String getMissingTextForModelElementGoldStandardResourceName() {
return getProjectOrThrow().getMissingTextForModelElementGoldStandardResourceName();
return this.getProjectOrThrow().getMissingTextForModelElementGoldStandardResourceName();
}

/**
* {@return the expected results for Traceability Link Recovery}
*/
default ExpectedResults getExpectedTraceLinkResults() {
return getProjectOrThrow().getExpectedTraceLinkResults();
return this.getProjectOrThrow().getExpectedTraceLinkResults();
}

/**
* {@return the expected results for Inconsistency Detection}
*/
default ExpectedResults getExpectedInconsistencyResults() {
return getProjectOrThrow().getExpectedInconsistencyResults();
return this.getProjectOrThrow().getExpectedInconsistencyResults();
}

/**
Expand All @@ -226,7 +226,7 @@ default ExpectedResults getExpectedInconsistencyResults() {
* @return the project this instance belongs to
*/
private Project getProjectOrThrow() {
return getFromName().orElseThrow();
return this.getFromName().orElseThrow();
}

/**
Expand All @@ -236,7 +236,7 @@ private Project getProjectOrThrow() {
*/
private Optional<Project> getFromName() {
for (Project project : Project.values()) {
if (project.name().equalsIgnoreCase(getProjectName())) {
if (project.name().equalsIgnoreCase(this.getProjectName())) {
return Optional.of(project);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package edu.kit.kastel.mcse.ardoco.id.tests.integration.inconsistencyhelper;

import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand All @@ -28,7 +27,7 @@
* Produces the inconsistency detection runs. The first run uses all model elements for the baseline. For each subsequent run a single model element is removed
* to simulate a missing model element.
*/
public class HoldBackRunResultsProducer implements Serializable {
public class HoldBackRunResultsProducer {
protected File inputText;
protected File inputModel;
protected SortedMap<String, String> additionalConfigs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity;
import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity;
import edu.kit.kastel.mcse.ardoco.core.api.tracelink.SadSamTraceLink;
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.
Expand All @@ -17,7 +16,6 @@ public ModelElementSentenceLink(SadSamTraceLink traceLink) {
this(traceLink.getArchitectureEntityId(), traceLink.getSentenceNumber());
}

@Internal
public ModelElementSentenceLink(SentenceEntity sentence, ArchitectureEntity architectureEntity) {
this(architectureEntity.getId(), sentence.getSentence().getSentenceNumber());
}
Expand Down

0 comments on commit 6c4ae8e

Please sign in to comment.