Skip to content

Commit

Permalink
refactoring and modularisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hossiphi committed Dec 23, 2020
1 parent 01b9fd8 commit 885d3dd
Show file tree
Hide file tree
Showing 192 changed files with 8,508 additions and 9,047 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ pom.xml.next
release.properties
.classpath
.project
Pipeline/src/main/resources/texts/
Pipeline/evaluations/
34 changes: 34 additions & 0 deletions AnalyzersSolvers/AnalyzerSolverInterfaces/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>edu.kit.ipd.consistency_analyzer</groupId>
<artifactId>AnalyzersSolvers</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>AnalyzerSolverInterfaces</artifactId>
<name>AnalyzerSolverInterfaces</name>
<dependencies>
<dependency>
<groupId>edu.kit.ipd.consistency_analyzer</groupId>
<artifactId>TextDataStructures</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.kit.ipd.consistency_analyzer</groupId>
<artifactId>ConnectionDataStructures</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.kit.ipd.consistency_analyzer</groupId>
<artifactId>ModelDataStructures</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.kit.ipd.consistency_analyzer</groupId>
<artifactId>RecommendationDataStructures</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package modelconnector;
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.parse.luna.graph.INode;
import edu.kit.ipd.consistency_analyzer.datastructures.IWord;

/**
* Parent class of all analyzers. Analyzer are executed on a graph node. They
* are able to get the current state of the textual analysis. Analyzers owe a
* type that classifies them.
*
* @author Sophie
*
*/
public abstract class Analyzer {
public abstract class Analyzer implements IAnalyzer {

protected DependencyType type;

Expand All @@ -19,15 +11,15 @@ public abstract class Analyzer {
*
* @param node the current node
*/
public void exec(INode node) {
}
@Override
public abstract void exec(IWord node);

/**
* Creates a new analyzer of the specified type.
*
* @param type the analyzer type
*/
public Analyzer(DependencyType type) {
protected Analyzer(DependencyType type) {
this.type = type;
}

Expand All @@ -40,4 +32,9 @@ public DependencyType getDependencyType() {
return this.type;
}

}
@Override
public String getName() {
return this.getClass().getSimpleName();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;

public class AnalyzerSolverLoader {

public static <A extends ILoadable> Map<String, A> loadLoadable(Class<A> classA) {

ServiceLoader<A> loader = ServiceLoader.load(classA);

Map<String, A> analyzers = new HashMap<>();

for (A a : loader) {
analyzers.put(a.getName(), a);
}

return analyzers;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import com.sun.tools.jconsole.JConsoleContext.ConnectionState;

import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IWord;

/**
* This class represents an analyzer, that works on the level of the connection
* creation.
*
* @author Sophie
*
*/
public abstract class ConnectionAnalyzer extends Analyzer implements IConnectionAnalyzer {

protected ITextExtractionState textExtractionState;
protected IModelExtractionState modelExtractionState;
protected IRecommendationState recommendationState;
protected ConnectionState connectionState;

/**
* Creates a new analyzer.
*
* @param dependencyType the dependencies of the analyzer
* @param graph the PARSE graph to look up
* @param textExtractionState the text extraction state to look up
* @param modelExtractionState the model extraction state to look up
* @param recommendationState the model extraction state to look up
* @param connectionState the connection state to work with
*/
protected ConnectionAnalyzer(DependencyType dependencyType, ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, //
IRecommendationState recommendationState, ConnectionState connectionState) {
super(dependencyType);
this.textExtractionState = textExtractionState;
this.modelExtractionState = modelExtractionState;
this.recommendationState = recommendationState;
this.connectionState = connectionState;
}

@Override
public abstract void exec(IWord node);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IConnectionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

/**
* The connection solver creates connections between the recommendation state
* and the extraction state.
*
* @author Sophie
*
*/
public abstract class ConnectionSolver extends Solver implements IConnectionSolver {

protected ITextExtractionState textExtractionState;
protected IModelExtractionState modelExtractionState;
protected IRecommendationState recommendationState;
protected IConnectionState connectionState;

/**
* Creates a new solver.
*
* @param dependencyType the dependencies of the analyzer
* @param graph the PARSE graph to look up
* @param textExtractionState the text extraction state to look up
* @param modelExtractionState the model extraction state to look up
* @param recommendationState the model extraction state to look up
* @param connectionState the connection state to work with
*/
protected ConnectionSolver(//
DependencyType dependencyType, ITextExtractionState textExtractionState, //
IModelExtractionState modelExtractionState, IRecommendationState recommendationState, IConnectionState connectionState) {
super(dependencyType);
this.textExtractionState = textExtractionState;
this.modelExtractionState = modelExtractionState;
this.recommendationState = recommendationState;
this.connectionState = connectionState;
}

@Override
public abstract void exec();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package modelconnector;
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

/**
* This class holds different states for objects. This enum can be used for
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IWord;

public interface IAnalyzer extends ILoadable {

void exec(IWord word);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IConnectionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface IConnectionAnalyzer extends IAnalyzer {

IConnectionAnalyzer create(//
ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, //
IRecommendationState recommendationState, IConnectionState connectionState);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IConnectionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface IConnectionSolver extends ISolver {

IConnectionSolver create(//
ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, //
IRecommendationState recommendationState, IConnectionState connectionState);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

public interface ILoadable {

String getName();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface IRecommendationAnalyzer extends IAnalyzer {

IRecommendationAnalyzer create(//
ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, //
IRecommendationState recommendationState);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface IRecommendationSolver extends ISolver {

IRecommendationSolver create(//
ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, //
IRecommendationState recommendationState);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

public interface ISolver extends ILoadable {

void exec();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface ITextAnalyzer extends IAnalyzer {

ITextAnalyzer create(ITextExtractionState textExtractionState);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

public interface ITextSolver extends ISolver {

ITextSolver create(ITextExtractionState textExtractionState);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IWord;

/**
* This class represents all analyzers that create work on recommendations.
*
* @author Sophie
*
*/
public abstract class RecommendationAnalyzer extends Analyzer implements IRecommendationAnalyzer {

protected ITextExtractionState textExtractionState;
protected IModelExtractionState modelExtractionState;
protected IRecommendationState recommendationState;

/**
* Creates a new analyzer.
*
* @param dependencyType the dependencies of the analyzer
* @param graph the PARSE graph to look up
* @param textExtractionState the text extraction state to look up
* @param modelExtractionState the model extraction state to look up
* @param recommendationState the model extraction state to work with
*/
protected RecommendationAnalyzer(//
DependencyType dependencyType, ITextExtractionState textExtractionState, IModelExtractionState modelExtractionState, IRecommendationState recommendationState) {
super(dependencyType);
this.textExtractionState = textExtractionState;
this.modelExtractionState = modelExtractionState;
this.recommendationState = recommendationState;
}

@Override
public abstract void exec(IWord node);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.kit.ipd.consistency_analyzer.analyzers_solvers;

import edu.kit.ipd.consistency_analyzer.datastructures.IModelExtractionState;
import edu.kit.ipd.consistency_analyzer.datastructures.IRecommendationState;
import edu.kit.ipd.consistency_analyzer.datastructures.ITextExtractionState;

/**
* A solver that creates recommendations.
*
* @author Sophie
*
*/
public abstract class RecommendationSolver extends Solver implements IRecommendationSolver {

protected ITextExtractionState textExtractionState;
protected IModelExtractionState modelExtractionState;
protected IRecommendationState recommendationState;

/**
* Creates a new solver.
*
* @param dependencyType the dependencies of the analyzer
* @param graph the PARSE graph to look up
* @param textExtractionState the text extraction state to look up
* @param modelExtractionState the model extraction state to look up
* @param recommendationState the model extraction state to work with
*/
protected RecommendationSolver(//
DependencyType dependencyType, ITextExtractionState textExtractionState, //
IModelExtractionState modelExtractionState, IRecommendationState recommendationState) {
super(dependencyType);
this.textExtractionState = textExtractionState;
this.modelExtractionState = modelExtractionState;
this.recommendationState = recommendationState;
}

@Override
public abstract void exec();
}
Loading

0 comments on commit 885d3dd

Please sign in to comment.