Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive"
}
2 changes: 2 additions & 0 deletions docs/archunit-results/cycles-current-failure-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Cycle count: 0
1 change: 1 addition & 0 deletions docs/archunit-results/layers-current-failure-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No violations - failure report does not exist.
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,19 @@
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
<configuration>
<useModulePath>false</useModulePath>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
12 changes: 12 additions & 0 deletions use-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.bekioui.maven.plugin</groupId>
<artifactId>merge-maven-plugin</artifactId>
Expand Down
8 changes: 5 additions & 3 deletions use-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
exports org.tzi.use.uml.sys;
exports org.tzi.use.util;
exports org.tzi.use.uml.mm.statemachines;
exports org.tzi.use.util.uml.sorting;
exports org.tzi.use.uml.sys.sorting;
exports org.tzi.use.util.collections;
exports org.tzi.use.analysis.coverage;
exports org.tzi.use.uml.mm.commonbehavior.communications;
Expand All @@ -33,13 +33,15 @@
exports org.tzi.use.parser.ocl;
exports org.tzi.use.util.input;
exports org.tzi.use.uml.sys.statemachines;
exports org.tzi.use.util.soil.exceptions;
exports org.tzi.use.uml.sys.ppcHandling;
exports org.tzi.use.uml.sys.testsuite;
exports org.tzi.use.parser.testsuite.sys;
exports org.tzi.use.gen.tool;
exports org.tzi.use.parser.shell;
exports org.tzi.use.parser.testsuite;
exports org.tzi.use.core.test;
exports org.tzi.use.api;
exports org.tzi.use.main;
exports org.tzi.use.parser.generator;
exports org.tzi.use.parser.soil.exceptions;
exports org.tzi.use.parser.soil.environment;
}
5 changes: 4 additions & 1 deletion use-core/src/main/java/org/tzi/use/api/UseModelApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.tzi.use.api;
import org.tzi.use.util.SrcPos;

import org.antlr.runtime.ANTLRInputStream;
import org.antlr.runtime.CommonTokenStream;
Expand All @@ -35,14 +36,16 @@
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.expr.VarDecl;
import org.tzi.use.uml.ocl.expr.VarDeclList;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.uml.ocl.type.EnumType;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
import org.tzi.use.uml.ocl.value.VarBindings;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.NullPrintWriter;
import org.tzi.use.util.StringUtil;
import org.tzi.use.util.soil.exceptions.CompilationFailedException;
import org.tzi.use.parser.soil.exceptions.CompilationFailedException;

import java.io.*;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

package org.tzi.use.uml.mm;
package org.tzi.use.core.test;

import org.tzi.use.api.UseApiException;
import org.tzi.use.api.UseModelApi;
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.mm.MAggregationKind;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -179,7 +181,7 @@ public MModel createModelWithClassAndAssocClass() {

api.createAssociationClass("Job", false,
"Person" , "person" , "0..1", MAggregationKind.NONE,
"Company", "company", "0..1", MAggregationKind.NONE);
"Company", "company", "0..1", MAggregationKind.NONE);

api.createAttribute( "Job", "salary", "Integer" );
return api.getModel();
Expand Down Expand Up @@ -221,9 +223,9 @@ public MModel createModelWithClassAndTenaryAssocClass() {

api.createAssociationClass("Job", false,
new String[] {"Person", "Company", "Salary"},
new String[] {"person", "company", "salary"},
new String[] {"0..1", "0..1", "0..1"},
new int[] {MAggregationKind.NONE, MAggregationKind.NONE, MAggregationKind.NONE});
new String[] {"person", "company", "salary"},
new String[] {"0..1", "0..1", "0..1"},
new int[] {MAggregationKind.NONE, MAggregationKind.NONE, MAggregationKind.NONE});

return api.getModel();
} catch ( UseApiException e ) {
Expand All @@ -249,9 +251,9 @@ public MModel createModelWithClassAndQualifiedAssoc() {
new int[] {MAggregationKind.NONE, MAggregationKind.NONE},
new boolean[] {false, false},
new String[][][] {
new String[][]{new String[] {"accountNr", "String"}},
new String[][]{}}
);
new String[][]{new String[] {"accountNr", "String"}},
new String[][]{}
});

return api.getModel();
} catch ( UseApiException e ) {
Expand All @@ -274,8 +276,8 @@ public MModel createComplexModel() {

// adds an associationclass between Person and Company named Job
api.createAssociationClass("Job", false,
"Person", "employee", "0..1", MAggregationKind.NONE,
"Company", "company", "0..1", MAggregationKind.NONE);
"Person", "employee", "0..1", MAggregationKind.NONE,
"Company", "company", "0..1", MAggregationKind.NONE);

// adds an association between Person itself named isBoss
api.createAssociation( "isBoss",
Expand Down
16 changes: 12 additions & 4 deletions use-core/src/main/java/org/tzi/use/gen/tool/GGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.tzi.use.gen.assl.dynamics.GEvaluationException;
import org.tzi.use.gen.assl.statics.GInstrBarrier;
import org.tzi.use.gen.assl.statics.GProcedure;
import org.tzi.use.parser.generator.ASSLCompiler;
import org.tzi.use.uml.mm.MClassInvariant;
import org.tzi.use.uml.mm.MMPrintVisitor;
import org.tzi.use.uml.mm.MMVisitor;
Expand Down Expand Up @@ -94,7 +93,13 @@ protected void internalError(GEvaluationException e, long randomNr) {
e.printStackTrace();
}
}


private IProcedureCompiler procedureCompiler;

public void setProcedureCompiler(IProcedureCompiler procedureCompiler) {
this.procedureCompiler = procedureCompiler;
}

public void startProcedure(String callstr, GGeneratorArguments args) {
fLastResult = null;
fConfig = args;
Expand All @@ -110,14 +115,17 @@ public void startProcedure(String callstr, GGeneratorArguments args) {

try {
Log.verbose("Compiling procedures from " + fConfig.getFilename() + ".");
fProcedures = ASSLCompiler.compileProcedures(
if (this.procedureCompiler == null) {
throw new IllegalStateException("IProcedureCompiler not set on GGenerator");
}
fProcedures = this.procedureCompiler.compileProcedures(
fSystem.model(),
new FileInputStream(fConfig.getFilename()),
fConfig.getFilename(),
new PrintWriter(System.err) );
if (fProcedures != null) {
Log.verbose("Compiling `" + callstr + "'.");
call = ASSLCompiler.compileProcedureCall(fSystem.model(),
call = this.procedureCompiler.compileProcedureCall(fSystem.model(),
fSystem.state(),
fProcedures,
callstr,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.tzi.use.gen.tool;

import org.tzi.use.gen.assl.statics.GProcedure;
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.sys.MSystemState;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;

/**
* Interface that decoupled generators use to compile ASSL procedures,
* preventing a cyclic architecture dependency between tool packages and parsers.
*/
public interface IProcedureCompiler {
List<GProcedure> compileProcedures(MModel model, InputStream in, String inName, PrintWriter err);
GProcedureCall compileProcedureCall(MModel model, MSystemState systemState, List<GProcedure> procedures, String in, String inName, PrintWriter err);
}
3 changes: 3 additions & 0 deletions use-core/src/main/java/org/tzi/use/parser/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.mm.ModelFactory;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.expr.ExprContext;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.uml.ocl.value.VarBindings;
import org.tzi.use.uml.sys.MSystemState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.tzi.use.gen.tool.GProcedureCall;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.ParseErrorHandler;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.use.ASTConstraintDefinition;
import org.tzi.use.uml.mm.GeneratorModelFactory;
import org.tzi.use.uml.mm.MClassInvariant;
Expand All @@ -47,6 +47,18 @@ public class ASSLCompiler {

private ASSLCompiler() {} // no instances

public static final org.tzi.use.gen.tool.IProcedureCompiler PROCEDURE_COMPILER = new org.tzi.use.gen.tool.IProcedureCompiler() {
@Override
public java.util.List<org.tzi.use.gen.assl.statics.GProcedure> compileProcedures(org.tzi.use.uml.mm.MModel model, java.io.InputStream in, String inName, java.io.PrintWriter err) {
return ASSLCompiler.compileProcedures(model, in, inName, err);
}

@Override
public org.tzi.use.gen.tool.GProcedureCall compileProcedureCall(org.tzi.use.uml.mm.MModel model, org.tzi.use.uml.sys.MSystemState systemState, java.util.List<org.tzi.use.gen.assl.statics.GProcedure> procedures, String in, String inName, java.io.PrintWriter err) {
return ASSLCompiler.compileProcedureCall(model, systemState, procedures, in, inName, err);
}
};

/**
* Compiles generator procedures
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.tzi.use.gen.assl.statics.GProcedure;
import org.tzi.use.gen.tool.GSignature;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.type.Type;

public class ASTGAsslCall extends ASTGInstruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.tzi.use.gen.assl.statics.GInstructionCreator;
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.util.StringUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.mm.MAttribute;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.uml.ocl.type.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.tzi.use.gen.assl.statics.GInstrBarrier;
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.expr.Expression;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.tzi.use.parser.generator;

import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.ocl.expr.Expression;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.mm.MClassInvariant;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.util.StringUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;

public class ASTGIfThenElse extends ASTGInstruction {
private Token fname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;

public abstract class ASTGInstruction extends AST {
public abstract GInstruction gen(Context ctx) throws SemanticException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.tzi.use.gen.assl.statics.GLoop;
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.ocl.ASTVariableDeclaration;
import org.tzi.use.uml.ocl.expr.VarDecl;
import org.tzi.use.uml.ocl.type.SequenceType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;

public class ASTGOpEnter extends ASTGInstruction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.tzi.use.gen.assl.statics.GInstrOpExit;
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;

public class ASTGOpExit extends ASTGInstruction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.tzi.use.gen.assl.statics.GProcedure;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.ocl.ASTVariableDeclaration;
import org.tzi.use.uml.ocl.expr.VarDecl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.tzi.use.gen.tool.GSignature;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.tzi.use.gen.assl.statics.GValueInstruction;
import org.tzi.use.gen.assl.statics.GVariableAssignment;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.type.Type;

public class ASTGVariableAssignment extends ASTGInstruction {
Expand Down
Loading