procedures, String in, String inName, java.io.PrintWriter err) {
+ return ASSLCompiler.compileProcedureCall(model, systemState, procedures, in, inName, err);
+ }
+ };
+
/**
* Compiles generator procedures
*
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAsslCall.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAsslCall.java
index 29d7107f2..d06f5284d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAsslCall.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAsslCall.java
@@ -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 {
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAtomicInstruction.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAtomicInstruction.java
index 6b36c8a48..75719455a 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAtomicInstruction.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAtomicInstruction.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAttributeAssignment.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAttributeAssignment.java
index f3c527941..08ac6eec9 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAttributeAssignment.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGAttributeAssignment.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrier.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrier.java
index 9cf94eb94..f78e7dcfe 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrier.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrier.java
@@ -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;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierExpression.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierExpression.java
index 50c12b6f9..9f9505332 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierExpression.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierInvariant.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierInvariant.java
index 35da7426c..dc8e7710d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierInvariant.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGBarrierInvariant.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGIfThenElse.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGIfThenElse.java
index cfc106bc7..b95dd4aa0 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGIfThenElse.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGIfThenElse.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGInstruction.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGInstruction.java
index 10164b643..811a78b9d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGInstruction.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGInstruction.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGLoop.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGLoop.java
index bcc634d1d..7d4c60974 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGLoop.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGLoop.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpEnter.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpEnter.java
index 0d1acde3a..ca02655bf 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpEnter.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpEnter.java
@@ -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 {
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpExit.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpExit.java
index 8d1044594..bda4d7d9d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpExit.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGOpExit.java
@@ -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 {
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedure.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedure.java
index ed8a4ad9e..5b61f66c0 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedure.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedure.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedureCall.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedureCall.java
index bfe241e1e..4697ff77b 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedureCall.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGProcedureCall.java
@@ -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;
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGVariableAssignment.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGVariableAssignment.java
index 8227a801b..e69993c71 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGVariableAssignment.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGVariableAssignment.java
@@ -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 {
diff --git a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGocl.java b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGocl.java
index c85fd7f41..6daf9c30e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/generator/ASTGocl.java
+++ b/use-core/src/main/java/org/tzi/use/parser/generator/ASTGocl.java
@@ -33,7 +33,7 @@
import org.tzi.use.gen.assl.statics.GInstruction;
import org.tzi.use.gen.assl.statics.GOCLExpression;
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;
public class ASTGocl extends ASTGValueInstruction {
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTAllInstancesExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTAllInstancesExpression.java
index ae811f45d..e4e9d429d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTAllInstancesExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTAllInstancesExpression.java
@@ -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.MClassifier;
import org.tzi.use.uml.ocl.expr.ExpAllInstances;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTBinaryExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTBinaryExpression.java
index d3ab3f704..ae637d5c6 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTBinaryExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTBinaryExpression.java
@@ -23,7 +23,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.ocl.expr.Expression;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionItem.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionItem.java
index 9ac079cf3..290f88636 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionItem.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionItem.java
@@ -23,7 +23,7 @@
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.uml.ocl.expr.ExpRange;
import org.tzi.use.uml.ocl.expr.Expression;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionLiteral.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionLiteral.java
index 17d05cc6c..78dfedb1a 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionLiteral.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionLiteral.java
@@ -26,7 +26,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.ocl.expr.ExpBagLiteral;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.ExpOrderedSetLiteral;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionType.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionType.java
index d8da6a34d..291d56116 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTCollectionType.java
@@ -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.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTElemVarsDeclaration.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTElemVarsDeclaration.java
index e2b86e355..35b2a1a86 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTElemVarsDeclaration.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTElemVarsDeclaration.java
@@ -22,7 +22,7 @@
import org.antlr.runtime.Token;
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.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.expr.VarDecl;
import org.tzi.use.uml.ocl.expr.VarDeclList;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEmptyCollectionLiteral.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEmptyCollectionLiteral.java
index fe16c2143..8a45b3d78 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEmptyCollectionLiteral.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEmptyCollectionLiteral.java
@@ -22,7 +22,7 @@
import java.util.Set;
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.ExpEmptyCollection;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.Expression;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumLiteral.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumLiteral.java
index 2520bdd1a..a56bd6c9b 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumLiteral.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumLiteral.java
@@ -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.ocl.expr.ExpConstEnum;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.EnumType;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumTypeDefinition.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumTypeDefinition.java
index f2da40697..3453b3879 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumTypeDefinition.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTEnumTypeDefinition.java
@@ -24,7 +24,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.parser.use.ASTClassifier;
import org.tzi.use.uml.ocl.type.EnumType;
import org.tzi.use.uml.ocl.type.TypeFactory;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTExpression.java
index 1157bf06f..834917167 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTExpression.java
@@ -28,7 +28,7 @@
import org.antlr.runtime.Token;
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.uml.mm.MClassifier;
import org.tzi.use.uml.mm.MNavigableElement;
import org.tzi.use.uml.ocl.expr.ExpCollect;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIfExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIfExpression.java
index af4fac22f..6954bfbb4 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIfExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIfExpression.java
@@ -23,7 +23,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.ocl.expr.ExpIf;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.Expression;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTInStateExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTInStateExpression.java
index f2bafe8d2..cf53dda3e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTInStateExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTInStateExpression.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.config.Options;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
+import org.tzi.use.uml.ocl.expr.ExprContext;
+import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.uml.mm.statemachines.MProtocolStateMachine;
import org.tzi.use.uml.mm.statemachines.MState;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIterateExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIterateExpression.java
index c92a85a0c..f10f18884 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIterateExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTIterateExpression.java
@@ -24,9 +24,9 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+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.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.ExpIterate;
import org.tzi.use.uml.ocl.expr.ExpVariable;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTLetExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTLetExpression.java
index d8a62d2f8..8c98b485e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTLetExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTLetExpression.java
@@ -23,8 +23,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.ExpLet;
import org.tzi.use.uml.ocl.expr.Expression;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTModelQualifiedType.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTModelQualifiedType.java
index e3dffa593..be039cb5f 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTModelQualifiedType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTModelQualifiedType.java
@@ -2,7 +2,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.ocl.type.Type;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectByUseIdExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectByUseIdExpression.java
index 3a939bcb2..9e2b3b233 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectByUseIdExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectByUseIdExpression.java
@@ -25,7 +25,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.MClass;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.ExpObjectByUseId;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectReferenceExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectReferenceExpression.java
index df68e232a..d7e7c7f00 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectReferenceExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTObjectReferenceExpression.java
@@ -25,7 +25,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.ocl.expr.ExpObjRef;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.sys.MObject;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTOperationExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTOperationExpression.java
index eaa8a26ac..e06b6f424 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTOperationExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTOperationExpression.java
@@ -22,9 +22,9 @@
import org.antlr.runtime.Token;
import org.tzi.use.config.Options;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.uml.ocl.expr.ExprContext;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.ocl.expr.*;
import org.tzi.use.uml.ocl.type.CollectionType;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTQueryExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTQueryExpression.java
index 49e7ec546..a01283b7f 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTQueryExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTQueryExpression.java
@@ -23,9 +23,9 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+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.parser.base.ParserHelper;
import org.tzi.use.uml.ocl.expr.ExpAny;
import org.tzi.use.uml.ocl.expr.ExpClosure;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTSimpleType.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTSimpleType.java
index 657d12618..07b0488f1 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTSimpleType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTSimpleType.java
@@ -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.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleLiteral.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleLiteral.java
index 3484be671..10847341e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleLiteral.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleLiteral.java
@@ -23,7 +23,7 @@
import java.util.Set;
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.ExpTupleLiteral;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.Type;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleType.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleType.java
index c951d6445..2a76df42a 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTupleType.java
@@ -22,7 +22,7 @@
import java.util.List;
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.TupleType;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTType.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTType.java
index d9cf8c376..809e1f79d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTType.java
@@ -22,7 +22,7 @@
import org.antlr.runtime.Token;
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.uml.ocl.type.Type;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTypeArgExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTypeArgExpression.java
index cb5ce1a72..b50079bcb 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTypeArgExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTTypeArgExpression.java
@@ -24,8 +24,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.config.Options;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
+import org.tzi.use.uml.ocl.expr.ExprContext;
+import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.ocl.expr.ExpAsType;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.ExpIsKindOf;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUnaryExpression.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUnaryExpression.java
index 9773501fa..7d0ec07c6 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUnaryExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUnaryExpression.java
@@ -23,7 +23,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.ocl.expr.Expression;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUndefinedLiteral.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUndefinedLiteral.java
index 7ae5aec4b..8062dde7d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUndefinedLiteral.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTUndefinedLiteral.java
@@ -22,7 +22,7 @@
import java.util.Set;
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.ExpUndefined;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.Type;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableDeclaration.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableDeclaration.java
index 862bd741c..100aadedc 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableDeclaration.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableDeclaration.java
@@ -22,7 +22,7 @@
import org.antlr.runtime.Token;
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.uml.ocl.expr.VarDecl;
import org.tzi.use.uml.ocl.type.Type;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableInitialization.java b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableInitialization.java
index 5ede1233f..abccc6001 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableInitialization.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/ASTVariableInitialization.java
@@ -22,7 +22,7 @@
import org.antlr.runtime.Token;
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.uml.ocl.expr.ExpInvalidException;
import org.tzi.use.uml.ocl.expr.VarInitializer;
import org.tzi.use.uml.ocl.type.Type;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ocl/OCLCompiler.java b/use-core/src/main/java/org/tzi/use/parser/ocl/OCLCompiler.java
index 8cc2bb99a..735f256e0 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ocl/OCLCompiler.java
+++ b/use-core/src/main/java/org/tzi/use/parser/ocl/OCLCompiler.java
@@ -24,8 +24,8 @@
import org.antlr.runtime.RecognitionException;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.ParseErrorHandler;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.Type;
diff --git a/use-core/src/main/java/org/tzi/use/parser/shell/ShellCommandCompiler.java b/use-core/src/main/java/org/tzi/use/parser/shell/ShellCommandCompiler.java
index 3a20962cb..6b8304c50 100644
--- a/use-core/src/main/java/org/tzi/use/parser/shell/ShellCommandCompiler.java
+++ b/use-core/src/main/java/org/tzi/use/parser/shell/ShellCommandCompiler.java
@@ -35,8 +35,8 @@
import org.tzi.use.uml.sys.MSystemState;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.Log;
-import org.tzi.use.util.soil.VariableEnvironment;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
@@ -245,7 +245,7 @@ private static MStatement constructStatement(
compiledStatement =
statement.generateStatement(
context,
- variableEnvironment.constructSymbolTable());
+ new org.tzi.use.parser.soil.environment.SymbolTable(variableEnvironment));
} catch (CompilationFailedException e) {
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/SoilCompiler.java b/use-core/src/main/java/org/tzi/use/parser/soil/SoilCompiler.java
index 31b1b0e96..d87597a01 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/SoilCompiler.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/SoilCompiler.java
@@ -34,8 +34,8 @@
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.sys.MSystemState;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.VariableEnvironment;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
@@ -262,7 +262,7 @@ public static MStatement constructStatement(
compiledStatement =
statement.generateStatement(
context,
- variableEnvironment.constructSymbolTable());
+ new org.tzi.use.parser.soil.environment.SymbolTable(variableEnvironment));
} catch (CompilationFailedException e) {
errorOutput.print("Error: ");
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTAttributeAssignmentStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTAttributeAssignmentStatement.java
index f705f3e9c..452a044a0 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTAttributeAssignmentStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTAttributeAssignmentStatement.java
@@ -26,7 +26,7 @@
import org.tzi.use.uml.sys.soil.MAttributeAssignmentStatement;
import org.tzi.use.uml.sys.soil.MRValue;
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.PrintWriter;
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTBlockStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTBlockStatement.java
index 059b7bf0f..3ae71c9f4 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTBlockStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTBlockStatement.java
@@ -27,12 +27,12 @@
import java.util.List;
import org.antlr.runtime.Token;
-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.sys.soil.MBlockStatement;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTConditionalExecutionStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTConditionalExecutionStatement.java
index 59a31b75b..3dd2cfa28 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTConditionalExecutionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTConditionalExecutionStatement.java
@@ -27,7 +27,7 @@
import org.tzi.use.uml.sys.soil.MConditionalExecutionStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEmptyStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEmptyStatement.java
index 692acc88f..9083d7ccf 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEmptyStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEmptyStatement.java
@@ -21,9 +21,9 @@
import java.io.PrintWriter;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.sys.soil.MEmptyStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEnterOperationStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEnterOperationStatement.java
index 6b55711a2..e651e7d6a 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEnterOperationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTEnterOperationStatement.java
@@ -30,7 +30,7 @@
import org.tzi.use.uml.sys.soil.MEnterOperationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTExitOperationStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTExitOperationStatement.java
index 0375e9511..67aeb5e89 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTExitOperationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTExitOperationStatement.java
@@ -26,7 +26,7 @@
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.sys.soil.MExitOperationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTIterationStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTIterationStatement.java
index b3a4a1580..4e0e5ae79 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTIterationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTIterationStatement.java
@@ -32,7 +32,7 @@
import org.tzi.use.uml.sys.soil.MIterationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkDeletionStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkDeletionStatement.java
index ff403a7a0..8677027e3 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkDeletionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkDeletionStatement.java
@@ -29,7 +29,7 @@
import org.tzi.use.uml.sys.soil.MLinkDeletionStatement;
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkInsertionStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkInsertionStatement.java
index 2cd845656..873937d05 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkInsertionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTLinkInsertionStatement.java
@@ -28,7 +28,7 @@
import org.tzi.use.uml.mm.MAssociation;
import org.tzi.use.uml.sys.soil.MLinkInsertionStatement;
import org.tzi.use.uml.sys.soil.MRValue;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewLinkObjectStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewLinkObjectStatement.java
index dc0fa3aa2..92491e91f 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewLinkObjectStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewLinkObjectStatement.java
@@ -27,7 +27,7 @@
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.uml.sys.soil.MStatement;
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.PrintWriter;
import java.util.ArrayList;
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewObjectStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewObjectStatement.java
index 25b65cb64..307e73a75 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewObjectStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTNewObjectStatement.java
@@ -35,7 +35,7 @@
import org.tzi.use.uml.sys.soil.MNewObjectStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
* AST class for a new object statement
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTObjectDestructionStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTObjectDestructionStatement.java
index 0eafe2962..a628b736d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTObjectDestructionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTObjectDestructionStatement.java
@@ -36,7 +36,7 @@
import org.tzi.use.uml.sys.soil.MSequenceStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTOperationCallStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTOperationCallStatement.java
index 6c80da405..969a82225 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTOperationCallStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTOperationCallStatement.java
@@ -33,7 +33,7 @@
import org.tzi.use.uml.sys.soil.library.LibraryOperation;
import org.tzi.use.uml.sys.soil.library.SoilLibrary;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValue.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValue.java
index ae0426fcf..2ba163b9f 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValue.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValue.java
@@ -20,7 +20,7 @@
package org.tzi.use.parser.soil.ast;
import org.tzi.use.uml.sys.soil.MRValue;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueExpressionOrOpCall.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueExpressionOrOpCall.java
index 5be51d377..6e0cf0606 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueExpressionOrOpCall.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueExpressionOrOpCall.java
@@ -24,7 +24,7 @@
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.uml.sys.soil.MRValueExpression;
import org.tzi.use.uml.sys.soil.MRValueOperationCall;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewLinkObject.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewLinkObject.java
index 565850f88..3038ab3f8 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewLinkObject.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewLinkObject.java
@@ -23,7 +23,7 @@
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.uml.sys.soil.MRValueNewLinkObject;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewObject.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewObject.java
index 18e84ba3d..33ddec32a 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewObject.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTRValueNewObject.java
@@ -25,7 +25,7 @@
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.uml.sys.soil.MRValueNewObject;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTSequenceStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTSequenceStatement.java
index fef97fcb1..d12526736 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTSequenceStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTSequenceStatement.java
@@ -30,8 +30,8 @@
import org.tzi.use.uml.sys.soil.MSequenceStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.VariableSet;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.uml.sys.soil.VariableSet;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
@@ -141,7 +141,7 @@ private void checkS2Validity(ASTStatement s2) throws CompilationFailedException
for (Type assignedType : assignedTypes) {
for (Type boundType : boundTypes) {
if (!assignedType.conformsTo(boundType)) {
- ASTStatement cause = fSymtable.getCause(name);
+ ASTStatement cause = (ASTStatement) fSymtable.getCause(name);
throw new CompilationFailedException(
this,
"Statement "
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTStatement.java
index e2cf78ae2..579bd94f2 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTStatement.java
@@ -18,6 +18,7 @@
*/
package org.tzi.use.parser.soil.ast;
+import org.tzi.use.util.SrcPos;
import org.antlr.runtime.Token;
import org.tzi.use.config.Options;
@@ -28,13 +29,15 @@
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.Type;
import org.tzi.use.uml.sys.soil.MRValue;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.SymbolTable;
-import org.tzi.use.util.soil.VariableSet;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.environment.SymbolTable;
+import org.tzi.use.uml.sys.soil.VariableSet;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -385,7 +388,7 @@ private Expression generateExpression(
}
if (symbolTable.isDirty(name)) {
- ASTStatement cause = symbolTable.getCause(name);
+ ASTStatement cause = (ASTStatement) symbolTable.getCause(name);
throw new CompilationFailedException(
this,
"The type of variable " +
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTVariableAssignmentStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTVariableAssignmentStatement.java
index 8508fbc25..17a6c9d76 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTVariableAssignmentStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTVariableAssignmentStatement.java
@@ -29,7 +29,7 @@
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.uml.sys.soil.MVariableAssignmentStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTWhileStatement.java b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTWhileStatement.java
index d78edff7a..6c0617e4b 100644
--- a/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTWhileStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/ast/ASTWhileStatement.java
@@ -28,7 +28,7 @@
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.uml.sys.soil.MWhileStatement;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
public class ASTWhileStatement extends ASTStatement {
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/SymbolTable.java b/use-core/src/main/java/org/tzi/use/parser/soil/environment/SymbolTable.java
similarity index 92%
rename from use-core/src/main/java/org/tzi/use/util/soil/SymbolTable.java
rename to use-core/src/main/java/org/tzi/use/parser/soil/environment/SymbolTable.java
index 8c8eb30ac..3bb54b51d 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/SymbolTable.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/environment/SymbolTable.java
@@ -1,340 +1,347 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil;
-
-
-import org.tzi.use.parser.soil.ast.ASTStatement;
-import org.tzi.use.uml.ocl.type.Type;
-import org.tzi.use.uml.sys.MObject;
-import org.tzi.use.uml.sys.MSystemState;
-
-import java.util.*;
-
-
-/**
- * A symbol table containing mappings from a variable name to a
- * {@link Type type}.
- *
- * Additionally to storing a variable's type, a dirty-bit is maintained, which
- * indicates whether a variable's type is guaranteed to be of the declared type.
- *
- * A variable can become dirty if its type changes to an incompatible type
- * in code which is not guaranteed to be executed, such as branches of a
- * conditional statement or the body of an iteration statement.
- *
- * To keep track of those changes, the state of the symbol table can be
- * {@link #storeState() stored} before entering such code, and
- * {@link #restoreState(ASTStatement) restored} afterwards.
- * After restoring it is checked, whether an assignment of an incompatible
- * type was made.
- *
- * Storing and restoring states uses a stack, which allows arbitrarily nested
- * statements.
- *
- * @author Daniel Gent
- */
-public class SymbolTable {
- /**
- * Entry for the symbol table.
- *
- * @author Daniel Gent
- */
- private class Entry {
- /** the variable's type */
- Type type;
- /** dirty bit */
- boolean isDirty = false;
- /** soil statement causing this entry to be dirty */
- ASTStatement cause = null;
-
-
- /**
- * constructs a new Entry
- *
- * @param type the variable's type
- */
- public Entry(Type type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- if (isDirty) {
- return type + " (DIRTY due to " + ((cause == null) ? "UNKNOWN" : cause) + ")";
- } else {
- return type.toString();
- }
- }
- }
-
- /** the entries */
- private Map fEntries;
- /** the stack of states */
- private Deque> fStates =
- new ArrayDeque>();
-
- //TODO: refactor both to one stack with a proper data object per frame
- /** the stack of explicit/implicit */
- private Deque fExplicitState =
- new ArrayDeque();
-
-
- private MSystemState fVisibleState ;
-
- /**
- * constructs an empty symbol table
- */
- public SymbolTable() {
- fStates.push(new LinkedHashMap());
- fExplicitState.push(Boolean.FALSE);
- fEntries = fStates.peek();
- }
-
- /**
- * constructs an empty symbol table with the visible
- * objects from state
- */
- public SymbolTable(MSystemState visibleState) {
- this();
- fVisibleState = visibleState;
- }
-
- /**
- * construct a symbol table from a {@code VariableEnvironment}
- *
- * @param variableEnvironment a variable environment
- */
- public SymbolTable(VariableEnvironment variableEnvironment) {
- fStates = variableEnvironment.constructSymbolTable().fStates;
- fExplicitState.push(Boolean.FALSE);
-
- }
-
-
- /**
- * removes all states and mappings
- */
- public void clear() {
- fStates.clear();
- fExplicitState.clear();
- fStates.push(new LinkedHashMap());
- fExplicitState.push(Boolean.FALSE);
- fEntries = fStates.peek();
- }
-
-
- /**
- * copies the current state and pushes it to a stack
- *
- * @see SymbolTable#restoreState(ASTStatement)
- */
- public void storeState(Boolean explicit) {
- fStates.push(new LinkedHashMap(fEntries));
- fEntries = fStates.peek();
- fExplicitState.push(explicit);
- }
-
- public void storeState() {
- Boolean b = fExplicitState.peek();
- storeState(b);
- }
-
-
- /**
- * the current state is destroyed and the most recently stored state becomes
- * the new current state
- *
- * additionally the current and the stored state are compared. if the type
- * of a variable has changed from the stored state to the current state,
- * and the type is incompatible (i.e. the new type is not a sub-type of the
- * stored type), the variable is flagged as being dirty, and the supplied
- * soil statement gets blamed.
- *
- * @param cause the soil statement to blame for a variable becoming dirty
- */
- public void restoreState(ASTStatement cause) {
- if (fStates.size() <= 1) {
- return;
- }
-
- Map poppedState = fStates.pop();
- fExplicitState.pop();
- fEntries = fStates.peek();
-
- Set sharedNames = new HashSet(fEntries.keySet());
- sharedNames.retainAll(poppedState.keySet());
-
- for (String name : sharedNames) {
- Entry thisEntry = fEntries.get(name);
- Entry thatEntry = poppedState.get(name);
-
- if (!thatEntry.type.conformsTo(thisEntry.type)) {
- thisEntry.isDirty = true;
- thisEntry.cause = cause;
- } else if (thatEntry.isDirty) {
- thisEntry.isDirty = true;
- thisEntry.cause = thatEntry.cause;
- }
- }
- }
-
-
- /**
- * sets the type of a variable
- *
- * @param name name of the variable
- * @param type type of the variable
- */
- public void setType(String name, Type type) {
- fEntries.put(name, new Entry(type));
- }
-
- /**
- * Returns an entry by looking into the
- * entries constructed by adding elements
- * to the SymTable or if nothing found by
- * looking into the objects of the system sate.
- * @param name
- * @return An entry for name or null.
- */
- private Entry getEntry(String name) {
- Entry entry = fEntries.get(name);
-
- if (entry == null && fVisibleState != null) {
- MObject obj = fVisibleState.objectByName(name);
- if (obj != null)
- return new Entry(obj.cls());
- }
-
- return entry;
- }
- /**
- * returns true if this contains a variable with the specified name
- *
- * @param name the name specifying the variable
- * @return true if this contains a variable with the specified name
- */
- public boolean contains(String name) {
- return getEntry(name) != null;
- }
-
-
- /**
- * returns true if the dirty bit for the specified variable is set
- *
- * @param name the name specifying the variable
- * @return true if the dirty bit for the specified variable is set
- */
- public boolean isDirty(String name) {
- Entry entry = getEntry(name);
-
- if (entry != null) {
- return entry.isDirty;
- }
-
- return false;
- }
-
-
- /**
- * returns the soil statement causing the specified variable to be dirty
- *
- * @param name the name specifying the variable
- * @return the soil statement causing this variable to be dirty or
- * {@code null} if there isn't a variable with the specified name,
- * or the variable is not flagged as dirty
- */
- public ASTStatement getCause(String name) {
- Entry entry = getEntry(name);
-
- if ((entry != null) && (entry.isDirty)) {
- return entry.cause;
- } else {
- return null;
- }
- }
-
-
- /**
- * returns the type of the specified variable
- *
- * @param name the name specifying the variable
- * @return the variable's type or {@code null} if there is no such variable
- */
- public Type getType(String name) {
- Entry entry = getEntry(name);
-
- if (entry != null) {
- return entry.type;
- } else {
- return null;
- }
- }
-
-
- @Override
- public String toString() {
- int numStates = fStates.size();
-
- final String STPRE = "[state ";
- final String STPST = "]\n";
- final String COLON = " : ";
- final String NEWLN = "\n";
- final String EMPTY = "empty\n";
- final String PRELUDE = (numStates > 1) ? " " : "";
-
- StringBuilder sb = new StringBuilder();
-
- int currentState = numStates;
- for (Map state : fStates) {
- if (numStates > 1) {
- sb.append(STPRE);
- sb.append(--currentState);
- sb.append(STPST);
- }
-
- if (state.isEmpty()) {
- sb.append(PRELUDE);
- sb.append(EMPTY);
- }
-
- for (Map.Entry entry : state.entrySet()) {
- String variableName = entry.getKey();
- Entry variableEntry = entry.getValue();
-
- sb.append(PRELUDE);
- sb.append(variableName);
- sb.append(COLON);
- sb.append(variableEntry);
- sb.append(NEWLN);
- }
- }
-
- return sb.toString();
- }
-
- /**
- * @return
- */
- public boolean isExplicit() {
- return fExplicitState.peek();
-}
-
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.parser.soil.environment;
+
+
+
+import org.tzi.use.uml.ocl.type.Type;
+import org.tzi.use.uml.sys.MObject;
+import org.tzi.use.uml.sys.MSystemState;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
+
+import java.util.*;
+
+
+/**
+ * A symbol table containing mappings from a variable name to a
+ * {@link Type type}.
+ *
+ * Additionally to storing a variable's type, a dirty-bit is maintained, which
+ * indicates whether a variable's type is guaranteed to be of the declared type.
+ *
+ * A variable can become dirty if its type changes to an incompatible type
+ * in code which is not guaranteed to be executed, such as branches of a
+ * conditional statement or the body of an iteration statement.
+ *
+ * To keep track of those changes, the state of the symbol table can be
+ * {@link #storeState() stored} before entering such code, and
+ * {@link #restoreState(ASTStatement) restored} afterwards.
+ * After restoring it is checked, whether an assignment of an incompatible
+ * type was made.
+ *
+ * Storing and restoring states uses a stack, which allows arbitrarily nested
+ * statements.
+ *
+ * @author Daniel Gent
+ */
+public class SymbolTable {
+ /**
+ * Entry for the symbol table.
+ *
+ * @author Daniel Gent
+ */
+ private class Entry {
+ /** the variable's type */
+ Type type;
+ /** dirty bit */
+ boolean isDirty = false;
+ /** soil statement causing this entry to be dirty */
+ Object cause = null;
+
+
+ /**
+ * constructs a new Entry
+ *
+ * @param type the variable's type
+ */
+ public Entry(Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ if (isDirty) {
+ return type + " (DIRTY due to " + ((cause == null) ? "UNKNOWN" : cause) + ")";
+ } else {
+ return type.toString();
+ }
+ }
+ }
+
+ /** the entries */
+ private Map fEntries;
+ /** the stack of states */
+ private Deque> fStates =
+ new ArrayDeque>();
+
+ //TODO: refactor both to one stack with a proper data object per frame
+ /** the stack of explicit/implicit */
+ private Deque fExplicitState =
+ new ArrayDeque();
+
+
+ private MSystemState fVisibleState ;
+
+ /**
+ * constructs an empty symbol table
+ */
+ public SymbolTable() {
+ fStates.push(new LinkedHashMap());
+ fExplicitState.push(Boolean.FALSE);
+ fEntries = fStates.peek();
+ }
+
+ /**
+ * constructs an empty symbol table with the visible
+ * objects from state
+ */
+ public SymbolTable(MSystemState visibleState) {
+ this();
+ fVisibleState = visibleState;
+ }
+
+ /**
+ * construct a symbol table from a {@code VariableEnvironment}
+ *
+ * @param variableEnvironment a variable environment
+ */
+ public SymbolTable(VariableEnvironment variableEnvironment) {
+ this();
+ if (variableEnvironment.isObjectVisible()) {
+ fVisibleState = variableEnvironment.getSystemState();
+ }
+
+ for (java.util.Map.Entry entry : variableEnvironment.getCurrentMappings().entrySet()) {
+ String varName = entry.getKey();
+ setType(varName, entry.getValue().type());
+ }
+ }
+
+
+ /**
+ * removes all states and mappings
+ */
+ public void clear() {
+ fStates.clear();
+ fExplicitState.clear();
+ fStates.push(new LinkedHashMap());
+ fExplicitState.push(Boolean.FALSE);
+ fEntries = fStates.peek();
+ }
+
+
+ /**
+ * copies the current state and pushes it to a stack
+ *
+ * @see SymbolTable#restoreState(ASTStatement)
+ */
+ public void storeState(Boolean explicit) {
+ fStates.push(new LinkedHashMap(fEntries));
+ fEntries = fStates.peek();
+ fExplicitState.push(explicit);
+ }
+
+ public void storeState() {
+ Boolean b = fExplicitState.peek();
+ storeState(b);
+ }
+
+
+ /**
+ * the current state is destroyed and the most recently stored state becomes
+ * the new current state
+ *
+ * additionally the current and the stored state are compared. if the type
+ * of a variable has changed from the stored state to the current state,
+ * and the type is incompatible (i.e. the new type is not a sub-type of the
+ * stored type), the variable is flagged as being dirty, and the supplied
+ * soil statement gets blamed.
+ *
+ * @param cause the soil statement to blame for a variable becoming dirty
+ */
+ public void restoreState(Object cause) {
+ if (fStates.size() <= 1) {
+ return;
+ }
+
+ Map poppedState = fStates.pop();
+ fExplicitState.pop();
+ fEntries = fStates.peek();
+
+ Set sharedNames = new HashSet(fEntries.keySet());
+ sharedNames.retainAll(poppedState.keySet());
+
+ for (String name : sharedNames) {
+ Entry thisEntry = fEntries.get(name);
+ Entry thatEntry = poppedState.get(name);
+
+ if (!thatEntry.type.conformsTo(thisEntry.type)) {
+ thisEntry.isDirty = true;
+ thisEntry.cause = cause;
+ } else if (thatEntry.isDirty) {
+ thisEntry.isDirty = true;
+ thisEntry.cause = thatEntry.cause;
+ }
+ }
+ }
+
+
+ /**
+ * sets the type of a variable
+ *
+ * @param name name of the variable
+ * @param type type of the variable
+ */
+ public void setType(String name, Type type) {
+ fEntries.put(name, new Entry(type));
+ }
+
+ /**
+ * Returns an entry by looking into the
+ * entries constructed by adding elements
+ * to the SymTable or if nothing found by
+ * looking into the objects of the system sate.
+ * @param name
+ * @return An entry for name or null.
+ */
+ private Entry getEntry(String name) {
+ Entry entry = fEntries.get(name);
+
+ if (entry == null && fVisibleState != null) {
+ MObject obj = fVisibleState.objectByName(name);
+ if (obj != null)
+ return new Entry(obj.cls());
+ }
+
+ return entry;
+ }
+ /**
+ * returns true if this contains a variable with the specified name
+ *
+ * @param name the name specifying the variable
+ * @return true if this contains a variable with the specified name
+ */
+ public boolean contains(String name) {
+ return getEntry(name) != null;
+ }
+
+
+ /**
+ * returns true if the dirty bit for the specified variable is set
+ *
+ * @param name the name specifying the variable
+ * @return true if the dirty bit for the specified variable is set
+ */
+ public boolean isDirty(String name) {
+ Entry entry = getEntry(name);
+
+ if (entry != null) {
+ return entry.isDirty;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * returns the soil statement causing the specified variable to be dirty
+ *
+ * @param name the name specifying the variable
+ * @return the soil statement causing this variable to be dirty or
+ * {@code null} if there isn't a variable with the specified name,
+ * or the variable is not flagged as dirty
+ */
+ public Object getCause(String name) {
+ Entry entry = getEntry(name);
+
+ if ((entry != null) && (entry.isDirty)) {
+ return entry.cause;
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * returns the type of the specified variable
+ *
+ * @param name the name specifying the variable
+ * @return the variable's type or {@code null} if there is no such variable
+ */
+ public Type getType(String name) {
+ Entry entry = getEntry(name);
+
+ if (entry != null) {
+ return entry.type;
+ } else {
+ return null;
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ int numStates = fStates.size();
+
+ final String STPRE = "[state ";
+ final String STPST = "]\n";
+ final String COLON = " : ";
+ final String NEWLN = "\n";
+ final String EMPTY = "empty\n";
+ final String PRELUDE = (numStates > 1) ? " " : "";
+
+ StringBuilder sb = new StringBuilder();
+
+ int currentState = numStates;
+ for (Map state : fStates) {
+ if (numStates > 1) {
+ sb.append(STPRE);
+ sb.append(--currentState);
+ sb.append(STPST);
+ }
+
+ if (state.isEmpty()) {
+ sb.append(PRELUDE);
+ sb.append(EMPTY);
+ }
+
+ for (Map.Entry entry : state.entrySet()) {
+ String variableName = entry.getKey();
+ Entry variableEntry = entry.getValue();
+
+ sb.append(PRELUDE);
+ sb.append(variableName);
+ sb.append(COLON);
+ sb.append(variableEntry);
+ sb.append(NEWLN);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * @return
+ */
+ public boolean isExplicit() {
+ return fExplicitState.peek();
+}
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/exceptions/CompilationFailedException.java b/use-core/src/main/java/org/tzi/use/parser/soil/exceptions/CompilationFailedException.java
similarity index 93%
rename from use-core/src/main/java/org/tzi/use/util/soil/exceptions/CompilationFailedException.java
rename to use-core/src/main/java/org/tzi/use/parser/soil/exceptions/CompilationFailedException.java
index b43d2abda..66986bcaa 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/exceptions/CompilationFailedException.java
+++ b/use-core/src/main/java/org/tzi/use/parser/soil/exceptions/CompilationFailedException.java
@@ -1,84 +1,84 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil.exceptions;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.parser.soil.ast.ASTStatement;
-
-
-/**
- * This exception is used if a soil statement
- * could not be "compiled".
- * @author Daniel Gent
- * @author Lars Hamann
- */
-public class CompilationFailedException extends Exception {
- private static final long serialVersionUID = 1L;
-
- /** The source position, if any of the failed statement **/
- private SrcPos sourcePosition;
-
- /**
- * Constructs a new exception using the AST of the statement failed to be compiled and a message.
- * @param statement The AST of the failed statement.
- * @param message A user defined message.
- */
- public CompilationFailedException(
- ASTStatement statement,
- String message) {
-
- super(message);
- sourcePosition = statement.getSourcePosition();
- }
-
-
- /**
- * Constructs a new exception using the AST of the statement failed to be
- * compiled, a message and the original cause.
- * @param statement The AST of the failed statement.
- * @param message A user defined message.
- */
- public CompilationFailedException(
- ASTStatement statement,
- String message,
- Throwable cause) {
-
- super(message, cause);
- sourcePosition = statement.getSourcePosition();
- }
-
- @Override
- public String getMessage() {
- return getMessage(false);
- }
-
- public String getMessage(boolean includePositionInfomation) {
- if (!includePositionInfomation) return super.getMessage();
-
- String locationString;
- if (sourcePosition != null) {
- locationString = sourcePosition.toString();
- } else {
- locationString = "";
- }
-
- return locationString + super.getMessage();
- }
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.parser.soil.exceptions;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.parser.soil.ast.ASTStatement;
+
+
+/**
+ * This exception is used if a soil statement
+ * could not be "compiled".
+ * @author Daniel Gent
+ * @author Lars Hamann
+ */
+public class CompilationFailedException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ /** The source position, if any of the failed statement **/
+ private SrcPos sourcePosition;
+
+ /**
+ * Constructs a new exception using the AST of the statement failed to be compiled and a message.
+ * @param statement The AST of the failed statement.
+ * @param message A user defined message.
+ */
+ public CompilationFailedException(
+ ASTStatement statement,
+ String message) {
+
+ super(message);
+ sourcePosition = statement.getSourcePosition();
+ }
+
+
+ /**
+ * Constructs a new exception using the AST of the statement failed to be
+ * compiled, a message and the original cause.
+ * @param statement The AST of the failed statement.
+ * @param message A user defined message.
+ */
+ public CompilationFailedException(
+ ASTStatement statement,
+ String message,
+ Throwable cause) {
+
+ super(message, cause);
+ sourcePosition = statement.getSourcePosition();
+ }
+
+ @Override
+ public String getMessage() {
+ return getMessage(false);
+ }
+
+ public String getMessage(boolean includePositionInfomation) {
+ if (!includePositionInfomation) return super.getMessage();
+
+ String locationString;
+ if (sourcePosition != null) {
+ locationString = sourcePosition.toString();
+ } else {
+ locationString = "";
+ }
+
+ return locationString + super.getMessage();
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssert.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssert.java
index b96bacf45..bb0a7aecc 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssert.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssert.java
@@ -5,9 +5,9 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.sys.testsuite.MAssert;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.parser.testsuite.sys.MAssert;
public abstract class ASTAssert extends AST {
private Token start;
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertClassInvariants.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertClassInvariants.java
index 3fe59cfa1..89120e348 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertClassInvariants.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertClassInvariants.java
@@ -2,10 +2,10 @@
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.MClass;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertClassInvariants;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertClassInvariants;
public class ASTAssertClassInvariants extends ASTAssert {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertGlobalInvariants.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertGlobalInvariants.java
index 2ad6f431d..1df6cb087 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertGlobalInvariants.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertGlobalInvariants.java
@@ -2,9 +2,9 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertGlobalInvariants;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertGlobalInvariants;
public class ASTAssertGlobalInvariants extends ASTAssert {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertOclExpression.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertOclExpression.java
index 52bf7bc91..81782fedd 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertOclExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertOclExpression.java
@@ -2,12 +2,12 @@
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.parser.ocl.ASTExpression;
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.type.TypeFactory;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertOclExpression;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertOclExpression;
public class ASTAssertOclExpression extends ASTAssert {
private ASTExpression expression;
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPost.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPost.java
index 4c8eb22ed..66bde1299 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPost.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPost.java
@@ -2,11 +2,11 @@
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.MPrePostCondition;
import org.tzi.use.uml.sys.MOperationCall;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertPost;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertPost;
public class ASTAssertPost extends ASTAssert {
private Token conditionName = null;
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPre.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPre.java
index 284caefd8..2969d48dd 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPre.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertPre.java
@@ -5,7 +5,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.parser.ocl.ASTExpression;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.uml.mm.MOperation;
@@ -13,8 +13,8 @@
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.ocl.expr.VarDeclList;
import org.tzi.use.uml.ocl.type.Type;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertPre;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertPre;
public class ASTAssertPre extends ASTAssert {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertSingleInvariant.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertSingleInvariant.java
index c59990adc..0b52df48b 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertSingleInvariant.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTAssertSingleInvariant.java
@@ -2,11 +2,11 @@
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.MClass;
import org.tzi.use.uml.mm.MClassInvariant;
-import org.tzi.use.uml.sys.testsuite.MAssert;
-import org.tzi.use.uml.sys.testsuite.MAssertSingleInvariant;
+import org.tzi.use.parser.testsuite.sys.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssertSingleInvariant;
public class ASTAssertSingleInvariant extends ASTAssert {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestCase.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestCase.java
index 04e4cd9c7..a74b200ad 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestCase.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestCase.java
@@ -8,7 +8,7 @@
import org.antlr.runtime.Token;
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.soil.ast.ASTStatement;
import org.tzi.use.uml.ocl.expr.EvalContext;
import org.tzi.use.uml.sys.MSystem;
@@ -16,9 +16,9 @@
import org.tzi.use.uml.sys.MSystemState;
import org.tzi.use.uml.sys.soil.MExitOperationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.uml.sys.testsuite.MAssert;
+import org.tzi.use.parser.testsuite.sys.MAssert;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
public class ASTTestCase extends AST {
public enum TestResult {
@@ -78,7 +78,7 @@ public TestResult execute(MSystem system) throws SemanticException, MSystemExcep
MStatement mCmd;
try {
- mCmd = astCmd.generateStatement(ctx, system.getVariableEnvironment().constructSymbolTable());
+ mCmd = astCmd.generateStatement(ctx, new org.tzi.use.parser.soil.environment.SymbolTable(system.getVariableEnvironment()));
} catch (CompilationFailedException e) {
failureDetails = "Line " + astCmd.getSourcePosition().line() + ": " + astCmd.toString() + " command failed: " + e.getMessage();
return TestResult.ERROR;
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestSuite.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestSuite.java
index ece11f7e6..1b92467af 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestSuite.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTTestSuite.java
@@ -5,9 +5,9 @@
import org.antlr.runtime.Token;
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.soil.ast.ASTStatement;
-import org.tzi.use.uml.sys.testsuite.MTestSuite;
+import org.tzi.use.parser.testsuite.sys.MTestSuite;
public class ASTTestSuite extends AST {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariation.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariation.java
index fc484806e..77eda6aca 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariation.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariation.java
@@ -22,8 +22,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.sys.testsuite.MVariation;
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.parser.testsuite.sys.MVariation;
public abstract class ASTVariation extends AST {
protected SrcPos position;
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationEnd.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationEnd.java
index 7b462681a..b77f79c4e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationEnd.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationEnd.java
@@ -2,8 +2,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.uml.sys.testsuite.MVariation;
-import org.tzi.use.uml.sys.testsuite.MVariationEnd;
+import org.tzi.use.parser.testsuite.sys.MVariation;
+import org.tzi.use.parser.testsuite.sys.MVariationEnd;
public class ASTVariationEnd extends ASTVariation {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationStart.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationStart.java
index 2872c5ff8..499b6dd92 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationStart.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/ASTVariationStart.java
@@ -2,8 +2,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.uml.sys.testsuite.MVariation;
-import org.tzi.use.uml.sys.testsuite.MVariationStart;
+import org.tzi.use.parser.testsuite.sys.MVariation;
+import org.tzi.use.parser.testsuite.sys.MVariationStart;
public class ASTVariationStart extends ASTVariation {
public ASTVariationStart(Token start) {
diff --git a/use-core/src/main/java/org/tzi/use/parser/testsuite/TestSuiteCompiler.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/TestSuiteCompiler.java
index d7d0f9bdf..e1df0660c 100644
--- a/use-core/src/main/java/org/tzi/use/parser/testsuite/TestSuiteCompiler.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/TestSuiteCompiler.java
@@ -10,9 +10,9 @@
import org.antlr.runtime.RecognitionException;
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.uml.mm.MModel;
-import org.tzi.use.uml.sys.testsuite.MTestSuite;
+import org.tzi.use.parser.testsuite.sys.MTestSuite;
public class TestSuiteCompiler {
// utility class
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssert.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssert.java
similarity index 89%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssert.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssert.java
index 0cf701c88..bf24c4c0a 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssert.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssert.java
@@ -1,41 +1,41 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.uml.sys.MSystemException;
-
-public abstract class MAssert {
- private String expressionString;
- private String message;
- private SrcPos position;
- private boolean shouldBeValid;
-
- public MAssert(SrcPos position, String expressionString, String message, boolean shouldBeValid) {
- this.position = position;
- this.expressionString = expressionString;
- this.message = (message == null ? null : message.substring(1, message.length() - 1));
- this.shouldBeValid = shouldBeValid;
- }
-
- public String getExpressionString() {
- return expressionString;
- }
-
- public SrcPos getPosition() {
- return this.position;
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public boolean shouldBeValid() {
- return this.shouldBeValid;
- }
-
- protected abstract boolean doEval(EvalContext ctx) throws MSystemException;
-
- public boolean eval(EvalContext ctx) throws MSystemException {
- return shouldBeValid == doEval(ctx);
- }
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.uml.sys.MSystemException;
+
+public abstract class MAssert {
+ private String expressionString;
+ private String message;
+ private SrcPos position;
+ private boolean shouldBeValid;
+
+ public MAssert(SrcPos position, String expressionString, String message, boolean shouldBeValid) {
+ this.position = position;
+ this.expressionString = expressionString;
+ this.message = (message == null ? null : message.substring(1, message.length() - 1));
+ this.shouldBeValid = shouldBeValid;
+ }
+
+ public String getExpressionString() {
+ return expressionString;
+ }
+
+ public SrcPos getPosition() {
+ return this.position;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public boolean shouldBeValid() {
+ return this.shouldBeValid;
+ }
+
+ protected abstract boolean doEval(EvalContext ctx) throws MSystemException;
+
+ public boolean eval(EvalContext ctx) throws MSystemException {
+ return shouldBeValid == doEval(ctx);
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertClassInvariants.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertClassInvariants.java
similarity index 88%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertClassInvariants.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertClassInvariants.java
index c146cb84b..c2b5e21d4 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertClassInvariants.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertClassInvariants.java
@@ -1,40 +1,40 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.mm.MClass;
-import org.tzi.use.uml.mm.MClassInvariant;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.util.NullWriter;
-
-public class MAssertClassInvariants extends MAssert {
-
- private MClass cls;
-
- public MAssertClassInvariants(SrcPos position, String expressionString, String message, boolean shouldBeValid, MClass cls) {
- super(position, expressionString, message, shouldBeValid);
- this.cls = cls;
- }
-
- public MClass getMClass() {
- return cls;
- }
-
- @Override
- protected boolean doEval(EvalContext ctx) {
- List invs = new ArrayList();
-
- for (MClassInvariant inv : cls.model().allClassInvariants(cls)) {
- invs.add(inv.toString());
- }
-
- return ctx.postState().check(new PrintWriter(new NullWriter()),
- false,
- false,
- false, invs);
- }
-
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.mm.MClass;
+import org.tzi.use.uml.mm.MClassInvariant;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.util.NullWriter;
+
+public class MAssertClassInvariants extends MAssert {
+
+ private MClass cls;
+
+ public MAssertClassInvariants(SrcPos position, String expressionString, String message, boolean shouldBeValid, MClass cls) {
+ super(position, expressionString, message, shouldBeValid);
+ this.cls = cls;
+ }
+
+ public MClass getMClass() {
+ return cls;
+ }
+
+ @Override
+ protected boolean doEval(EvalContext ctx) {
+ List invs = new ArrayList();
+
+ for (MClassInvariant inv : cls.model().allClassInvariants(cls)) {
+ invs.add(inv.toString());
+ }
+
+ return ctx.postState().check(new PrintWriter(new NullWriter()),
+ false,
+ false,
+ false, invs);
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertGlobalInvariants.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertGlobalInvariants.java
similarity index 84%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertGlobalInvariants.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertGlobalInvariants.java
index ada529e45..d9e51ba8b 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertGlobalInvariants.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertGlobalInvariants.java
@@ -1,24 +1,24 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.io.PrintWriter;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.util.NullWriter;
-
-public class MAssertGlobalInvariants extends MAssert {
-
- public MAssertGlobalInvariants(SrcPos position, String expressionString,
- String message, boolean shouldBeValid) {
- super(position, expressionString, message, shouldBeValid);
- }
-
- @Override
- protected boolean doEval(EvalContext ctx) {
- return ctx.postState().check(new PrintWriter(new NullWriter()),
- false,
- false,
- true, null);
- }
-
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.io.PrintWriter;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.util.NullWriter;
+
+public class MAssertGlobalInvariants extends MAssert {
+
+ public MAssertGlobalInvariants(SrcPos position, String expressionString,
+ String message, boolean shouldBeValid) {
+ super(position, expressionString, message, shouldBeValid);
+ }
+
+ @Override
+ protected boolean doEval(EvalContext ctx) {
+ return ctx.postState().check(new PrintWriter(new NullWriter()),
+ false,
+ false,
+ true, null);
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertOclExpression.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertOclExpression.java
similarity index 87%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertOclExpression.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertOclExpression.java
index 520e7b999..4783f3afd 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertOclExpression.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertOclExpression.java
@@ -1,26 +1,26 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.uml.ocl.expr.Expression;
-import org.tzi.use.uml.ocl.value.BooleanValue;
-import org.tzi.use.uml.ocl.value.Value;
-
-public class MAssertOclExpression extends MAssert {
- private Expression expression;
-
- public MAssertOclExpression(SrcPos position, String expressionString, String message, boolean shouldBeValid, Expression expression) {
- super(position, expressionString, message, shouldBeValid);
- this.expression = expression;
- }
-
- protected boolean doEval(EvalContext ctx)
- {
- Value v = this.expression.eval(ctx);
-
- if (v.isBoolean())
- return ((BooleanValue)v).value();
- else
- return false;
- }
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.uml.ocl.expr.Expression;
+import org.tzi.use.uml.ocl.value.BooleanValue;
+import org.tzi.use.uml.ocl.value.Value;
+
+public class MAssertOclExpression extends MAssert {
+ private Expression expression;
+
+ public MAssertOclExpression(SrcPos position, String expressionString, String message, boolean shouldBeValid, Expression expression) {
+ super(position, expressionString, message, shouldBeValid);
+ this.expression = expression;
+ }
+
+ protected boolean doEval(EvalContext ctx)
+ {
+ Value v = this.expression.eval(ctx);
+
+ if (v.isBoolean())
+ return ((BooleanValue)v).value();
+ else
+ return false;
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPost.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPost.java
similarity index 93%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPost.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPost.java
index f725460e2..cfd12e01d 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPost.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPost.java
@@ -1,72 +1,72 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.mm.MOperation;
-import org.tzi.use.uml.mm.MPrePostCondition;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.uml.ocl.expr.Evaluator;
-import org.tzi.use.uml.ocl.expr.Expression;
-import org.tzi.use.uml.ocl.value.BooleanValue;
-import org.tzi.use.uml.ocl.value.Value;
-import org.tzi.use.uml.ocl.value.VarBindings;
-import org.tzi.use.uml.sys.MOperationCall;
-import org.tzi.use.uml.sys.MSystemException;
-
-public class MAssertPost extends MAssert {
-
- private MPrePostCondition singleCondition = null;
-
- public MAssertPost(SrcPos position, String expressionString,
- String message, boolean shouldBeValid) {
- super(position, expressionString, message, shouldBeValid);
-
- }
-
- public void setCondition(MPrePostCondition condition) {
- this.singleCondition = condition;
- }
-
- @Override
- protected boolean doEval(EvalContext ctx) throws MSystemException {
- MOperationCall opcall = ctx.postState().system().getLastOperationCall();
- if (opcall == null )
- throw new MSystemException("Call stack is empty.");
-
- MOperation op = opcall.getOperation();
-
- // bind result value to result variable
- VarBindings vb = opcall.getVarBindings();
- if (op.hasResultType() ) {
- vb.push("result", opcall.getResultValue());
- }
-
- // check postconditions
- boolean postOk = true;
- List postconds;
-
- if (this.singleCondition == null) {
- postconds = op.postConditions();
- } else {
- postconds = new ArrayList();
- postconds.add(this.singleCondition);
- }
-
- for (MPrePostCondition ppc : postconds) {
- Expression expr = ppc.expression();
- Evaluator evaluator = new Evaluator();
- // evaluate in scope local to operation
- Value v = evaluator.eval(expr, opcall.getPreState(), ctx.postState(), vb, null);
- boolean ok = v.isDefined() && ((BooleanValue) v).isTrue();
-
- if (! ok ) {
- postOk = false;
- }
- }
-
- return postOk;
- }
-
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.mm.MOperation;
+import org.tzi.use.uml.mm.MPrePostCondition;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.uml.ocl.expr.Evaluator;
+import org.tzi.use.uml.ocl.expr.Expression;
+import org.tzi.use.uml.ocl.value.BooleanValue;
+import org.tzi.use.uml.ocl.value.Value;
+import org.tzi.use.uml.ocl.value.VarBindings;
+import org.tzi.use.uml.sys.MOperationCall;
+import org.tzi.use.uml.sys.MSystemException;
+
+public class MAssertPost extends MAssert {
+
+ private MPrePostCondition singleCondition = null;
+
+ public MAssertPost(SrcPos position, String expressionString,
+ String message, boolean shouldBeValid) {
+ super(position, expressionString, message, shouldBeValid);
+
+ }
+
+ public void setCondition(MPrePostCondition condition) {
+ this.singleCondition = condition;
+ }
+
+ @Override
+ protected boolean doEval(EvalContext ctx) throws MSystemException {
+ MOperationCall opcall = ctx.postState().system().getLastOperationCall();
+ if (opcall == null )
+ throw new MSystemException("Call stack is empty.");
+
+ MOperation op = opcall.getOperation();
+
+ // bind result value to result variable
+ VarBindings vb = opcall.getVarBindings();
+ if (op.hasResultType() ) {
+ vb.push("result", opcall.getResultValue());
+ }
+
+ // check postconditions
+ boolean postOk = true;
+ List postconds;
+
+ if (this.singleCondition == null) {
+ postconds = op.postConditions();
+ } else {
+ postconds = new ArrayList();
+ postconds.add(this.singleCondition);
+ }
+
+ for (MPrePostCondition ppc : postconds) {
+ Expression expr = ppc.expression();
+ Evaluator evaluator = new Evaluator();
+ // evaluate in scope local to operation
+ Value v = evaluator.eval(expr, opcall.getPreState(), ctx.postState(), vb, null);
+ boolean ok = v.isDefined() && ((BooleanValue) v).isTrue();
+
+ if (! ok ) {
+ postOk = false;
+ }
+ }
+
+ return postOk;
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPre.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPre.java
similarity index 92%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPre.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPre.java
index 4974943c1..42f903692 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertPre.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertPre.java
@@ -1,77 +1,77 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.mm.MOperation;
-import org.tzi.use.uml.mm.MPrePostCondition;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.uml.ocl.expr.Evaluator;
-import org.tzi.use.uml.ocl.expr.Expression;
-import org.tzi.use.uml.ocl.value.BooleanValue;
-import org.tzi.use.uml.ocl.value.ObjectValue;
-import org.tzi.use.uml.ocl.value.Value;
-import org.tzi.use.uml.ocl.value.VarBindings;
-import org.tzi.use.util.soil.VariableEnvironment;
-
-public class MAssertPre extends MAssert {
-
- private Expression objectExpr;
- private MOperation operation;
- private Expression[] args;
- private MPrePostCondition singleCondition;
-
- public MAssertPre(SrcPos position, String expressionString, String message,
- boolean shouldBeValid, Expression objectExpr, MOperation operation, Expression[] args) {
- super(position, expressionString, message, shouldBeValid);
-
- this.objectExpr = objectExpr;
- this.operation = operation;
- this.args = args;
- }
-
- public void setCondition(MPrePostCondition cnd) {
- this.singleCondition = cnd;
- }
-
- @Override
- protected boolean doEval(EvalContext ctx) {
- // check preconditions
- boolean preOk = true;
- MOperation op = this.operation;
- List preconds;
-
- if (this.singleCondition == null) {
- preconds = op.preConditions();
- } else {
- preconds = new ArrayList();
- preconds.add(this.singleCondition);
- }
-
- VariableEnvironment e = ctx.preState().system().getVariableEnvironment();
- e.pushFrame(false);
- ObjectValue self = (ObjectValue)objectExpr.eval(ctx);
- e.assign("self", self);
- Value[] argsValues = new Value[args.length];
- for (int i = 0; i < args.length; ++i) {
- argsValues[i] = args[i].eval(ctx);
- e.assign(this.operation.paramNames().get(i), argsValues[i]);
- }
- VarBindings b = e.constructVarBindings();
-
- for (MPrePostCondition ppc : preconds) {
- Expression expr = ppc.expression();
- Evaluator evaluator = new Evaluator();
- // evaluate in scope local to operation
- Value v = evaluator.eval(expr, ctx.postState(), b);
- boolean ok = v.isDefined() && ((BooleanValue) v).isTrue();
-
- if (! ok )
- preOk = false;
- }
- e.popFrame();
- return preOk;
- }
-
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.mm.MOperation;
+import org.tzi.use.uml.mm.MPrePostCondition;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.uml.ocl.expr.Evaluator;
+import org.tzi.use.uml.ocl.expr.Expression;
+import org.tzi.use.uml.ocl.value.BooleanValue;
+import org.tzi.use.uml.ocl.value.ObjectValue;
+import org.tzi.use.uml.ocl.value.Value;
+import org.tzi.use.uml.ocl.value.VarBindings;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
+
+public class MAssertPre extends MAssert {
+
+ private Expression objectExpr;
+ private MOperation operation;
+ private Expression[] args;
+ private MPrePostCondition singleCondition;
+
+ public MAssertPre(SrcPos position, String expressionString, String message,
+ boolean shouldBeValid, Expression objectExpr, MOperation operation, Expression[] args) {
+ super(position, expressionString, message, shouldBeValid);
+
+ this.objectExpr = objectExpr;
+ this.operation = operation;
+ this.args = args;
+ }
+
+ public void setCondition(MPrePostCondition cnd) {
+ this.singleCondition = cnd;
+ }
+
+ @Override
+ protected boolean doEval(EvalContext ctx) {
+ // check preconditions
+ boolean preOk = true;
+ MOperation op = this.operation;
+ List preconds;
+
+ if (this.singleCondition == null) {
+ preconds = op.preConditions();
+ } else {
+ preconds = new ArrayList();
+ preconds.add(this.singleCondition);
+ }
+
+ VariableEnvironment e = ctx.preState().system().getVariableEnvironment();
+ e.pushFrame(false);
+ ObjectValue self = (ObjectValue)objectExpr.eval(ctx);
+ e.assign("self", self);
+ Value[] argsValues = new Value[args.length];
+ for (int i = 0; i < args.length; ++i) {
+ argsValues[i] = args[i].eval(ctx);
+ e.assign(this.operation.paramNames().get(i), argsValues[i]);
+ }
+ VarBindings b = e.constructVarBindings();
+
+ for (MPrePostCondition ppc : preconds) {
+ Expression expr = ppc.expression();
+ Evaluator evaluator = new Evaluator();
+ // evaluate in scope local to operation
+ Value v = evaluator.eval(expr, ctx.postState(), b);
+ boolean ok = v.isDefined() && ((BooleanValue) v).isTrue();
+
+ if (! ok )
+ preOk = false;
+ }
+ e.popFrame();
+ return preOk;
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertSingleInvariant.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertSingleInvariant.java
similarity index 88%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertSingleInvariant.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertSingleInvariant.java
index 9c0795255..ef8855092 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MAssertSingleInvariant.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MAssertSingleInvariant.java
@@ -1,33 +1,33 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.mm.MClassInvariant;
-import org.tzi.use.uml.ocl.expr.EvalContext;
-import org.tzi.use.util.NullWriter;
-
-public class MAssertSingleInvariant extends MAssert {
-
- private MClassInvariant invariant;
-
- public MAssertSingleInvariant(SrcPos position, String expressionString, String message, boolean shouldBeValid, MClassInvariant inv) {
- super(position, expressionString, message, shouldBeValid);
- this.invariant = inv;
- }
-
- @Override
- protected boolean doEval(EvalContext ctx) {
-
- List invs = new ArrayList();
- invs.add(invariant.toString());
-
- return ctx.postState().check(new PrintWriter(new NullWriter()),
- false,
- false,
- false, invs);
- }
-
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.mm.MClassInvariant;
+import org.tzi.use.uml.ocl.expr.EvalContext;
+import org.tzi.use.util.NullWriter;
+
+public class MAssertSingleInvariant extends MAssert {
+
+ private MClassInvariant invariant;
+
+ public MAssertSingleInvariant(SrcPos position, String expressionString, String message, boolean shouldBeValid, MClassInvariant inv) {
+ super(position, expressionString, message, shouldBeValid);
+ this.invariant = inv;
+ }
+
+ @Override
+ protected boolean doEval(EvalContext ctx) {
+
+ List invs = new ArrayList();
+ invs.add(invariant.toString());
+
+ return ctx.postState().check(new PrintWriter(new NullWriter()),
+ false,
+ false,
+ false, invs);
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MTestSuite.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MTestSuite.java
similarity index 91%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MTestSuite.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MTestSuite.java
index 083bf596a..2bb8b91f2 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MTestSuite.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MTestSuite.java
@@ -1,164 +1,164 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import java.io.PrintWriter;
-import java.util.List;
-
-import org.antlr.runtime.Token;
-import org.tzi.use.parser.Context;
-import org.tzi.use.parser.soil.ast.ASTStatement;
-import org.tzi.use.parser.testsuite.ASTTestCase;
-import org.tzi.use.parser.testsuite.ASTTestCase.TestResult;
-import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.sys.MOperationCall;
-import org.tzi.use.uml.sys.MSystem;
-import org.tzi.use.uml.sys.MSystemException;
-import org.tzi.use.uml.sys.ppcHandling.PPCHandler;
-import org.tzi.use.uml.sys.ppcHandling.PostConditionCheckFailedException;
-import org.tzi.use.uml.sys.ppcHandling.PreConditionCheckFailedException;
-import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.NullWriter;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
-
-public class MTestSuite {
- private Token name;
- private MModel model;
-
- private List setupStatements;
- private List testCases;
-
- private PrintWriter output = null;
-
- public MTestSuite(Token name, MModel model, List setup, List testCases) {
- this.name = name;
- this.setupStatements = setup;
- this.testCases = testCases;
- this.model = model;
- }
-
- public String getName() {
- return name.getText();
- }
-
- public void run(PrintWriter output) {
- this.output = output;
- this.run();
- }
-
- public void run() {
- MSystem system;
- int testNr = 1;
- int failedTests = 0;
-
- for (ASTTestCase test : testCases) {
- // execute the setup statements
- try {
- system = setUp();
- } catch (Exception e) {
- System.err.println("Error during test setup:");
- System.err.println(e.getMessage());
- return;
- }
-
- report("Executing test " + testNr + "/" + testCases.size() + " `" + test.getName().getText() + "'");
-
- try {
- TestResult result = test.execute(system);
-
- if (result == TestResult.OK) {
- reportln("... success");
- } else if (result == TestResult.FAILURE) {
- reportln("... failure");
- reportln(" " + test.getFailureDetails());
- failedTests++;
- } else if (result == TestResult.ERROR) {
- reportln("... error");
- reportln(" " + test.getFailureDetails());
- return;
- }
- } catch (Exception e) {
- System.err.println("... error");
- System.err.println(" " + e.getMessage());
- return;
- }
-
- testNr++;
- }
-
- if (failedTests > 0) {
- reportln("### " + failedTests + " FAILURE" + (failedTests > 1 ? "S" : "") + " ###");
- } else {
- reportln("### OK ###");
- }
- }
-
- private MSystem setUp() throws MSystemException, CompilationFailedException {
-
- MSystem system = new MSystem(model);
- system.setRunningTestSuite(true);
- system.registerPPCHandlerOverride(new PPCHandler() {
-
- @Override
- public void handlePreConditions(MSystem system, MOperationCall operationCall)
- throws PreConditionCheckFailedException {
- // we ignore the messages in tests
- }
-
- @Override
- public void handlePostConditions(MSystem system,
- MOperationCall operationCall)
- throws PostConditionCheckFailedException {
- // we ignore the messages in tests
-
- }
-
- @Override
- public void handleTransitionsPre(MSystem system,
- MOperationCall operationCall)
- throws PreConditionCheckFailedException {
- // we ignore the messages in tests
-
- }
-
- @Override
- public void handleTransitionsPost(MSystem system,
- MOperationCall operationCall)
- throws PostConditionCheckFailedException {
- // we ignore the messages in tests
-
- }
- });
-
- Context ctx = new Context(name.getText(), output, system.varBindings(), null);
- ctx.setOut(new PrintWriter(new NullWriter()));
- ctx.setModel(model);
- ctx.setSystemState(system.state());
-
- for (ASTStatement cmd : this.setupStatements) {
- MStatement c = cmd.generateStatement(ctx, system.getVariableEnvironment().constructSymbolTable());
- if (c == null)
- return null;
-
- system.execute(c);
- }
-
- return system;
- }
-
- public String getStats() {
- return "Test suite `" + this.getName() + "' with " + testCases.size() + " test cases";
- }
-
- private void reportln(String s) {
- if (output != null) {
- output.println(s);
- output.flush();
- }
- }
-
- private void report(String s) {
- if (output != null) {
- output.print(s);
- output.flush();
- }
- }
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import java.io.PrintWriter;
+import java.util.List;
+
+import org.antlr.runtime.Token;
+import org.tzi.use.parser.Context;
+import org.tzi.use.parser.soil.ast.ASTStatement;
+import org.tzi.use.parser.testsuite.ASTTestCase;
+import org.tzi.use.parser.testsuite.ASTTestCase.TestResult;
+import org.tzi.use.uml.mm.MModel;
+import org.tzi.use.uml.sys.MOperationCall;
+import org.tzi.use.uml.sys.MSystem;
+import org.tzi.use.uml.sys.MSystemException;
+import org.tzi.use.uml.sys.ppcHandling.PPCHandler;
+import org.tzi.use.uml.sys.ppcHandling.PostConditionCheckFailedException;
+import org.tzi.use.uml.sys.ppcHandling.PreConditionCheckFailedException;
+import org.tzi.use.uml.sys.soil.MStatement;
+import org.tzi.use.util.NullWriter;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
+
+public class MTestSuite {
+ private Token name;
+ private MModel model;
+
+ private List setupStatements;
+ private List testCases;
+
+ private PrintWriter output = null;
+
+ public MTestSuite(Token name, MModel model, List setup, List testCases) {
+ this.name = name;
+ this.setupStatements = setup;
+ this.testCases = testCases;
+ this.model = model;
+ }
+
+ public String getName() {
+ return name.getText();
+ }
+
+ public void run(PrintWriter output) {
+ this.output = output;
+ this.run();
+ }
+
+ public void run() {
+ MSystem system;
+ int testNr = 1;
+ int failedTests = 0;
+
+ for (ASTTestCase test : testCases) {
+ // execute the setup statements
+ try {
+ system = setUp();
+ } catch (Exception e) {
+ System.err.println("Error during test setup:");
+ System.err.println(e.getMessage());
+ return;
+ }
+
+ report("Executing test " + testNr + "/" + testCases.size() + " `" + test.getName().getText() + "'");
+
+ try {
+ TestResult result = test.execute(system);
+
+ if (result == TestResult.OK) {
+ reportln("... success");
+ } else if (result == TestResult.FAILURE) {
+ reportln("... failure");
+ reportln(" " + test.getFailureDetails());
+ failedTests++;
+ } else if (result == TestResult.ERROR) {
+ reportln("... error");
+ reportln(" " + test.getFailureDetails());
+ return;
+ }
+ } catch (Exception e) {
+ System.err.println("... error");
+ System.err.println(" " + e.getMessage());
+ return;
+ }
+
+ testNr++;
+ }
+
+ if (failedTests > 0) {
+ reportln("### " + failedTests + " FAILURE" + (failedTests > 1 ? "S" : "") + " ###");
+ } else {
+ reportln("### OK ###");
+ }
+ }
+
+ private MSystem setUp() throws MSystemException, CompilationFailedException {
+
+ MSystem system = new MSystem(model);
+ system.setRunningTestSuite(true);
+ system.registerPPCHandlerOverride(new PPCHandler() {
+
+ @Override
+ public void handlePreConditions(MSystem system, MOperationCall operationCall)
+ throws PreConditionCheckFailedException {
+ // we ignore the messages in tests
+ }
+
+ @Override
+ public void handlePostConditions(MSystem system,
+ MOperationCall operationCall)
+ throws PostConditionCheckFailedException {
+ // we ignore the messages in tests
+
+ }
+
+ @Override
+ public void handleTransitionsPre(MSystem system,
+ MOperationCall operationCall)
+ throws PreConditionCheckFailedException {
+ // we ignore the messages in tests
+
+ }
+
+ @Override
+ public void handleTransitionsPost(MSystem system,
+ MOperationCall operationCall)
+ throws PostConditionCheckFailedException {
+ // we ignore the messages in tests
+
+ }
+ });
+
+ Context ctx = new Context(name.getText(), output, system.varBindings(), null);
+ ctx.setOut(new PrintWriter(new NullWriter()));
+ ctx.setModel(model);
+ ctx.setSystemState(system.state());
+
+ for (ASTStatement cmd : this.setupStatements) {
+ MStatement c = cmd.generateStatement(ctx, new org.tzi.use.parser.soil.environment.SymbolTable(system.getVariableEnvironment()));
+ if (c == null)
+ return null;
+
+ system.execute(c);
+ }
+
+ return system;
+ }
+
+ public String getStats() {
+ return "Test suite `" + this.getName() + "' with " + testCases.size() + " test cases";
+ }
+
+ private void reportln(String s) {
+ if (output != null) {
+ output.println(s);
+ output.flush();
+ }
+ }
+
+ private void report(String s) {
+ if (output != null) {
+ output.print(s);
+ output.flush();
+ }
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariation.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariation.java
similarity index 90%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariation.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariation.java
index 87c1cfe97..9d0548a7e 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariation.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariation.java
@@ -1,33 +1,33 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.uml.sys.testsuite;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.sys.MSystemException;
-
-public abstract class MVariation {
- protected SrcPos position;
-
- public MVariation(SrcPos pos) {
- position = pos;
- }
-
- public abstract void doExecute() throws MSystemException;
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.parser.testsuite.sys;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.sys.MSystemException;
+
+public abstract class MVariation {
+ protected SrcPos position;
+
+ public MVariation(SrcPos pos) {
+ position = pos;
+ }
+
+ public abstract void doExecute() throws MSystemException;
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationEnd.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationEnd.java
similarity index 81%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationEnd.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationEnd.java
index 31f464dc8..6479a1759 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationEnd.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationEnd.java
@@ -1,29 +1,29 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.sys.MSystem;
-import org.tzi.use.uml.sys.MSystemException;
-
-public class MVariationEnd extends MVariation {
-
- private MSystem system;
-
- public MVariationEnd(SrcPos pos, MSystem system) {
- super(pos);
- this.system = system;
- }
-
- @Override
- public void doExecute() throws MSystemException {
- system.endVariation();
- }
-
- public String name() {
- return "End variation";
- }
-
- @Override
- public String toString() {
- return name();
- }
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.sys.MSystem;
+import org.tzi.use.uml.sys.MSystemException;
+
+public class MVariationEnd extends MVariation {
+
+ private MSystem system;
+
+ public MVariationEnd(SrcPos pos, MSystem system) {
+ super(pos);
+ this.system = system;
+ }
+
+ @Override
+ public void doExecute() throws MSystemException {
+ system.endVariation();
+ }
+
+ public String name() {
+ return "End variation";
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationStart.java b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationStart.java
similarity index 79%
rename from use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationStart.java
rename to use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationStart.java
index 945f3e6c9..0d5cb8e9e 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/testsuite/MVariationStart.java
+++ b/use-core/src/main/java/org/tzi/use/parser/testsuite/sys/MVariationStart.java
@@ -1,27 +1,27 @@
-package org.tzi.use.uml.sys.testsuite;
-
-import org.tzi.use.parser.SrcPos;
-import org.tzi.use.uml.sys.MSystem;
-
-public class MVariationStart extends MVariation {
- private MSystem system;
-
- public MVariationStart(SrcPos pos, MSystem system) {
- super(pos);
- this.system = system;
- }
-
- @Override
- public void doExecute() {
- system.beginVariation();
- }
-
- public String name() {
- return "Start variation";
- }
-
- @Override
- public String toString() {
- return name();
- }
-}
+package org.tzi.use.parser.testsuite.sys;
+
+import org.tzi.use.util.SrcPos;
+import org.tzi.use.uml.sys.MSystem;
+
+public class MVariationStart extends MVariation {
+ private MSystem system;
+
+ public MVariationStart(SrcPos pos, MSystem system) {
+ super(pos);
+ this.system = system;
+ }
+
+ @Override
+ public void doExecute() {
+ system.beginVariation();
+ }
+
+ public String name() {
+ return "Start variation";
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociation.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociation.java
index 38f0fe93a..56c117cc5 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociation.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociation.java
@@ -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.*;
import org.tzi.use.util.StringUtil;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationClass.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationClass.java
index c3e176637..b44031db5 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationClass.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationClass.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.use.ASTAssociation.AssociationEndConstraintsGenerator;
import org.tzi.use.uml.mm.*;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationEnd.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationEnd.java
index 294523b71..610fb204e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationEnd.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTAssociationEnd.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTElemVarsDeclaration;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.parser.ocl.ASTType;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTAttribute.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTAttribute.java
index 982259252..e427fd5b0 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTAttribute.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTAttribute.java
@@ -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.parser.ocl.ASTExpression;
import org.tzi.use.parser.ocl.ASTType;
import org.tzi.use.uml.mm.MAttribute;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTClass.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTClass.java
index a9c0262ad..376fb26d6 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTClass.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTClass.java
@@ -24,8 +24,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.use.statemachines.ASTStateMachine;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.mm.statemachines.MProtocolStateMachine;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTConstraintDefinition.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTConstraintDefinition.java
index 5ac240af6..4e26b6823 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTConstraintDefinition.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTConstraintDefinition.java
@@ -27,7 +27,7 @@
import org.antlr.runtime.Token;
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.ASTType;
import org.tzi.use.uml.mm.MClassInvariant;
import org.tzi.use.uml.mm.MClassifier;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTDataType.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTDataType.java
index 6a0905be6..a7f8b8a7e 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTDataType.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTDataType.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.util.StringUtil;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTImportStatement.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTImportStatement.java
index 2b83bf282..f2b6299df 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTImportStatement.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTImportStatement.java
@@ -21,7 +21,7 @@
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.ImportContext;
-import org.tzi.use.parser.SemanticException;
+import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.uml.mm.MClassifier;
import org.tzi.use.uml.mm.MImportedModel;
import org.tzi.use.uml.mm.MInvalidModelException;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTInvariantClause.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTInvariantClause.java
index 90175b6db..4481a4b87 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTInvariantClause.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTInvariantClause.java
@@ -24,8 +24,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTModel.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTModel.java
index 885c11533..56b121478 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTModel.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTModel.java
@@ -22,7 +22,7 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
import org.tzi.use.parser.ImportContext;
-import org.tzi.use.parser.SemanticException;
+import org.tzi.use.uml.ocl.expr.SemanticException;
import org.tzi.use.parser.ocl.ASTEnumTypeDefinition;
import org.tzi.use.parser.use.statemachines.ASTSignal;
import org.tzi.use.uml.mm.*;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTOperation.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTOperation.java
index 0a9495d10..95e76a7b6 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTOperation.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTOperation.java
@@ -24,8 +24,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.parser.ocl.ASTType;
import org.tzi.use.parser.ocl.ASTVariableDeclaration;
@@ -39,7 +39,7 @@
import org.tzi.use.uml.sys.soil.MEmptyStatement;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.CompilationFailedException;
+import org.tzi.use.parser.soil.exceptions.CompilationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePost.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePost.java
index 016614557..bb4044a44 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePost.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePost.java
@@ -25,8 +25,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTType;
import org.tzi.use.parser.ocl.ASTVariableDeclaration;
import org.tzi.use.uml.mm.MClass;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePostClause.java b/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePostClause.java
index 35f355b23..5b64e4b19 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePostClause.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/ASTPrePostClause.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.ocl.expr.ExpInvalidException;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTProtocolStateMachine.java b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTProtocolStateMachine.java
index 2c53e8097..b37103563 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTProtocolStateMachine.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTProtocolStateMachine.java
@@ -19,8 +19,8 @@
package org.tzi.use.parser.use.statemachines;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.statemachines.MProtocolStateMachine;
import org.tzi.use.uml.mm.statemachines.MPseudoState;
import org.tzi.use.uml.mm.statemachines.MPseudoStateKind;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTSignal.java b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTSignal.java
index 5b49e5581..eb89dbf5f 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTSignal.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTSignal.java
@@ -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.parser.use.ASTAttribute;
import org.tzi.use.parser.use.ASTClassifier;
import org.tzi.use.parser.use.ASTInvariantClause;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateDefinition.java b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateDefinition.java
index 71a1a76df..31922981b 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateDefinition.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateDefinition.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.uml.mm.MClassifier;
import org.tzi.use.uml.mm.statemachines.MFinalState;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateMachine.java b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateMachine.java
index cde4b0ae6..a0a250b62 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateMachine.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTStateMachine.java
@@ -21,8 +21,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.statemachines.MStateMachine;
import java.util.HashSet;
diff --git a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTTransitionDefinition.java b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTTransitionDefinition.java
index bc4e30149..5aafe796d 100644
--- a/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTTransitionDefinition.java
+++ b/use-core/src/main/java/org/tzi/use/parser/use/statemachines/ASTTransitionDefinition.java
@@ -23,8 +23,8 @@
import org.antlr.runtime.Token;
import org.tzi.use.parser.AST;
import org.tzi.use.parser.Context;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+import org.tzi.use.uml.ocl.expr.SemanticException;
+import org.tzi.use.uml.ocl.expr.Symtable;
import org.tzi.use.parser.ocl.ASTExpression;
import org.tzi.use.parser.ocl.ASTVariableDeclaration;
import org.tzi.use.uml.mm.MClassifier;
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/MMPrintVisitor.java b/use-core/src/main/java/org/tzi/use/uml/mm/MMPrintVisitor.java
index 3beb6166e..225680f4a 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/MMPrintVisitor.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/MMPrintVisitor.java
@@ -26,8 +26,8 @@
import org.tzi.use.uml.ocl.type.EnumType;
import org.tzi.use.uml.sys.soil.MStatement;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.uml.sorting.UseFileOrderComparator;
-import org.tzi.use.util.uml.sorting.UseModelElementFileOrderComparator;
+import org.tzi.use.uml.sys.sorting.UseFileOrderComparator;
+import org.tzi.use.uml.sys.sorting.UseModelElementFileOrderComparator;
import java.io.PrintWriter;
import java.util.*;
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MCallEvent.java b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MCallEvent.java
index 865b3fe94..d736aa9e8 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MCallEvent.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MCallEvent.java
@@ -18,9 +18,9 @@
*/
package org.tzi.use.uml.mm.commonbehavior.communications;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+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.mm.MOperation;
import org.tzi.use.uml.ocl.expr.VarDecl;
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MEvent.java b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MEvent.java
index e41866b7d..5b4eb8d46 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MEvent.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MEvent.java
@@ -18,9 +18,9 @@
*/
package org.tzi.use.uml.mm.commonbehavior.communications;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+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.mm.MNamedElement;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MTrigger.java b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MTrigger.java
index 4ebae79e2..01193962c 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MTrigger.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/commonbehavior/communications/MTrigger.java
@@ -18,9 +18,9 @@
*/
package org.tzi.use.uml.mm.commonbehavior.communications;
-import org.tzi.use.parser.ExprContext;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
+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.mm.MClassifier;
import org.tzi.use.uml.mm.MNamedElement;
import org.tzi.use.uml.mm.MOperation;
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MProtocolStateMachine.java b/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MProtocolStateMachine.java
index 034862be3..b86c76755 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MProtocolStateMachine.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MProtocolStateMachine.java
@@ -18,7 +18,7 @@
*/
package org.tzi.use.uml.mm.statemachines;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.MClassifier;
import org.tzi.use.uml.mm.MOperation;
import org.tzi.use.uml.sys.MObject;
diff --git a/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MStateMachine.java b/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MStateMachine.java
index dd0326bc9..d88f21318 100644
--- a/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MStateMachine.java
+++ b/use-core/src/main/java/org/tzi/use/uml/mm/statemachines/MStateMachine.java
@@ -22,7 +22,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.MClassifier;
import org.tzi.use.uml.mm.MNamedElement;
import org.tzi.use.uml.mm.UseFileLocatable;
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByKind.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByKind.java
index d988e47cb..793a81c62 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByKind.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByKind.java
@@ -22,7 +22,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.type.CollectionType;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.Type.VoidHandling;
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByType.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByType.java
index 3b408d5bf..d1d094926 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByType.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpSelectByType.java
@@ -19,7 +19,6 @@
package org.tzi.use.uml.ocl.expr;
-import org.tzi.use.parser.SemanticException;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.value.Value;
diff --git a/use-core/src/main/java/org/tzi/use/parser/ExprContext.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExprContext.java
similarity index 98%
rename from use-core/src/main/java/org/tzi/use/parser/ExprContext.java
rename to use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExprContext.java
index e534f73e4..a7ddcece9 100644
--- a/use-core/src/main/java/org/tzi/use/parser/ExprContext.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExprContext.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.parser;
+package org.tzi.use.uml.ocl.expr;
import java.util.Stack;
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Expression.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Expression.java
index 33109d20d..d84fab4ec 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Expression.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Expression.java
@@ -19,7 +19,7 @@
package org.tzi.use.uml.ocl.expr;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
import org.tzi.use.uml.ocl.value.Value;
diff --git a/use-core/src/main/java/org/tzi/use/parser/SemanticException.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/SemanticException.java
similarity index 97%
rename from use-core/src/main/java/org/tzi/use/parser/SemanticException.java
rename to use-core/src/main/java/org/tzi/use/uml/ocl/expr/SemanticException.java
index b9980915c..585aa86aa 100644
--- a/use-core/src/main/java/org/tzi/use/parser/SemanticException.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/SemanticException.java
@@ -17,7 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.parser;
+package org.tzi.use.uml.ocl.expr;
+import org.tzi.use.util.SrcPos;
import org.antlr.runtime.Token;
diff --git a/use-core/src/main/java/org/tzi/use/parser/Symtable.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Symtable.java
similarity index 98%
rename from use-core/src/main/java/org/tzi/use/parser/Symtable.java
rename to use-core/src/main/java/org/tzi/use/uml/ocl/expr/Symtable.java
index bd9620523..29095b4ed 100644
--- a/use-core/src/main/java/org/tzi/use/parser/Symtable.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/Symtable.java
@@ -17,7 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.parser;
+package org.tzi.use.uml.ocl.expr;
+import org.tzi.use.util.SrcPos;
import java.util.HashMap;
import java.util.Map;
@@ -138,4 +139,4 @@ public Type lookup(String name) {
return null;
}
-}
\ No newline at end of file
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDecl.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDecl.java
index f8bccb120..d2428d53a 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDecl.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDecl.java
@@ -20,7 +20,7 @@
package org.tzi.use.uml.ocl.expr;
import org.antlr.runtime.Token;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.ocl.type.Type;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDeclList.java b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDeclList.java
index def030536..ca38787b8 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDeclList.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/expr/VarDeclList.java
@@ -19,8 +19,6 @@
package org.tzi.use.uml.ocl.expr;
-import org.tzi.use.parser.SemanticException;
-import org.tzi.use.parser.Symtable;
import org.tzi.use.util.StringUtil;
import java.util.ArrayList;
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionManager.java b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionManager.java
index e24db7516..533763ce0 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionManager.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionManager.java
@@ -9,7 +9,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.tzi.use.parser.ocl.OCLCompiler;
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.mm.ModelFactory;
import org.tzi.use.uml.ocl.expr.ExpStdOp;
@@ -39,6 +38,12 @@ public class ExtensionManager {
*/
private String rubyMethodCallLibrary = null;
+ /**
+ * The type compiler used to resolve type names from extension definitions.
+ * Must be set before calling loadExtensions().
+ */
+ private TypeCompiler typeCompiler;
+
private ExtensionManager() {}
public static ExtensionManager getInstance() {
@@ -49,6 +54,16 @@ public static ExtensionManager getInstance() {
return ExtensionManager.INSTANCE;
}
+ /**
+ * Sets the type compiler used to resolve type names.
+ * This must be called before loadExtensions().
+ *
+ * @param typeCompiler the compiler to use for resolving type names
+ */
+ public void setTypeCompiler(TypeCompiler typeCompiler) {
+ this.typeCompiler = typeCompiler;
+ }
+
public String getRubyMethodCallLibrary() {
return rubyMethodCallLibrary;
}
@@ -57,6 +72,10 @@ public String getRubyMethodCallLibrary() {
* Loads the extensions specified in EXTENSION_FOLDER
*/
public void loadExtensions() {
+ if (this.typeCompiler == null) {
+ throw new IllegalStateException("TypeCompiler has not been set. Call setTypeCompiler() before loadExtensions().");
+ }
+
File extensionDir = new File(EXTENSIONS_FOLDER);
if (!extensionDir.isDirectory()) {
Log.warn("Invalid extension directory '" + ExtensionManager.EXTENSIONS_FOLDER + "'");
@@ -186,6 +205,9 @@ private ExtensionOperation loadOperation(VTDNav vn) throws NavException {
}
protected Type getType(String typeName) {
- return OCLCompiler.compileType(emptyModel, typeName, "Extension type", error);
+ if (typeCompiler == null) {
+ throw new IllegalStateException("TypeCompiler has not been set. Call setTypeCompiler() before loadExtensions().");
+ }
+ return typeCompiler.compileType(emptyModel, typeName, "Extension type", error);
}
}
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionOperation.java b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionOperation.java
index 8983c29ea..6090c1a6c 100644
--- a/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionOperation.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/ExtensionOperation.java
@@ -7,8 +7,6 @@
import org.tzi.use.uml.ocl.value.UndefinedValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.util.Log;
-import org.tzi.use.util.rubyintegration.RubyHelper;
-
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
diff --git a/use-core/src/main/java/org/tzi/use/util/rubyintegration/RubyHelper.java b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/RubyHelper.java
similarity index 96%
rename from use-core/src/main/java/org/tzi/use/util/rubyintegration/RubyHelper.java
rename to use-core/src/main/java/org/tzi/use/uml/ocl/extension/RubyHelper.java
index 8fcb964fe..aee3cb559 100644
--- a/use-core/src/main/java/org/tzi/use/util/rubyintegration/RubyHelper.java
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/RubyHelper.java
@@ -1,143 +1,143 @@
-package org.tzi.use.util.rubyintegration;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tzi.use.uml.ocl.expr.ExpConstBoolean;
-import org.tzi.use.uml.ocl.expr.ExpConstInteger;
-import org.tzi.use.uml.ocl.expr.ExpConstReal;
-import org.tzi.use.uml.ocl.expr.ExpConstString;
-import org.tzi.use.uml.ocl.expr.ExpUndefined;
-import org.tzi.use.uml.ocl.expr.Expression;
-import org.tzi.use.uml.ocl.expr.ExpressionWithValue;
-import org.tzi.use.uml.ocl.type.CollectionType;
-import org.tzi.use.uml.ocl.type.Type;
-import org.tzi.use.uml.ocl.type.Type.VoidHandling;
-import org.tzi.use.uml.ocl.value.BooleanValue;
-import org.tzi.use.uml.ocl.value.CollectionValue;
-import org.tzi.use.uml.ocl.value.IntegerValue;
-import org.tzi.use.uml.ocl.value.ObjectValue;
-import org.tzi.use.uml.ocl.value.RealValue;
-import org.tzi.use.uml.ocl.value.StringValue;
-import org.tzi.use.uml.ocl.value.UndefinedValue;
-import org.tzi.use.uml.ocl.value.Value;
-import org.tzi.use.uml.sys.MObject;
-import org.tzi.use.util.Log;
-
-public class RubyHelper {
- private RubyHelper() {}
-
- public static Value rubyValueToUseValue(Object rubyValue, Type expectedType) {
- Value result = UndefinedValue.instance;
-
- if (rubyValue == null) return result;
-
- if (rubyValue instanceof Value) {
- result = (Value)rubyValue;
- } else if (rubyValue instanceof Long) {
- result = IntegerValue.valueOf(((Long) rubyValue).intValue());
- } else if (rubyValue instanceof Integer) {
- result = IntegerValue.valueOf(((Integer) rubyValue).intValue());
- } else if (rubyValue instanceof String) {
- result = new StringValue((String)rubyValue);
- } else if (rubyValue instanceof Boolean) {
- result = BooleanValue.get(((Boolean)rubyValue).booleanValue());
- } else if (rubyValue instanceof Double) {
- result = new RealValue(((Double)rubyValue).doubleValue());
- } else if (rubyValue instanceof MObject) {
- MObject obj = (MObject)rubyValue;
- result = new ObjectValue(obj.cls(), obj);
- } else if (rubyValue instanceof List> && expectedType.isKindOfCollection(VoidHandling.EXCLUDE_VOID)) {
- List> list = (List>)rubyValue;
- Value[] elements = new Value[list.size()];
-
- for (int index = 0; index < list.size(); index++) {
- elements[index] = rubyValueToUseValue(list.get(index), ((CollectionType)expectedType).elemType());
- }
-
- CollectionType expectedCollectionType = (CollectionType)expectedType;
- result = expectedCollectionType.createCollectionValue(elements);
- } else {
- Log.warn("rubyValueToUseValue: Unhandeled Ruby value: " + rubyValue.toString());
- }
-
- if (result.type().conformsTo(expectedType)) {
- return result;
- } else {
- Log.warn("rubyValueToUseValue: converted type of value (`"
- + result.type().toString()
- + "') is not a subtype of the expected result type (`"
- + expectedType.toString() + "'");
- return UndefinedValue.instance;
- }
- }
-
- public static Object useValueToRubyValue(Value useValue) {
- if (useValue instanceof UndefinedValue) {
- return null;
- }
- if (useValue instanceof StringValue) {
- return ((StringValue)useValue).value();
- }
- if (useValue instanceof RealValue) {
- return ((RealValue)useValue).value();
- }
- if (useValue instanceof IntegerValue) {
- return ((IntegerValue)useValue).value();
- }
- if (useValue instanceof BooleanValue) {
- return ((BooleanValue)useValue).value();
- }
- if (useValue instanceof ObjectValue) {
- return ((ObjectValue)useValue).value();
- }
- if (useValue instanceof CollectionValue) {
- CollectionValue col = (CollectionValue)useValue;
- List result = new ArrayList(col.size());
-
- for (Value v : col.collection()) {
- result.add(useValueToRubyValue(v));
- }
-
- return result;
- }
- Log.warn("Unhandled USE value for Ruby:" + useValue.toStringWithType());
- return useValue;
- }
-
- public static Expression makeUSEExpression(Object rubyValue) {
- if (rubyValue instanceof Long) {
- return new ExpConstInteger(((Long) rubyValue).intValue());
- }
- if (rubyValue instanceof Integer) {
- return new ExpConstInteger(((Integer) rubyValue).intValue());
- }
- if (rubyValue instanceof String) {
- return new ExpConstString((String)rubyValue);
- }
- if (rubyValue instanceof Boolean) {
- return new ExpConstBoolean(((Boolean)rubyValue).booleanValue());
- }
- if (rubyValue instanceof Double) {
- return new ExpConstReal(((Double)rubyValue).doubleValue());
- }
- if (rubyValue instanceof MObject) {
- MObject obj = (MObject)rubyValue;
- return new ExpressionWithValue(new ObjectValue(obj.cls(), obj));
- }
- if (rubyValue != null) {
- Log.warn("makeUSEExpression: Unhandeled Ruby value: " + rubyValue.toString() + ":" + rubyValue.getClass().getName());
- }
-
- return new ExpUndefined();
- }
-
- public static Expression[] makeExpArray(Object[] exp) {
- Expression[] res = new Expression[exp.length];
- for (int i = 0; i < exp.length; i++) {
- res[i] = (Expression)exp[i];
- }
-
- return res;
- }
-}
+package org.tzi.use.uml.ocl.extension;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tzi.use.uml.ocl.expr.ExpConstBoolean;
+import org.tzi.use.uml.ocl.expr.ExpConstInteger;
+import org.tzi.use.uml.ocl.expr.ExpConstReal;
+import org.tzi.use.uml.ocl.expr.ExpConstString;
+import org.tzi.use.uml.ocl.expr.ExpUndefined;
+import org.tzi.use.uml.ocl.expr.Expression;
+import org.tzi.use.uml.ocl.expr.ExpressionWithValue;
+import org.tzi.use.uml.ocl.type.CollectionType;
+import org.tzi.use.uml.ocl.type.Type;
+import org.tzi.use.uml.ocl.type.Type.VoidHandling;
+import org.tzi.use.uml.ocl.value.BooleanValue;
+import org.tzi.use.uml.ocl.value.CollectionValue;
+import org.tzi.use.uml.ocl.value.IntegerValue;
+import org.tzi.use.uml.ocl.value.ObjectValue;
+import org.tzi.use.uml.ocl.value.RealValue;
+import org.tzi.use.uml.ocl.value.StringValue;
+import org.tzi.use.uml.ocl.value.UndefinedValue;
+import org.tzi.use.uml.ocl.value.Value;
+import org.tzi.use.uml.sys.MObject;
+import org.tzi.use.util.Log;
+
+public class RubyHelper {
+ private RubyHelper() {}
+
+ public static Value rubyValueToUseValue(Object rubyValue, Type expectedType) {
+ Value result = UndefinedValue.instance;
+
+ if (rubyValue == null) return result;
+
+ if (rubyValue instanceof Value) {
+ result = (Value)rubyValue;
+ } else if (rubyValue instanceof Long) {
+ result = IntegerValue.valueOf(((Long) rubyValue).intValue());
+ } else if (rubyValue instanceof Integer) {
+ result = IntegerValue.valueOf(((Integer) rubyValue).intValue());
+ } else if (rubyValue instanceof String) {
+ result = new StringValue((String)rubyValue);
+ } else if (rubyValue instanceof Boolean) {
+ result = BooleanValue.get(((Boolean)rubyValue).booleanValue());
+ } else if (rubyValue instanceof Double) {
+ result = new RealValue(((Double)rubyValue).doubleValue());
+ } else if (rubyValue instanceof MObject) {
+ MObject obj = (MObject)rubyValue;
+ result = new ObjectValue(obj.cls(), obj);
+ } else if (rubyValue instanceof List> && expectedType.isKindOfCollection(VoidHandling.EXCLUDE_VOID)) {
+ List> list = (List>)rubyValue;
+ Value[] elements = new Value[list.size()];
+
+ for (int index = 0; index < list.size(); index++) {
+ elements[index] = rubyValueToUseValue(list.get(index), ((CollectionType)expectedType).elemType());
+ }
+
+ CollectionType expectedCollectionType = (CollectionType)expectedType;
+ result = expectedCollectionType.createCollectionValue(elements);
+ } else {
+ Log.warn("rubyValueToUseValue: Unhandeled Ruby value: " + rubyValue.toString());
+ }
+
+ if (result.type().conformsTo(expectedType)) {
+ return result;
+ } else {
+ Log.warn("rubyValueToUseValue: converted type of value (`"
+ + result.type().toString()
+ + "') is not a subtype of the expected result type (`"
+ + expectedType.toString() + "'");
+ return UndefinedValue.instance;
+ }
+ }
+
+ public static Object useValueToRubyValue(Value useValue) {
+ if (useValue instanceof UndefinedValue) {
+ return null;
+ }
+ if (useValue instanceof StringValue) {
+ return ((StringValue)useValue).value();
+ }
+ if (useValue instanceof RealValue) {
+ return ((RealValue)useValue).value();
+ }
+ if (useValue instanceof IntegerValue) {
+ return ((IntegerValue)useValue).value();
+ }
+ if (useValue instanceof BooleanValue) {
+ return ((BooleanValue)useValue).value();
+ }
+ if (useValue instanceof ObjectValue) {
+ return ((ObjectValue)useValue).value();
+ }
+ if (useValue instanceof CollectionValue) {
+ CollectionValue col = (CollectionValue)useValue;
+ List result = new ArrayList(col.size());
+
+ for (Value v : col.collection()) {
+ result.add(useValueToRubyValue(v));
+ }
+
+ return result;
+ }
+ Log.warn("Unhandled USE value for Ruby:" + useValue.toStringWithType());
+ return useValue;
+ }
+
+ public static Expression makeUSEExpression(Object rubyValue) {
+ if (rubyValue instanceof Long) {
+ return new ExpConstInteger(((Long) rubyValue).intValue());
+ }
+ if (rubyValue instanceof Integer) {
+ return new ExpConstInteger(((Integer) rubyValue).intValue());
+ }
+ if (rubyValue instanceof String) {
+ return new ExpConstString((String)rubyValue);
+ }
+ if (rubyValue instanceof Boolean) {
+ return new ExpConstBoolean(((Boolean)rubyValue).booleanValue());
+ }
+ if (rubyValue instanceof Double) {
+ return new ExpConstReal(((Double)rubyValue).doubleValue());
+ }
+ if (rubyValue instanceof MObject) {
+ MObject obj = (MObject)rubyValue;
+ return new ExpressionWithValue(new ObjectValue(obj.cls(), obj));
+ }
+ if (rubyValue != null) {
+ Log.warn("makeUSEExpression: Unhandeled Ruby value: " + rubyValue.toString() + ":" + rubyValue.getClass().getName());
+ }
+
+ return new ExpUndefined();
+ }
+
+ public static Expression[] makeExpArray(Object[] exp) {
+ Expression[] res = new Expression[exp.length];
+ for (int i = 0; i < exp.length; i++) {
+ res[i] = (Expression)exp[i];
+ }
+
+ return res;
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/ocl/extension/TypeCompiler.java b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/TypeCompiler.java
new file mode 100644
index 000000000..c6b3e4274
--- /dev/null
+++ b/use-core/src/main/java/org/tzi/use/uml/ocl/extension/TypeCompiler.java
@@ -0,0 +1,45 @@
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2004 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.ocl.extension;
+
+import java.io.PrintWriter;
+
+import org.tzi.use.uml.mm.MModel;
+import org.tzi.use.uml.ocl.type.Type;
+
+/**
+ * Functional interface for compiling type expressions from string representations.
+ * This decouples the extension system from the parser's OCLCompiler.
+ *
+ * @author Trong-Nghia Be
+ */
+@FunctionalInterface
+public interface TypeCompiler {
+ /**
+ * Compiles a type name string into a Type object.
+ *
+ * @param model the model context for resolving types
+ * @param typeName the string representation of the type
+ * @param context a description of the context (for error messages)
+ * @param err writer for error output
+ * @return the compiled Type, or null if compilation fails
+ */
+ Type compileType(MModel model, String typeName, String context, PrintWriter err);
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedAttributeController.java b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedAttributeController.java
index d5ce322e9..c6ba4e520 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedAttributeController.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedAttributeController.java
@@ -19,13 +19,12 @@
package org.tzi.use.uml.sys;
-import org.tzi.use.analysis.coverage.CoverageCalculationVisitor;
import org.tzi.use.uml.mm.MAttribute;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.uml.mm.MClassifier;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.events.AttributeAssignedEvent;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
import java.util.Collections;
import java.util.HashSet;
@@ -89,11 +88,6 @@ private void determineDerivedAttributes() {
for (MAttribute att : cls.attributes()) {
if (att.isDerived()) {
derivedAttributes.add(att);
-
- CoverageCalculationVisitor visitor = new CoverageCalculationVisitor(true);
- att.getDeriveExpression().processWithVisitor(visitor);
-
- visitor.getCoverageData();
}
}
}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedLinkController.java b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedLinkController.java
index a8544a670..c405f33c0 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedLinkController.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedLinkController.java
@@ -20,7 +20,7 @@
import org.tzi.use.uml.mm.MAssociation;
import org.tzi.use.uml.mm.MAssociationEnd;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
import java.util.Collections;
import java.util.HashSet;
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedValueController.java b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedValueController.java
index 6dd993443..cfe06867f 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/DerivedValueController.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/DerivedValueController.java
@@ -19,7 +19,7 @@
package org.tzi.use.uml.sys;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
/**
* Interface for controllers that calculate values
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/InvariantCompiler.java b/use-core/src/main/java/org/tzi/use/uml/sys/InvariantCompiler.java
new file mode 100644
index 000000000..2a7d313f4
--- /dev/null
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/InvariantCompiler.java
@@ -0,0 +1,47 @@
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2004 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys;
+
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.Collection;
+
+import org.tzi.use.uml.mm.MClassInvariant;
+import org.tzi.use.uml.mm.MModel;
+
+/**
+ * Functional interface for compiling invariant definitions from an input stream.
+ * This decouples MSystem from the parser's ASSLCompiler.
+ *
+ * @author Trong-Nghia Be
+ */
+@FunctionalInterface
+public interface InvariantCompiler {
+ /**
+ * Compiles invariant definitions from an input stream.
+ *
+ * @param model the model to compile invariants for
+ * @param in the input stream containing invariant definitions
+ * @param inputName the name of the input source (for error messages)
+ * @param out writer for output/error messages
+ * @return a collection of compiled class invariants, or null on failure
+ */
+ Collection compileInvariants(MModel model, InputStream in, String inputName, PrintWriter out);
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/MOperationCall.java b/use-core/src/main/java/org/tzi/use/uml/sys/MOperationCall.java
index bd98d89b3..24c4ea57b 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/MOperationCall.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/MOperationCall.java
@@ -19,7 +19,7 @@
package org.tzi.use.uml.sys;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.mm.MOperation;
import org.tzi.use.uml.mm.MPrePostCondition;
import org.tzi.use.uml.mm.statemachines.MRegion;
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/MSystem.java b/use-core/src/main/java/org/tzi/use/uml/sys/MSystem.java
index 395c64f5d..f6ad19d08 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/MSystem.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/MSystem.java
@@ -21,8 +21,6 @@
import com.google.common.eventbus.EventBus;
import org.tzi.use.config.Options;
-import org.tzi.use.gen.tool.GGenerator;
-import org.tzi.use.parser.generator.ASSLCompiler;
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.mm.statemachines.MRegion;
import org.tzi.use.uml.mm.statemachines.MStateMachine;
@@ -48,8 +46,8 @@
import org.tzi.use.util.Log;
import org.tzi.use.util.StringUtil;
import org.tzi.use.util.UniqueNameGenerator;
-import org.tzi.use.util.soil.VariableEnvironment;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
import java.io.InputStream;
import java.io.PrintWriter;
@@ -85,9 +83,6 @@ public final class MSystem {
/** Last called operation (used by test suite) */
private MOperationCall lastOperationCall;
- /** Snapshot generator */
- private GGenerator fGenerator;
-
/** The variables of this system */
private VariableEnvironment fVariableEnvironment;
@@ -154,7 +149,6 @@ private void init() {
fObjects = new HashMap<>();
fUniqueNameGenerator = new UniqueNameGenerator();
fCurrentState = new MSystemState(fUniqueNameGenerator.generate("state#"), this);
- fGenerator = new GGenerator(this);
fVariableEnvironment = new VariableEnvironment(fCurrentState);
fStatementEvaluationResults = new ArrayDeque<>();
fCallStack = new ArrayDeque<>();
@@ -183,12 +177,7 @@ public MModel model() {
return fModel;
}
- /**
- * Returns the system's instance generator.
- */
- public GGenerator generator() {
- return fGenerator;
- }
+
public VarBindings varBindings() {
return fVariableEnvironment.constructVarBindings();
@@ -296,8 +285,26 @@ void deleteObject(MObject obj) {
fObjects.remove(obj.name());
}
+ /**
+ * The invariant compiler used to compile invariant definitions.
+ * Must be set via setInvariantCompiler() before calling loadInvariants().
+ */
+ private InvariantCompiler invariantCompiler;
+
+ /**
+ * Sets the invariant compiler used to compile invariant definitions.
+ * @param invariantCompiler the compiler to use
+ */
+ public void setInvariantCompiler(InvariantCompiler invariantCompiler) {
+ this.invariantCompiler = invariantCompiler;
+ }
+
public void loadInvariants(InputStream in, String inputName, boolean doEcho, PrintWriter out) {
- Collection invs = ASSLCompiler
+ if (invariantCompiler == null) {
+ Log.warn("InvariantCompiler not set. Cannot load invariants.");
+ return;
+ }
+ Collection invs = invariantCompiler
.compileInvariants(fModel, in, inputName,
out);
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/MSystemState.java b/use-core/src/main/java/org/tzi/use/uml/sys/MSystemState.java
index 89c1127e2..7f82af480 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/MSystemState.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/MSystemState.java
@@ -41,7 +41,7 @@
import org.tzi.use.util.collections.CollectionUtil;
import org.tzi.use.util.collections.HashBag;
import org.tzi.use.util.collections.Queue;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/StatementEvaluationResult.java b/use-core/src/main/java/org/tzi/use/uml/sys/StatementEvaluationResult.java
index b24e82625..22946a919 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/StatementEvaluationResult.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/StatementEvaluationResult.java
@@ -25,8 +25,8 @@
import org.tzi.use.uml.sys.events.Event;
import org.tzi.use.uml.sys.soil.MSequenceStatement;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.StateDifference;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Captures additional information about the execution of a statement,
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/events/StatementExecutedEvent.java b/use-core/src/main/java/org/tzi/use/uml/sys/events/StatementExecutedEvent.java
index 6b8d2df67..c0904a702 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/events/StatementExecutedEvent.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/events/StatementExecutedEvent.java
@@ -21,7 +21,7 @@
import org.tzi.use.uml.sys.events.tags.EventContext;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
/**
* Payload for the event raised after a
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvalUtil.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvalUtil.java
index 5e2e979a4..2c250877e 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvalUtil.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvalUtil.java
@@ -28,7 +28,7 @@
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
import java.util.ArrayList;
import java.util.List;
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/exceptions/EvaluationFailedException.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvaluationFailedException.java
similarity index 94%
rename from use-core/src/main/java/org/tzi/use/util/soil/exceptions/EvaluationFailedException.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/soil/EvaluationFailedException.java
index 22921160a..56338d07d 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/exceptions/EvaluationFailedException.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/EvaluationFailedException.java
@@ -1,61 +1,61 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil.exceptions;
-
-
-
-/**
- * Exception to throw when the evaluation of a statement has failed.
- * @author Daniel Gent
- * @author Lars Hamann
- *
- */
-public class EvaluationFailedException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructs a new evaluation failed exception.
- * @param message A user defined message.
- */
- public EvaluationFailedException(String message) {
- super(message);
- }
-
- /**
- * Constructs a new evaluation failed exception.
- * @param message A user defined message.
- * @param cause The original cause of the failure.
- */
- public EvaluationFailedException(
- String message,
- Throwable cause) {
-
- super(message, cause);
- }
-
- /**
- * Constructs a new evaluation failed exception.
- * @param cause The original cause of the failure.
- */
- public EvaluationFailedException(Throwable cause) {
- super(cause.getMessage(), cause);
- }
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.soil;
+
+
+
+/**
+ * Exception to throw when the evaluation of a statement has failed.
+ * @author Daniel Gent
+ * @author Lars Hamann
+ *
+ */
+public class EvaluationFailedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs a new evaluation failed exception.
+ * @param message A user defined message.
+ */
+ public EvaluationFailedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new evaluation failed exception.
+ * @param message A user defined message.
+ * @param cause The original cause of the failure.
+ */
+ public EvaluationFailedException(
+ String message,
+ Throwable cause) {
+
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new evaluation failed exception.
+ * @param cause The original cause of the failure.
+ */
+ public EvaluationFailedException(Throwable cause) {
+ super(cause.getMessage(), cause);
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MAttributeAssignmentStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MAttributeAssignmentStatement.java
index 971b1f225..4897c0eb2 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MAttributeAssignmentStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MAttributeAssignmentStatement.java
@@ -26,7 +26,7 @@
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* "Compiled" version of an attribute assignment.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MBlockStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MBlockStatement.java
index 0a112c527..e4f554a6b 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MBlockStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MBlockStatement.java
@@ -26,7 +26,7 @@
import org.tzi.use.uml.ocl.value.UndefinedValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MConditionalExecutionStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MConditionalExecutionStatement.java
index d1f7e5467..ff5bc3475 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MConditionalExecutionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MConditionalExecutionStatement.java
@@ -23,7 +23,7 @@
import org.tzi.use.uml.ocl.value.BooleanValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEmptyStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEmptyStatement.java
index 92bb8f948..b2c7d95fc 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEmptyStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEmptyStatement.java
@@ -21,7 +21,7 @@
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEnterOperationStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEnterOperationStatement.java
index 183364a8f..5970827e2 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEnterOperationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MEnterOperationStatement.java
@@ -32,7 +32,7 @@
import org.tzi.use.uml.sys.ppcHandling.OpEnterOpExitPPCHandler;
import org.tzi.use.uml.sys.ppcHandling.PPCHandler;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MExitOperationStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MExitOperationStatement.java
index eeaca7d49..973e59919 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MExitOperationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MExitOperationStatement.java
@@ -28,7 +28,7 @@
import org.tzi.use.uml.sys.ppcHandling.DoNothingPPCHandler;
import org.tzi.use.uml.sys.ppcHandling.OpEnterOpExitPPCHandler;
import org.tzi.use.uml.sys.ppcHandling.PPCHandler;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
import java.util.Map;
import java.util.Map.Entry;
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MIterationStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MIterationStatement.java
index c234001e8..887e9e460 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MIterationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MIterationStatement.java
@@ -23,7 +23,7 @@
import org.tzi.use.uml.ocl.value.CollectionValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLibraryOperationCallStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLibraryOperationCallStatement.java
index 70552c27f..a8ec69143 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLibraryOperationCallStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLibraryOperationCallStatement.java
@@ -25,7 +25,7 @@
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.uml.sys.soil.library.LibraryOperation;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Library operations like, e. g., ReadLine
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkDeletionStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkDeletionStatement.java
index d4fd03687..084651054 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkDeletionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkDeletionStatement.java
@@ -30,7 +30,7 @@
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkInsertionStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkInsertionStatement.java
index f17b341f4..8b6aa9bfa 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkInsertionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MLinkInsertionStatement.java
@@ -30,7 +30,7 @@
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* This statement inserts a new link into an association.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewLinkObjectStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewLinkObjectStatement.java
index 7fc8abde9..3ffdd1c32 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewLinkObjectStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewLinkObjectStatement.java
@@ -34,7 +34,7 @@
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* This statement creates a new link object of an association class.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewObjectStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewObjectStatement.java
index da77f472d..f099369b8 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewObjectStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MNewObjectStatement.java
@@ -27,7 +27,7 @@
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Statement used to create a new {@link MObject}.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectDestructionStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectDestructionStatement.java
index 759087265..e3ff11fda 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectDestructionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectDestructionStatement.java
@@ -28,7 +28,7 @@
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* "Compiled" version of a delete statement.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectOperationCallStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectOperationCallStatement.java
index ed6d16374..54f28e157 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectOperationCallStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectOperationCallStatement.java
@@ -30,7 +30,7 @@
import org.tzi.use.uml.sys.ppcHandling.ExpressionPPCHandler;
import org.tzi.use.uml.sys.ppcHandling.SoilPPCHandler;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Statement for an operation call to an
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectRestorationStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectRestorationStatement.java
index c8739ded3..0d09f3794 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectRestorationStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MObjectRestorationStatement.java
@@ -32,7 +32,7 @@
import org.tzi.use.uml.sys.MSystemState.DeleteObjectResult;
import org.tzi.use.uml.sys.MSystemState.DeleteObjectResult.ObjectStateModification;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Statement used internally as the inverse statement of an object
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MOperationCallInverseStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MOperationCallInverseStatement.java
index 25454ff4e..6f499b54a 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MOperationCallInverseStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MOperationCallInverseStatement.java
@@ -27,7 +27,7 @@
import org.tzi.use.uml.sys.MOperationCall;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.uml.sys.statemachines.MProtocolStateMachineInstance;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Internal statement to revert an operation call
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValue.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValue.java
index 127a7a669..bf9db2919 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValue.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValue.java
@@ -22,7 +22,7 @@
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueExpression.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueExpression.java
index a9b1cfa5b..dc9a23427 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueExpression.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueExpression.java
@@ -25,7 +25,7 @@
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* A RValue which evaluates an expression.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewLinkObject.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewLinkObject.java
index 7bed4a363..125cb6264 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewLinkObject.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewLinkObject.java
@@ -22,7 +22,7 @@
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewObject.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewObject.java
index 755733051..60e721da6 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewObject.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueNewObject.java
@@ -22,7 +22,7 @@
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* A RValue which creates a new object.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueOperationCall.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueOperationCall.java
index d037f60a6..bb847f992 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueOperationCall.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MRValueOperationCall.java
@@ -22,7 +22,7 @@
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Encapsulates an {@link MOperationCallStatement}
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MSequenceStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MSequenceStatement.java
index b200585f7..6fdc288b3 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MSequenceStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MSequenceStatement.java
@@ -27,7 +27,7 @@
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MStatement.java
index ac9d1d17d..e9b58db11 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MStatement.java
@@ -19,11 +19,11 @@
package org.tzi.use.uml.sys.soil;
-import org.tzi.use.parser.SrcPos;
+import org.tzi.use.util.SrcPos;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
import org.tzi.use.util.StringUtil;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Base class for all SOIL statements. MStatement instances provides the methods
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableAssignmentStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableAssignmentStatement.java
index b28790776..ae3eda56f 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableAssignmentStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableAssignmentStatement.java
@@ -21,7 +21,7 @@
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableDestructionStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableDestructionStatement.java
index 530c49b94..4a5b3ec25 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableDestructionStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MVariableDestructionStatement.java
@@ -21,7 +21,7 @@
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* Inverse version of an variable assignment statement.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MWhileStatement.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MWhileStatement.java
index 639cbbccf..74722891c 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/MWhileStatement.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/MWhileStatement.java
@@ -23,7 +23,7 @@
import org.tzi.use.uml.ocl.value.BooleanValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.StatementEvaluationResult;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
/**
* This statement executes a while-loop.
diff --git a/use-core/src/main/java/org/tzi/use/uml/sys/soil/SoilEvaluationContext.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/SoilEvaluationContext.java
index 974a3bae8..697525eed 100644
--- a/use-core/src/main/java/org/tzi/use/uml/sys/soil/SoilEvaluationContext.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/SoilEvaluationContext.java
@@ -25,7 +25,7 @@
import org.tzi.use.uml.ocl.expr.Expression;
import org.tzi.use.uml.sys.MSystem;
import org.tzi.use.uml.sys.MSystemState;
-import org.tzi.use.util.soil.VariableEnvironment;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
/**
* This context objects comprises everything that is required to execute
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/StateDifference.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/StateDifference.java
similarity index 96%
rename from use-core/src/main/java/org/tzi/use/util/soil/StateDifference.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/soil/StateDifference.java
index 8da1c12da..f22016ab1 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/StateDifference.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/StateDifference.java
@@ -1,685 +1,685 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil;
-
-import org.tzi.use.uml.sys.MLink;
-import org.tzi.use.uml.sys.MLinkObject;
-import org.tzi.use.uml.sys.MObject;
-import org.tzi.use.uml.sys.MSystemState;
-import org.tzi.use.uml.sys.MSystemState.DeleteObjectResult;
-import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.util.collections.CollectionUtil;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-
-
-/**
- * Holds information about what has changed in a {@link MSystemState system}
- * during the evaluation of a {@link MStatement Soil statement}.
- *
- * The {@code add...} methods check for conflicting situations, e.g. if the same
- * object is added to both the new objects and the deleted objects, it is
- * removed from this altogether.
- *
- * For {@link MLinkObject link objects} it doesn't matter whether you call
- * {@code add...Object}, {@code add...Link} or {@code add...LinkObject}, since
- * in either case the link object is treated as both an object and a link. To
- * save yourself some headache, it is recommended to use the
- * {@code add...LinkObject} versions, if you know you deal with a link object.
- *
- * @author Daniel Gent
- * @author Lars Hamann
- */
-public class StateDifference {
- /** Objects created during evaluation.
- *
Important : Before adding something to the collection,
- * the collection must be initialized with a call to
- * {@link CollectionUtil#initAsHashSet(Set)} like:
- * fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
- * fNewObjects.add(o);
- *
- */
- private Set fNewObjects = Collections.emptySet();
-
- /**
- * Objects deleted during evaluation.
- * Important : Before adding something to the collection,
- * the collection must be initialized with a call to
- * {@link CollectionUtil#initAsHashSet(Set)} like:
- * fDeletedObjects = CollectionUtil.initAsHashSet(fDeletedObjects);
- * fDeletedObjects.add(o);
- *
- */
- private Set fDeletedObjects = Collections.emptySet();
-
- /**
- * Objects modified during evaluation.
- * Important : Before adding something to the collection,
- * the collection must be initialized with a call to
- * {@link CollectionUtil#initAsHashSet(Set)} like:
- * fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
- * fModifiedObjects.add(o);
- *
- */
- private Set fModifiedObjects = Collections.emptySet();
-
- /**
- * Links created during evaluation.
- * Important : Before adding something to the collection,
- * the collection must be initialized with a call to
- * {@link CollectionUtil#initAsHashSet(Set)} like:
- * fNewLinks = CollectionUtil.initAsHashSet(fNewLinks);
- * fNewLinks.add(l);
- *
- */
- private Set fNewLinks = Collections.emptySet();
-
- /**
- * Links deleted during evaluation.
- *
- * Important : Before adding something to the collection,
- * the collection must be initialized with a call to
- * {@link CollectionUtil#initAsHashSet(Set)} like:
- * fDeletedLinks = CollectionUtil.initAsHashSet(fDeletedLinks);
- * fDeletedLinks.add(o);
- *
- */
- private Set fDeletedLinks = Collections.emptySet();
-
- /**
- * restores the initial state of this containing nothing
- */
- public void clear() {
- fNewObjects.clear();
- fDeletedObjects.clear();
- fModifiedObjects.clear();
- fNewLinks.clear();
- fDeletedLinks.clear();
- }
-
-
- /**
- * returns true if there are no state changes
- *
- * @return true if there are no state changes, false else
- */
- public boolean isEmpty() {
- return fNewObjects.isEmpty()
- && fDeletedObjects.isEmpty()
- && fModifiedObjects.isEmpty()
- && fNewLinks.isEmpty()
- && fDeletedLinks.isEmpty();
- }
-
-
- /**
- * handles the object strictly as an object, i.e. no check whether object
- * is a link object
- *
- * @param object a new object
- */
- private void addNewObjectOnly(MObject object) {
- boolean wasDeleted = fDeletedObjects.contains(object);
-
- remove(object);
-
- if (wasDeleted) {
- // might have been modified before deleting
- fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
- fModifiedObjects.add(object);
- } else {
- fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
- fNewObjects.add(object);
- }
- }
-
-
- /**
- * adds a new object
- *
- * if {@code object} is among the deleted objects,
- * it is deleted from there and nothing else is done. if it is
- * among the modified objects, it is deleted from there and added to the
- * new objects.
- * in every other case it is added to the new objects.
- *
- * if {@code object} is a link object, it is also added to the new links
- * following the semantics of {@link #addNewLink(MLink) addNewLink}
- *
- * @param object a new object
- */
- public void addNewObject(MObject object) {
- addNewObjectOnly(object);
-
- if (object instanceof MLinkObject) {
- addNewLinkOnly((MLinkObject)object);
- }
- }
-
-
- /**
- * adds multiple new objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addNewObject(MObject) addNewObject}
- *
- * @param objects some new objects
- */
- public void addNewObjects(Collection objects) {
- for (MObject object : objects) {
- addNewObject(object);
- }
- }
-
-
- /**
- * adds multiple new objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addNewObject(MObject) addNewObject}
- *
- * @param objects some new objects
- */
- public void addNewObjects(MObject... objects) {
- for (MObject object : objects) {
- addNewObject(object);
- }
- }
-
-
- /**
- * adds a new link object
- *
- * the object is added to the new objects as if
- * {@link #addNewObject(MObject) addNewObject} had been called, and to the
- * new links as if {@link #addNewLink(MLink) addNewLink} had been called
- *
- * @param linkObject a new link object
- */
- public void addNewLinkObject(MLinkObject linkObject) {
- addNewLinkOnly(linkObject);
- addNewObjectOnly(linkObject);
- }
-
-
- /**
- * adds multiple new link objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addNewLinkObject(MLinkObject) addNewLinkObject}
- *
- * @param linkObjects some new objects
- */
- public void addNewLinkObjects(Collection linkObjects) {
- for (MLinkObject linkObject : linkObjects) {
- addNewLinkObject(linkObject);
- }
- }
-
-
- /**
- * adds multiple new link objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addNewLinkObject(MLinkObject) addNewLinkObject}
- *
- * @param linkObjects some new objects
- */
- public void addNewLinkObjects(MLinkObject... linkObjects) {
- for (MLinkObject linkObject : linkObjects) {
- addNewLinkObject(linkObject);
- }
- }
-
-
- /**
- * handles the object strictly as an object, i.e. no check whether object
- * is a link object
- *
- * @param object a deleted object
- */
- private void addDeletedObjectOnly(MObject object) {
- boolean wasNew = fNewObjects.contains(object);
-
- remove(object);
-
- if (!wasNew) {
- fDeletedObjects = CollectionUtil.initAsHashSet(fDeletedObjects);
- fDeletedObjects.add(object);
- }
- }
-
-
- /**
- * adds a deleted object
- *
- * if {@code object} is among the new objects,
- * it removed there, and nothing else is done. if it is among the modified
- * objects it gets removed from there and added to the deleted objects.
- * in every other case it gets added to the deleted objects.
- *
- * if {@code object} is a link object, it is also added to the new links
- * following the semantics of {@link #addDeletedLink(MLink) addDeletedLink}
- *
- * @param object a deleted object
- */
- public void addDeletedObject(MObject object) {
- addDeletedObjectOnly(object);
-
- if (object instanceof MLinkObject) {
- addDeletedLinkOnly((MLinkObject)object);
- }
- }
-
-
- /**
- * adds multiple deleted objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addDeletedObject(MObject) addDeletedObject}
- *
- * @param objects some deleted objects
- */
- public void addDeletedObjects(Collection objects) {
- for (MObject object : objects) {
- addDeletedObject(object);
- }
- }
-
-
- /**
- * adds multiple deleted objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addDeletedObject(MObject) addDeletedObject}
- *
- * @param objects some deleted objects
- */
- public void addDeletedObjects(MObject... objects) {
- for (MObject object : objects) {
- addDeletedObject(object);
- }
- }
-
-
- /**
- * adds a deleted link object
- *
- * the object is added to the deleted objects as if
- * {@link #addDeletedObject(MObject) addDeletedObject} had been called, and
- * to the deleted links as if {@link #addDeletedLink(MLink) addDeletedLink}
- * had been called
- *
- * @param linkObject a deleted link object
- */
- public void addDeletedLinkObject(MLinkObject linkObject) {
- addDeletedLinkOnly(linkObject);
- addDeletedObjectOnly(linkObject);
- }
-
-
- /**
- * adds multiple deleted link objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addDeletedLinkObject(MLinkObject) addDeletedLinkObject}
- *
- * @param linkObjects some deleted objects
- */
- public void addDeletedLinkObjects(Collection linkObjects) {
- for (MLinkObject linkObject : linkObjects) {
- addDeletedLinkObject(linkObject);
- }
- }
-
-
- /**
- * adds multiple deleted link objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addDeletedLinkObject(MLinkObject) addDeletedLinkObject}
- *
- * @param linkObjects some deleted objects
- */
- public void addDeletedLinkObjects(MLinkObject... linkObjects) {
- for (MLinkObject linkObject : linkObjects) {
- addDeletedLinkObject(linkObject);
- }
- }
-
-
- /**
- * adds a modified object
- *
- * if {@code object} is among the new objects,
- * nothing is done. if it is among the deleted objects, it is removed
- * from there and added to the modified objects.
- * in every other case it is added to the modified objects.
- *
- * @param object a modified object
- */
- public void addModifiedObject(MObject object) {
- boolean wasNew = fNewObjects.contains(object);
-
- remove(object);
-
- if (wasNew) {
- fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
- fNewObjects.add(object);
- } else {
- fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
- fModifiedObjects.add(object);
- }
- }
-
-
- /**
- * adds multiple modified objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addModifiedObject(MObject) addModifiedObject}
- *
- * @param objects some modified objects
- */
- public void addModifiedObjects(Collection objects) {
- for (MObject object : objects) {
- addModifiedObject(object);
- }
- }
-
-
- /**
- * adds multiple modified objects
- *
- * calling this is equivalent to repeatedly calling
- * {@link #addModifiedObject(MObject) addModifiedObject}
- *
- * @param objects some modified objects
- */
- public void addModifiedObjects(MObject... objects) {
- for (MObject object : objects) {
- addModifiedObject(object);
- }
- }
-
-
- /**
- * handles the link strictly as a link, i.e. no check whether object
- * is a link object
- *
- * @param link a new link
- */
- private void addNewLinkOnly(MLink link) {
- boolean wasDeleted = fDeletedLinks.remove(link);
-
- remove(link);
-
- if (!wasDeleted) {
- fNewLinks = CollectionUtil.initAsHashSet(fNewLinks);
- fNewLinks.add(link);
- }
- }
-
-
- /**
- * Adds a new link
- *
- * if {@code link} is among the deleted links, it is deleted from
- * there and nothing else happens. if not, it is added to the new links.
- *
- * if {@code link} is a link object, it is also added to the new objects
- * following the semantics of {@link StateDifference#addNewObject(MObject) addNewObject}
- *
- * @param link a new link
- */
- public void addNewLink(MLink link) {
- addNewLinkOnly(link);
-
- if (link instanceof MLinkObject) {
- addNewObjectOnly((MLinkObject)link);
- }
- }
-
-
- /**
- * adds multiple new links
- *
- * calling this is equivalent to repeatedly calling
- * {@link StateDifference#addNewLink(MLink) addNewLink}
- *
- * @param links some new links
- */
- public void addNewLinks(Collection links) {
- for (MLink link : links) {
- addNewLink(link);
- }
- }
-
-
- /**
- * adds multiple new links
- *
- * calling this is equivalent to repeatedly calling
- * {@link StateDifference#addNewLink(MLink) addNewLink}
- *
- * @param links some new links
- */
- public void addNewLinks(MLink... links) {
- for (MLink link : links) {
- addNewLink(link);
- }
- }
-
-
- /**
- * handles the link strictly as a link, i.e. no check whether object
- * is a link object
- *
- * @param link a new link
- */
- private void addDeletedLinkOnly(MLink link) {
- boolean wasNew = fNewLinks.remove(link);
-
- remove(link);
-
- if (!wasNew) {
- fDeletedLinks = CollectionUtil.initAsHashSet(fDeletedLinks);
- fDeletedLinks.add(link);
- }
- }
-
-
- /**
- * adds a deleted link
- *
- * if {@code link} is among the new links, it is deleted from
- * there and nothing else happens. if not, it is added to the deleted links.
- *
- * if {@code link} is a link object, it is also added to the deleted objects
- * following the semantics of
- * {@link StateDifference#addDeletedObject(MObject) addDeletedObject}
- *
- * @param link a deleted link
- */
- public void addDeletedLink(MLink link) {
- addDeletedLinkOnly(link);
-
- if (link instanceof MLinkObject) {
- addDeletedObjectOnly((MLinkObject)link);
- }
- }
-
-
- /**
- * adds multiple deleted links
- *
- * calling this is equivalent to repeatedly calling
- * {@link StateDifference#addDeletedLink(MLink) addDeletedLink}
- *
- * @param links some deleted links
- */
- public void addDeletedLinks(Collection links) {
- for (MLink link : links) {
- addDeletedLink(link);
- }
- }
-
-
- /**
- * adds multiple deleted links
- *
- * calling this is equivalent to repeatedly calling
- * {@link StateDifference#addDeletedLink(MLink) addDeletedLink}
- *
- * @param links some deleted links
- */
- public void addDeletedLinks(MLink... links) {
- for (MLink link : links) {
- addDeletedLink(link);
- }
- }
-
-
- /**
- * extracts information about deleted objects and links from the
- * delete result, and adds them to this via the
- * {@link #addDeletedObject(MObject) addDeletedObject} and
- * {@link #addDeletedLink(MLink) addDeletedLink} methods.
- *
- * @param dor result of a delete operation on a MSystemState
- */
- public void addDeleteResult(DeleteObjectResult dor) {
- addDeletedObjects(dor.getRemovedObjects());
- addDeletedLinks(dor.getRemovedLinks());
- }
-
-
- /**
- * Adds all state differences of stateDiff
- * to this state difference.
- * @param stateDiff The state differences to add.
- */
- public void addStateDifference(StateDifference stateDiff) {
- addNewObjects(stateDiff.fNewObjects);
- addModifiedObjects(stateDiff.fModifiedObjects);
- addNewLinks(stateDiff.fNewLinks);
- addDeletedObjects(stateDiff.fDeletedObjects);
- addDeletedLinks(stateDiff.fDeletedLinks);
- }
-
-
- /**
- * removes an object from each set of objects
- *
- * @param object the object to remove
- */
- private void remove(MObject object) {
- fNewObjects.remove(object);
- fModifiedObjects.remove(object);
- fDeletedObjects.remove(object);
- }
-
-
- /**
- * removes a link from each set of links
- *
- * @param link the link to remove
- */
- private void remove(MLink link) {
- fNewLinks.remove(link);
- fDeletedLinks.remove(link);
- }
-
-
- /**
- * returns the set of new objects
- *
- * @return the set of new objects
- */
- public Set getNewObjects() {
- return fNewObjects;
- }
-
-
- /**
- * returns the set of deleted objects
- *
- * @return the set of deleted objects
- */
- public Set getDeletedObjects() {
- return fDeletedObjects;
- }
-
-
- /**
- * returns the set of modified objects
- *
- * @return the set of modified objects
- */
- public Set getModifiedObjects() {
- return fModifiedObjects;
- }
-
-
- /**
- * returns the set of new links
- *
- * @return the set of new links
- */
- public Set getNewLinks() {
- return fNewLinks;
- }
-
-
- /**
- * returns the set of deleted links
- *
- * @return the set of deleted links
- */
- public Set getDeletedLinks() {
- return fDeletedLinks;
- }
-
- public boolean structureHasChanged() {
- return !fNewObjects.isEmpty()
- || !fDeletedObjects.isEmpty()
- || !fNewLinks.isEmpty()
- || !fDeletedLinks.isEmpty();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("nO: ");
- sb.append(fNewObjects);
- sb.append("\ndO: ");
- sb.append(fDeletedObjects);
- sb.append("\nmO: ");
- sb.append(fModifiedObjects);
- sb.append("\nnL: ");
- sb.append(fNewLinks);
- sb.append("\ndL: ");
- sb.append(fDeletedLinks);
-
- return sb.toString();
- }
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.soil;
+
+import org.tzi.use.uml.sys.MLink;
+import org.tzi.use.uml.sys.MLinkObject;
+import org.tzi.use.uml.sys.MObject;
+import org.tzi.use.uml.sys.MSystemState;
+import org.tzi.use.uml.sys.MSystemState.DeleteObjectResult;
+import org.tzi.use.uml.sys.soil.MStatement;
+import org.tzi.use.util.collections.CollectionUtil;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+
+/**
+ * Holds information about what has changed in a {@link MSystemState system}
+ * during the evaluation of a {@link MStatement Soil statement}.
+ *
+ * The {@code add...} methods check for conflicting situations, e.g. if the same
+ * object is added to both the new objects and the deleted objects, it is
+ * removed from this altogether.
+ *
+ * For {@link MLinkObject link objects} it doesn't matter whether you call
+ * {@code add...Object}, {@code add...Link} or {@code add...LinkObject}, since
+ * in either case the link object is treated as both an object and a link. To
+ * save yourself some headache, it is recommended to use the
+ * {@code add...LinkObject} versions, if you know you deal with a link object.
+ *
+ * @author Daniel Gent
+ * @author Lars Hamann
+ */
+public class StateDifference {
+ /** Objects created during evaluation.
+ *
Important : Before adding something to the collection,
+ * the collection must be initialized with a call to
+ * {@link CollectionUtil#initAsHashSet(Set)} like:
+ * fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
+ * fNewObjects.add(o);
+ *
+ */
+ private Set fNewObjects = Collections.emptySet();
+
+ /**
+ * Objects deleted during evaluation.
+ * Important : Before adding something to the collection,
+ * the collection must be initialized with a call to
+ * {@link CollectionUtil#initAsHashSet(Set)} like:
+ * fDeletedObjects = CollectionUtil.initAsHashSet(fDeletedObjects);
+ * fDeletedObjects.add(o);
+ *
+ */
+ private Set fDeletedObjects = Collections.emptySet();
+
+ /**
+ * Objects modified during evaluation.
+ * Important : Before adding something to the collection,
+ * the collection must be initialized with a call to
+ * {@link CollectionUtil#initAsHashSet(Set)} like:
+ * fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
+ * fModifiedObjects.add(o);
+ *
+ */
+ private Set fModifiedObjects = Collections.emptySet();
+
+ /**
+ * Links created during evaluation.
+ * Important : Before adding something to the collection,
+ * the collection must be initialized with a call to
+ * {@link CollectionUtil#initAsHashSet(Set)} like:
+ * fNewLinks = CollectionUtil.initAsHashSet(fNewLinks);
+ * fNewLinks.add(l);
+ *
+ */
+ private Set fNewLinks = Collections.emptySet();
+
+ /**
+ * Links deleted during evaluation.
+ *
+ * Important : Before adding something to the collection,
+ * the collection must be initialized with a call to
+ * {@link CollectionUtil#initAsHashSet(Set)} like:
+ * fDeletedLinks = CollectionUtil.initAsHashSet(fDeletedLinks);
+ * fDeletedLinks.add(o);
+ *
+ */
+ private Set fDeletedLinks = Collections.emptySet();
+
+ /**
+ * restores the initial state of this containing nothing
+ */
+ public void clear() {
+ fNewObjects.clear();
+ fDeletedObjects.clear();
+ fModifiedObjects.clear();
+ fNewLinks.clear();
+ fDeletedLinks.clear();
+ }
+
+
+ /**
+ * returns true if there are no state changes
+ *
+ * @return true if there are no state changes, false else
+ */
+ public boolean isEmpty() {
+ return fNewObjects.isEmpty()
+ && fDeletedObjects.isEmpty()
+ && fModifiedObjects.isEmpty()
+ && fNewLinks.isEmpty()
+ && fDeletedLinks.isEmpty();
+ }
+
+
+ /**
+ * handles the object strictly as an object, i.e. no check whether object
+ * is a link object
+ *
+ * @param object a new object
+ */
+ private void addNewObjectOnly(MObject object) {
+ boolean wasDeleted = fDeletedObjects.contains(object);
+
+ remove(object);
+
+ if (wasDeleted) {
+ // might have been modified before deleting
+ fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
+ fModifiedObjects.add(object);
+ } else {
+ fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
+ fNewObjects.add(object);
+ }
+ }
+
+
+ /**
+ * adds a new object
+ *
+ * if {@code object} is among the deleted objects,
+ * it is deleted from there and nothing else is done. if it is
+ * among the modified objects, it is deleted from there and added to the
+ * new objects.
+ * in every other case it is added to the new objects.
+ *
+ * if {@code object} is a link object, it is also added to the new links
+ * following the semantics of {@link #addNewLink(MLink) addNewLink}
+ *
+ * @param object a new object
+ */
+ public void addNewObject(MObject object) {
+ addNewObjectOnly(object);
+
+ if (object instanceof MLinkObject) {
+ addNewLinkOnly((MLinkObject)object);
+ }
+ }
+
+
+ /**
+ * adds multiple new objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addNewObject(MObject) addNewObject}
+ *
+ * @param objects some new objects
+ */
+ public void addNewObjects(Collection objects) {
+ for (MObject object : objects) {
+ addNewObject(object);
+ }
+ }
+
+
+ /**
+ * adds multiple new objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addNewObject(MObject) addNewObject}
+ *
+ * @param objects some new objects
+ */
+ public void addNewObjects(MObject... objects) {
+ for (MObject object : objects) {
+ addNewObject(object);
+ }
+ }
+
+
+ /**
+ * adds a new link object
+ *
+ * the object is added to the new objects as if
+ * {@link #addNewObject(MObject) addNewObject} had been called, and to the
+ * new links as if {@link #addNewLink(MLink) addNewLink} had been called
+ *
+ * @param linkObject a new link object
+ */
+ public void addNewLinkObject(MLinkObject linkObject) {
+ addNewLinkOnly(linkObject);
+ addNewObjectOnly(linkObject);
+ }
+
+
+ /**
+ * adds multiple new link objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addNewLinkObject(MLinkObject) addNewLinkObject}
+ *
+ * @param linkObjects some new objects
+ */
+ public void addNewLinkObjects(Collection linkObjects) {
+ for (MLinkObject linkObject : linkObjects) {
+ addNewLinkObject(linkObject);
+ }
+ }
+
+
+ /**
+ * adds multiple new link objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addNewLinkObject(MLinkObject) addNewLinkObject}
+ *
+ * @param linkObjects some new objects
+ */
+ public void addNewLinkObjects(MLinkObject... linkObjects) {
+ for (MLinkObject linkObject : linkObjects) {
+ addNewLinkObject(linkObject);
+ }
+ }
+
+
+ /**
+ * handles the object strictly as an object, i.e. no check whether object
+ * is a link object
+ *
+ * @param object a deleted object
+ */
+ private void addDeletedObjectOnly(MObject object) {
+ boolean wasNew = fNewObjects.contains(object);
+
+ remove(object);
+
+ if (!wasNew) {
+ fDeletedObjects = CollectionUtil.initAsHashSet(fDeletedObjects);
+ fDeletedObjects.add(object);
+ }
+ }
+
+
+ /**
+ * adds a deleted object
+ *
+ * if {@code object} is among the new objects,
+ * it removed there, and nothing else is done. if it is among the modified
+ * objects it gets removed from there and added to the deleted objects.
+ * in every other case it gets added to the deleted objects.
+ *
+ * if {@code object} is a link object, it is also added to the new links
+ * following the semantics of {@link #addDeletedLink(MLink) addDeletedLink}
+ *
+ * @param object a deleted object
+ */
+ public void addDeletedObject(MObject object) {
+ addDeletedObjectOnly(object);
+
+ if (object instanceof MLinkObject) {
+ addDeletedLinkOnly((MLinkObject)object);
+ }
+ }
+
+
+ /**
+ * adds multiple deleted objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addDeletedObject(MObject) addDeletedObject}
+ *
+ * @param objects some deleted objects
+ */
+ public void addDeletedObjects(Collection objects) {
+ for (MObject object : objects) {
+ addDeletedObject(object);
+ }
+ }
+
+
+ /**
+ * adds multiple deleted objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addDeletedObject(MObject) addDeletedObject}
+ *
+ * @param objects some deleted objects
+ */
+ public void addDeletedObjects(MObject... objects) {
+ for (MObject object : objects) {
+ addDeletedObject(object);
+ }
+ }
+
+
+ /**
+ * adds a deleted link object
+ *
+ * the object is added to the deleted objects as if
+ * {@link #addDeletedObject(MObject) addDeletedObject} had been called, and
+ * to the deleted links as if {@link #addDeletedLink(MLink) addDeletedLink}
+ * had been called
+ *
+ * @param linkObject a deleted link object
+ */
+ public void addDeletedLinkObject(MLinkObject linkObject) {
+ addDeletedLinkOnly(linkObject);
+ addDeletedObjectOnly(linkObject);
+ }
+
+
+ /**
+ * adds multiple deleted link objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addDeletedLinkObject(MLinkObject) addDeletedLinkObject}
+ *
+ * @param linkObjects some deleted objects
+ */
+ public void addDeletedLinkObjects(Collection linkObjects) {
+ for (MLinkObject linkObject : linkObjects) {
+ addDeletedLinkObject(linkObject);
+ }
+ }
+
+
+ /**
+ * adds multiple deleted link objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addDeletedLinkObject(MLinkObject) addDeletedLinkObject}
+ *
+ * @param linkObjects some deleted objects
+ */
+ public void addDeletedLinkObjects(MLinkObject... linkObjects) {
+ for (MLinkObject linkObject : linkObjects) {
+ addDeletedLinkObject(linkObject);
+ }
+ }
+
+
+ /**
+ * adds a modified object
+ *
+ * if {@code object} is among the new objects,
+ * nothing is done. if it is among the deleted objects, it is removed
+ * from there and added to the modified objects.
+ * in every other case it is added to the modified objects.
+ *
+ * @param object a modified object
+ */
+ public void addModifiedObject(MObject object) {
+ boolean wasNew = fNewObjects.contains(object);
+
+ remove(object);
+
+ if (wasNew) {
+ fNewObjects = CollectionUtil.initAsHashSet(fNewObjects);
+ fNewObjects.add(object);
+ } else {
+ fModifiedObjects = CollectionUtil.initAsHashSet(fModifiedObjects);
+ fModifiedObjects.add(object);
+ }
+ }
+
+
+ /**
+ * adds multiple modified objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addModifiedObject(MObject) addModifiedObject}
+ *
+ * @param objects some modified objects
+ */
+ public void addModifiedObjects(Collection objects) {
+ for (MObject object : objects) {
+ addModifiedObject(object);
+ }
+ }
+
+
+ /**
+ * adds multiple modified objects
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link #addModifiedObject(MObject) addModifiedObject}
+ *
+ * @param objects some modified objects
+ */
+ public void addModifiedObjects(MObject... objects) {
+ for (MObject object : objects) {
+ addModifiedObject(object);
+ }
+ }
+
+
+ /**
+ * handles the link strictly as a link, i.e. no check whether object
+ * is a link object
+ *
+ * @param link a new link
+ */
+ private void addNewLinkOnly(MLink link) {
+ boolean wasDeleted = fDeletedLinks.remove(link);
+
+ remove(link);
+
+ if (!wasDeleted) {
+ fNewLinks = CollectionUtil.initAsHashSet(fNewLinks);
+ fNewLinks.add(link);
+ }
+ }
+
+
+ /**
+ * Adds a new link
+ *
+ * if {@code link} is among the deleted links, it is deleted from
+ * there and nothing else happens. if not, it is added to the new links.
+ *
+ * if {@code link} is a link object, it is also added to the new objects
+ * following the semantics of {@link StateDifference#addNewObject(MObject) addNewObject}
+ *
+ * @param link a new link
+ */
+ public void addNewLink(MLink link) {
+ addNewLinkOnly(link);
+
+ if (link instanceof MLinkObject) {
+ addNewObjectOnly((MLinkObject)link);
+ }
+ }
+
+
+ /**
+ * adds multiple new links
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link StateDifference#addNewLink(MLink) addNewLink}
+ *
+ * @param links some new links
+ */
+ public void addNewLinks(Collection links) {
+ for (MLink link : links) {
+ addNewLink(link);
+ }
+ }
+
+
+ /**
+ * adds multiple new links
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link StateDifference#addNewLink(MLink) addNewLink}
+ *
+ * @param links some new links
+ */
+ public void addNewLinks(MLink... links) {
+ for (MLink link : links) {
+ addNewLink(link);
+ }
+ }
+
+
+ /**
+ * handles the link strictly as a link, i.e. no check whether object
+ * is a link object
+ *
+ * @param link a new link
+ */
+ private void addDeletedLinkOnly(MLink link) {
+ boolean wasNew = fNewLinks.remove(link);
+
+ remove(link);
+
+ if (!wasNew) {
+ fDeletedLinks = CollectionUtil.initAsHashSet(fDeletedLinks);
+ fDeletedLinks.add(link);
+ }
+ }
+
+
+ /**
+ * adds a deleted link
+ *
+ * if {@code link} is among the new links, it is deleted from
+ * there and nothing else happens. if not, it is added to the deleted links.
+ *
+ * if {@code link} is a link object, it is also added to the deleted objects
+ * following the semantics of
+ * {@link StateDifference#addDeletedObject(MObject) addDeletedObject}
+ *
+ * @param link a deleted link
+ */
+ public void addDeletedLink(MLink link) {
+ addDeletedLinkOnly(link);
+
+ if (link instanceof MLinkObject) {
+ addDeletedObjectOnly((MLinkObject)link);
+ }
+ }
+
+
+ /**
+ * adds multiple deleted links
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link StateDifference#addDeletedLink(MLink) addDeletedLink}
+ *
+ * @param links some deleted links
+ */
+ public void addDeletedLinks(Collection links) {
+ for (MLink link : links) {
+ addDeletedLink(link);
+ }
+ }
+
+
+ /**
+ * adds multiple deleted links
+ *
+ * calling this is equivalent to repeatedly calling
+ * {@link StateDifference#addDeletedLink(MLink) addDeletedLink}
+ *
+ * @param links some deleted links
+ */
+ public void addDeletedLinks(MLink... links) {
+ for (MLink link : links) {
+ addDeletedLink(link);
+ }
+ }
+
+
+ /**
+ * extracts information about deleted objects and links from the
+ * delete result, and adds them to this via the
+ * {@link #addDeletedObject(MObject) addDeletedObject} and
+ * {@link #addDeletedLink(MLink) addDeletedLink} methods.
+ *
+ * @param dor result of a delete operation on a MSystemState
+ */
+ public void addDeleteResult(DeleteObjectResult dor) {
+ addDeletedObjects(dor.getRemovedObjects());
+ addDeletedLinks(dor.getRemovedLinks());
+ }
+
+
+ /**
+ * Adds all state differences of stateDiff
+ * to this state difference.
+ * @param stateDiff The state differences to add.
+ */
+ public void addStateDifference(StateDifference stateDiff) {
+ addNewObjects(stateDiff.fNewObjects);
+ addModifiedObjects(stateDiff.fModifiedObjects);
+ addNewLinks(stateDiff.fNewLinks);
+ addDeletedObjects(stateDiff.fDeletedObjects);
+ addDeletedLinks(stateDiff.fDeletedLinks);
+ }
+
+
+ /**
+ * removes an object from each set of objects
+ *
+ * @param object the object to remove
+ */
+ private void remove(MObject object) {
+ fNewObjects.remove(object);
+ fModifiedObjects.remove(object);
+ fDeletedObjects.remove(object);
+ }
+
+
+ /**
+ * removes a link from each set of links
+ *
+ * @param link the link to remove
+ */
+ private void remove(MLink link) {
+ fNewLinks.remove(link);
+ fDeletedLinks.remove(link);
+ }
+
+
+ /**
+ * returns the set of new objects
+ *
+ * @return the set of new objects
+ */
+ public Set getNewObjects() {
+ return fNewObjects;
+ }
+
+
+ /**
+ * returns the set of deleted objects
+ *
+ * @return the set of deleted objects
+ */
+ public Set getDeletedObjects() {
+ return fDeletedObjects;
+ }
+
+
+ /**
+ * returns the set of modified objects
+ *
+ * @return the set of modified objects
+ */
+ public Set getModifiedObjects() {
+ return fModifiedObjects;
+ }
+
+
+ /**
+ * returns the set of new links
+ *
+ * @return the set of new links
+ */
+ public Set getNewLinks() {
+ return fNewLinks;
+ }
+
+
+ /**
+ * returns the set of deleted links
+ *
+ * @return the set of deleted links
+ */
+ public Set getDeletedLinks() {
+ return fDeletedLinks;
+ }
+
+ public boolean structureHasChanged() {
+ return !fNewObjects.isEmpty()
+ || !fDeletedObjects.isEmpty()
+ || !fNewLinks.isEmpty()
+ || !fDeletedLinks.isEmpty();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("nO: ");
+ sb.append(fNewObjects);
+ sb.append("\ndO: ");
+ sb.append(fDeletedObjects);
+ sb.append("\nmO: ");
+ sb.append(fModifiedObjects);
+ sb.append("\nnL: ");
+ sb.append(fNewLinks);
+ sb.append("\ndL: ");
+ sb.append(fDeletedLinks);
+
+ return sb.toString();
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/VariableEnvironment.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableEnvironment.java
similarity index 89%
rename from use-core/src/main/java/org/tzi/use/util/soil/VariableEnvironment.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableEnvironment.java
index 8a46aae5b..9cecc92d8 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/VariableEnvironment.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableEnvironment.java
@@ -1,433 +1,415 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil;
-
-
-import org.tzi.use.uml.ocl.value.ObjectValue;
-import org.tzi.use.uml.ocl.value.UndefinedValue;
-import org.tzi.use.uml.ocl.value.Value;
-import org.tzi.use.uml.ocl.value.VarBindings;
-import org.tzi.use.uml.sys.MObject;
-import org.tzi.use.uml.sys.MSystemState;
-
-import java.util.*;
-import java.util.Map.Entry;
-
-
-/**
- * Holds variables and their values
- *
- * Data is organized as follows:
- * Variables and their respective values are hold as a
- * mapping {@code String} -> {@code Value}. Mappings for one or more variables
- * are contained in a frame. One or more frames are contained in a level.
- *
- * example:
- *
- * l(n+1) is more recent than l(n), f(n+1) is more recent than f(n)
- *
- * l2[ f0[x->17] ]
- * l1[ f0[a->'a', x->'x'], f1[a->'b'] ]
- * l0[ f0[x->12, y->'y'], f1[z->3] ]
- *
- * Looking up values only considers the most recent level, and searches
- * backwards from the most recent frame in that level until the value is found
- * or the least recent frame has been searched.
- * When assigning a value to a variable, a pre-existing mapping is searched in
- * the same way a looking up values work. If no such mapping exists, a new
- * mapping is added to the most recent frame in the most recent level.
- *
- * @author Daniel Gent
- */
-public class VariableEnvironment {
- /** the stack of frames */
- private Deque> fFrames;
- /** The stack of information about visibility of global objects for the frames.
- * This stack has the same number of elements as {@link #fFrames}.
- */
- private Deque fObjectVisibility;
- /** reference to the current frame */
- private Map fCurrentFrame;
- /** the system state this variable environment is defined for. */
- private final MSystemState fSystemState;
-
-
- /**
- * Constructs an empty variable environment
- */
- public VariableEnvironment(MSystemState systemState) {
- clear();
- fSystemState = systemState;
- }
-
-
- /**
- * copy constructor
- *
- * creates a quasi real copy (note that {@code String} and {@code Value}
- * objects aren't copied, since they are considered immutable)
- *
- * @param other the {@code VariableEnvironment} to copy
- */
- public VariableEnvironment(VariableEnvironment other) {
- fSystemState = other.fSystemState;
- fFrames = new ArrayDeque<>();
-
- for (Map b : other.fFrames) {
- Map b1 = new HashMap<>(b);
- fFrames.add(b1);
- }
-
- fCurrentFrame = fFrames.peek();
- fObjectVisibility = new ArrayDeque<>(other.fObjectVisibility);
- }
-
- public VariableEnvironment(VariableEnvironment other, MSystemState systemState) {
- fSystemState = systemState;
- fFrames = new ArrayDeque<>(other.fFrames);
- fCurrentFrame = fFrames.peek();
- fObjectVisibility = new ArrayDeque<>(other.fObjectVisibility);
- }
-
- /**
- * Restores the initial state, which consists of one level, with one
- * frame containing no variable mappings
- */
- public void clear() {
-
- fFrames = new ArrayDeque<>();
- fObjectVisibility = new ArrayDeque<>();
-
- pushFrame(true);
- }
-
-
- /**
- * Returns true if this variable environment is empty, empty being
- * defined as consisting of one level with one frame containing no
- * variable mappings
- *
- * @return {@code true} if this variable environment is empty,
- * {@code false} else
- */
- public boolean isEmpty() {
- return ((fFrames.size() == 1) && fFrames.peek().isEmpty());
- }
-
-
- /**
- * adds a new level to this variable environment, which initially has
- * one empty frame. all consecutive assignments and lookups will be
- * performed on this level until {@code pushLevel} or {@code popLevel} are
- * called
- *
- * @see #popFrame()
- */
- public void pushFrame(boolean objectsVisible) {
- fFrames.push(new HashMap<>());
- fCurrentFrame = fFrames.peek();
- fObjectVisibility.push(objectsVisible);
- }
-
-
- /**
- * removes the most recent level pushed with {@code pushLevel}. if only one
- * level exists, this does nothing
- *
- * @see VariableEnvironment#pushFrame(boolean)
- */
- public void popFrame() {
- fFrames.pop();
- fCurrentFrame = fFrames.peek();
- fObjectVisibility.pop();
- }
-
-
- /**
- * assigns a value to a variable
- *
- * Note: only the current, most recent level of this variable environment
- * can be accessed with this method.
- *
- * If the current level already contains a mapping for this
- * variable, it is updated in the most recent frame containing it, else
- * it a new mapping is added to the most recent frame.
- *
- * @param name name of the variable
- * @param value value of the variable
- * @return if there was a previous mapping, the old {@code Value} is
- * returned, {@code null} else
- */
- public Value assign(String name, Value value) {
-
- Value oldValue = fCurrentFrame.get(name);
- fCurrentFrame.put(name, value);
-
- return oldValue;
- }
-
-
- /**
- * Assigns multiple variables. This is a wrapper
- * for the single variable version.
- *
- * @param variables the variables and their values
- * @see #assign(String, Value)
- */
- public void assign(Map variables) {
- for (Entry entry : variables.entrySet()) {
- assign(entry.getKey(), entry.getValue());
- }
- }
-
-
- /**
- * returns a variable's value
- *
- * Note: only the current, most recent level of this variable environment
- * can be accessed with this method.
- *
- * If the current level contains a mapping for this name,
- * the value of the mapping in the most recent frame is returned.
- * {@code null} is returned else.
- *
- * @param name the name of the variable
- * @return if the variable is known it's {@code Value}, {@code null} else
- */
- public Value lookUp(String name)
- {
- Value result = fCurrentFrame.get(name);
-
- if ((result == null)
- && (fObjectVisibility.peek())
- && (fSystemState.hasObjectWithName(name))) {
-
- result = fSystemState.objectByName(name).value();
- }
-
- return result;
- }
-
-
- /**
- * returns all currently available variable mappings, i.e. all mappings
- * in the current level. if a variable name is mapped in different frames,
- * the mapping in the most recent frame is used. (the one that would be
- * accessed by a {@code lookUp})
- * @return all current variable mappings
- */
- public Map getCurrentMappings() {
- return fCurrentFrame;
- }
-
-
- /**
- * removes the most recent mapping of this variable name on the current
- * level of this variable environment
- *
- * @param name the variable's name
- */
- public void remove(String name) {
- fFrames.peek().remove(name);
- }
-
-
- /**
- * updates the references to a deleted object
- *
- * All variables on all levels referencing to the supplied object reference
- * to the corresponding undefined value afterwards.
- *
- * @param object the object that was deleted
- */
- public void undefineReferencesTo(MObject object) {
-
- for (Map frame : fFrames) {
- for (Entry entry : frame.entrySet()) {
- Value value = entry.getValue();
- if ((value.isObject()) &&
- ((ObjectValue)value).value() == object) {
-
- // use the type of this value to find the correct
- // 'undefined' value; the object type might be more
- // specific, and we want to preserve type of this
- // variable
- entry.setValue(UndefinedValue.instance);
- }
- }
- }
- }
-
-
- /**
- * returns the names of all variables in the top level frame (the first
- * frame of the first level) referencing the supplied object
- *
- * @param object the referenced object
- * @return the names of top-level variables referencing the object
- */
- public List getTopLevelReferencesTo(MObject object) {
-
- List result = new ArrayList<>();
-
- for (Entry entry : fFrames.peekFirst().entrySet()) {
- Value value = entry.getValue();
- if ((value.isObject()) &&
- ((ObjectValue)value).value() == object) {
-
- result.add(entry.getKey());
- }
- }
-
- return result;
- }
-
-
- /**
- * constructs a symbol table based on the mappings in the current level of
- * this variable environment
- *
- * This is basically a transformation of a Name->Value mapping
- * to a Name->Type mapping. Note that if the current level contains
- * more than one mapping for a variable, only the most recent is added
- * to the symbol table.
- *
- * @see SymbolTable
- * @return the constructed symbol table
- */
- public SymbolTable constructSymbolTable() {
- SymbolTable result;
-
- if (fObjectVisibility.peek()) {
- result = new SymbolTable(fSystemState);
- } else {
- result = new SymbolTable();
- }
-
- for (Entry entry : fCurrentFrame.entrySet()) {
- String varName = entry.getKey();
- result.setType(varName, entry.getValue().type());
- }
-
- return result;
- }
-
-
- /**
- * constructs a variable bindings in {@code VarBindings}
- * format from this {@code VariableEnvironment}
- *
- * Note that the level/frame structure is not duplicated, i.e. if this
- * variable environment contains more than one mapping for a
- * variable, only the most recent is added to the variable
- * bindings.
- *
- * @see VarBindings
- * @return the constructed object
- */
- public VarBindings constructVarBindings() {
- VarBindings result = null;
-
- if (fObjectVisibility.peek()) {
- result = new VarBindings(fSystemState);
- } else {
- result = new VarBindings();
- }
-
- for (Entry entry : fCurrentFrame.entrySet()) {
- String name = entry.getKey();
- Value value = entry.getValue();
-
- result.push(name, value);
- }
-
- return result;
- }
-
-
- @Override
- public String toString() {
-
- final String COLON = " : ";
- final String EQUAL = " = ";
- final String NEWLN = System.lineSeparator();
- final String FRPRE = "[frame ";
- final String FRPST = "]" + NEWLN;
- final String EMPTY = "empty" + NEWLN;
- String VAR_INDENT;
-
- int numFrames = fFrames.size();
- int numObjects = fSystemState.numObjects();
- boolean printFrameNum = ((numFrames > 1) || (numObjects > 0));
-
- VAR_INDENT = printFrameNum ? " " : "";
-
- StringBuilder sb = new StringBuilder();
-
- int currentFrame = (numFrames - 1);
-
- for (Map frame : fFrames) {
- if (printFrameNum) {
- sb.append(FRPRE);
- sb.append(currentFrame--);
- sb.append(FRPST);
- }
-
- if (frame.isEmpty()) {
- sb.append(VAR_INDENT);
- sb.append(EMPTY);
- }
-
- for (Entry entry : frame.entrySet()) {
- sb.append(VAR_INDENT);
- sb.append(entry.getKey());
- sb.append(COLON);
- sb.append(entry.getValue().type());
- sb.append(EQUAL);
- sb.append(entry.getValue());
- sb.append(NEWLN);
- }
- }
-
- if (numObjects > 0) {
-
- sb.append("[object variables]");
- sb.append(NEWLN);
-
- List objectNames =
- new LinkedList<>(fSystemState.allObjectNames());
- Collections.sort(objectNames);
-
- for (String objectName : objectNames) {
- MObject object = fSystemState.objectByName(objectName);
-
- sb.append(VAR_INDENT);
- sb.append(objectName);
- sb.append(COLON);
- sb.append(object.cls());
- sb.append(EQUAL);
- sb.append(object.value());
- sb.append(NEWLN);
- }
- }
-
- return sb.toString();
- }
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.soil;
+
+
+import org.tzi.use.uml.ocl.value.ObjectValue;
+import org.tzi.use.uml.ocl.value.UndefinedValue;
+import org.tzi.use.uml.ocl.value.Value;
+import org.tzi.use.uml.ocl.value.VarBindings;
+import org.tzi.use.uml.sys.MObject;
+import org.tzi.use.uml.sys.MSystemState;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+
+/**
+ * Holds variables and their values
+ *
+ * Data is organized as follows:
+ * Variables and their respective values are hold as a
+ * mapping {@code String} -> {@code Value}. Mappings for one or more variables
+ * are contained in a frame. One or more frames are contained in a level.
+ *
+ * example:
+ *
+ * l(n+1) is more recent than l(n), f(n+1) is more recent than f(n)
+ *
+ * l2[ f0[x->17] ]
+ * l1[ f0[a->'a', x->'x'], f1[a->'b'] ]
+ * l0[ f0[x->12, y->'y'], f1[z->3] ]
+ *
+ * Looking up values only considers the most recent level, and searches
+ * backwards from the most recent frame in that level until the value is found
+ * or the least recent frame has been searched.
+ * When assigning a value to a variable, a pre-existing mapping is searched in
+ * the same way a looking up values work. If no such mapping exists, a new
+ * mapping is added to the most recent frame in the most recent level.
+ *
+ * @author Daniel Gent
+ */
+public class VariableEnvironment {
+ /** the stack of frames */
+ private Deque> fFrames;
+ /** The stack of information about visibility of global objects for the frames.
+ * This stack has the same number of elements as {@link #fFrames}.
+ */
+ private Deque fObjectVisibility;
+ /** reference to the current frame */
+ private Map fCurrentFrame;
+ /** the system state this variable environment is defined for. */
+ private final MSystemState fSystemState;
+
+
+ /**
+ * Constructs an empty variable environment
+ */
+ public VariableEnvironment(MSystemState systemState) {
+ clear();
+ fSystemState = systemState;
+ }
+
+
+ /**
+ * copy constructor
+ *
+ * creates a quasi real copy (note that {@code String} and {@code Value}
+ * objects aren't copied, since they are considered immutable)
+ *
+ * @param other the {@code VariableEnvironment} to copy
+ */
+ public VariableEnvironment(VariableEnvironment other) {
+ fSystemState = other.fSystemState;
+ fFrames = new ArrayDeque<>();
+
+ for (Map b : other.fFrames) {
+ Map b1 = new HashMap<>(b);
+ fFrames.add(b1);
+ }
+
+ fCurrentFrame = fFrames.peek();
+ fObjectVisibility = new ArrayDeque<>(other.fObjectVisibility);
+ }
+
+ public MSystemState getSystemState() {
+ return fSystemState;
+ }
+
+ public boolean isObjectVisible() {
+ return fObjectVisibility.peek();
+ }
+
+
+ public VariableEnvironment(VariableEnvironment other, MSystemState systemState) {
+ fSystemState = systemState;
+ fFrames = new ArrayDeque<>(other.fFrames);
+ fCurrentFrame = fFrames.peek();
+ fObjectVisibility = new ArrayDeque<>(other.fObjectVisibility);
+ }
+
+ /**
+ * Restores the initial state, which consists of one level, with one
+ * frame containing no variable mappings
+ */
+ public void clear() {
+
+ fFrames = new ArrayDeque<>();
+ fObjectVisibility = new ArrayDeque<>();
+
+ pushFrame(true);
+ }
+
+
+ /**
+ * Returns true if this variable environment is empty, empty being
+ * defined as consisting of one level with one frame containing no
+ * variable mappings
+ *
+ * @return {@code true} if this variable environment is empty,
+ * {@code false} else
+ */
+ public boolean isEmpty() {
+ return ((fFrames.size() == 1) && fFrames.peek().isEmpty());
+ }
+
+
+ /**
+ * adds a new level to this variable environment, which initially has
+ * one empty frame. all consecutive assignments and lookups will be
+ * performed on this level until {@code pushLevel} or {@code popLevel} are
+ * called
+ *
+ * @see #popFrame()
+ */
+ public void pushFrame(boolean objectsVisible) {
+ fFrames.push(new HashMap<>());
+ fCurrentFrame = fFrames.peek();
+ fObjectVisibility.push(objectsVisible);
+ }
+
+
+ /**
+ * removes the most recent level pushed with {@code pushLevel}. if only one
+ * level exists, this does nothing
+ *
+ * @see VariableEnvironment#pushFrame(boolean)
+ */
+ public void popFrame() {
+ fFrames.pop();
+ fCurrentFrame = fFrames.peek();
+ fObjectVisibility.pop();
+ }
+
+
+ /**
+ * assigns a value to a variable
+ *
+ * Note: only the current, most recent level of this variable environment
+ * can be accessed with this method.
+ *
+ * If the current level already contains a mapping for this
+ * variable, it is updated in the most recent frame containing it, else
+ * it a new mapping is added to the most recent frame.
+ *
+ * @param name name of the variable
+ * @param value value of the variable
+ * @return if there was a previous mapping, the old {@code Value} is
+ * returned, {@code null} else
+ */
+ public Value assign(String name, Value value) {
+
+ Value oldValue = fCurrentFrame.get(name);
+ fCurrentFrame.put(name, value);
+
+ return oldValue;
+ }
+
+
+ /**
+ * Assigns multiple variables. This is a wrapper
+ * for the single variable version.
+ *
+ * @param variables the variables and their values
+ * @see #assign(String, Value)
+ */
+ public void assign(Map variables) {
+ for (Entry entry : variables.entrySet()) {
+ assign(entry.getKey(), entry.getValue());
+ }
+ }
+
+
+ /**
+ * returns a variable's value
+ *
+ * Note: only the current, most recent level of this variable environment
+ * can be accessed with this method.
+ *
+ * If the current level contains a mapping for this name,
+ * the value of the mapping in the most recent frame is returned.
+ * {@code null} is returned else.
+ *
+ * @param name the name of the variable
+ * @return if the variable is known it's {@code Value}, {@code null} else
+ */
+ public Value lookUp(String name)
+ {
+ Value result = fCurrentFrame.get(name);
+
+ if ((result == null)
+ && (fObjectVisibility.peek())
+ && (fSystemState.hasObjectWithName(name))) {
+
+ result = fSystemState.objectByName(name).value();
+ }
+
+ return result;
+ }
+
+
+ /**
+ * returns all currently available variable mappings, i.e. all mappings
+ * in the current level. if a variable name is mapped in different frames,
+ * the mapping in the most recent frame is used. (the one that would be
+ * accessed by a {@code lookUp})
+ * @return all current variable mappings
+ */
+ public Map getCurrentMappings() {
+ return fCurrentFrame;
+ }
+
+
+ /**
+ * removes the most recent mapping of this variable name on the current
+ * level of this variable environment
+ *
+ * @param name the variable's name
+ */
+ public void remove(String name) {
+ fFrames.peek().remove(name);
+ }
+
+
+ /**
+ * updates the references to a deleted object
+ *
+ * All variables on all levels referencing to the supplied object reference
+ * to the corresponding undefined value afterwards.
+ *
+ * @param object the object that was deleted
+ */
+ public void undefineReferencesTo(MObject object) {
+
+ for (Map frame : fFrames) {
+ for (Entry entry : frame.entrySet()) {
+ Value value = entry.getValue();
+ if ((value.isObject()) &&
+ ((ObjectValue)value).value() == object) {
+
+ // use the type of this value to find the correct
+ // 'undefined' value; the object type might be more
+ // specific, and we want to preserve type of this
+ // variable
+ entry.setValue(UndefinedValue.instance);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * returns the names of all variables in the top level frame (the first
+ * frame of the first level) referencing the supplied object
+ *
+ * @param object the referenced object
+ * @return the names of top-level variables referencing the object
+ */
+ public List getTopLevelReferencesTo(MObject object) {
+
+ List result = new ArrayList<>();
+
+ for (Entry entry : fFrames.peekFirst().entrySet()) {
+ Value value = entry.getValue();
+ if ((value.isObject()) &&
+ ((ObjectValue)value).value() == object) {
+
+ result.add(entry.getKey());
+ }
+ }
+
+ return result;
+ }
+
+
+
+
+
+ /**
+ * constructs a variable bindings in {@code VarBindings}
+ * format from this {@code VariableEnvironment}
+ *
+ * Note that the level/frame structure is not duplicated, i.e. if this
+ * variable environment contains more than one mapping for a
+ * variable, only the most recent is added to the variable
+ * bindings.
+ *
+ * @see VarBindings
+ * @return the constructed object
+ */
+ public VarBindings constructVarBindings() {
+ VarBindings result = null;
+
+ if (fObjectVisibility.peek()) {
+ result = new VarBindings(fSystemState);
+ } else {
+ result = new VarBindings();
+ }
+
+ for (Entry entry : fCurrentFrame.entrySet()) {
+ String name = entry.getKey();
+ Value value = entry.getValue();
+
+ result.push(name, value);
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String toString() {
+
+ final String COLON = " : ";
+ final String EQUAL = " = ";
+ final String NEWLN = System.lineSeparator();
+ final String FRPRE = "[frame ";
+ final String FRPST = "]" + NEWLN;
+ final String EMPTY = "empty" + NEWLN;
+ String VAR_INDENT;
+
+ int numFrames = fFrames.size();
+ int numObjects = fSystemState.numObjects();
+ boolean printFrameNum = ((numFrames > 1) || (numObjects > 0));
+
+ VAR_INDENT = printFrameNum ? " " : "";
+
+ StringBuilder sb = new StringBuilder();
+
+ int currentFrame = (numFrames - 1);
+
+ for (Map frame : fFrames) {
+ if (printFrameNum) {
+ sb.append(FRPRE);
+ sb.append(currentFrame--);
+ sb.append(FRPST);
+ }
+
+ if (frame.isEmpty()) {
+ sb.append(VAR_INDENT);
+ sb.append(EMPTY);
+ }
+
+ for (Entry entry : frame.entrySet()) {
+ sb.append(VAR_INDENT);
+ sb.append(entry.getKey());
+ sb.append(COLON);
+ sb.append(entry.getValue().type());
+ sb.append(EQUAL);
+ sb.append(entry.getValue());
+ sb.append(NEWLN);
+ }
+ }
+
+ if (numObjects > 0) {
+
+ sb.append("[object variables]");
+ sb.append(NEWLN);
+
+ List objectNames =
+ new LinkedList<>(fSystemState.allObjectNames());
+ Collections.sort(objectNames);
+
+ for (String objectName : objectNames) {
+ MObject object = fSystemState.objectByName(objectName);
+
+ sb.append(VAR_INDENT);
+ sb.append(objectName);
+ sb.append(COLON);
+ sb.append(object.cls());
+ sb.append(EQUAL);
+ sb.append(object.value());
+ sb.append(NEWLN);
+ }
+ }
+
+ return sb.toString();
+ }
}
\ No newline at end of file
diff --git a/use-core/src/main/java/org/tzi/use/util/soil/VariableSet.java b/use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableSet.java
similarity index 95%
rename from use-core/src/main/java/org/tzi/use/util/soil/VariableSet.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableSet.java
index d73ed902f..77118133b 100644
--- a/use-core/src/main/java/org/tzi/use/util/soil/VariableSet.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/soil/VariableSet.java
@@ -1,401 +1,401 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.soil;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import org.tzi.use.uml.ocl.type.Type;
-
-
-/**
- * A {@code VariableSet} is a set of {@link Type typed} variables and
- * provides operations to construct the {@link #add(VariableSet) union},
- * {@link #remove(VariableSet) difference} and two polymorphic differences
- * ( {@link #removePolymorphic1(VariableSet) 1},
- * {@link #removePolymorphic2(VariableSet) 2} ) between {@code VariableSet}s.
- *
- * @author Daniel Gent
- */
-public class VariableSet {
- /** maps variable names to the set of their types */
- private Map> fEntries =
- new HashMap>();
-
-
- /**
- * constructs an empty {@code VariableSet}
- */
- public VariableSet() {
-
- }
-
-
- /**
- * copy constructor
- *
- * @param other {@code VariableSet} whose entries are copied
- */
- public VariableSet(VariableSet other) {
- add(other);
- }
-
-
- /**
- * returns the names of all variables in this
- *
- * @return the names of all variables in this
- */
- public Set getNames() {
- return fEntries.keySet();
- }
-
-
- /**
- * returns the names of variables, which exists in this and the supplied
- * {@code VariableSet}
- *
- * @param other another {@code VariableSet}
- * @return the set of all common variable names (empty set if there are none)
- */
- public Set getCommonNames(VariableSet other) {
- Set result = new HashSet(fEntries.keySet());
- result.retainAll(other.fEntries.keySet());
-
- return result;
- }
-
-
- /**
- * returns all types of the variable specified by the supplied name
- *
- * @param name the name of the variable whose types are requested
- * @return a set containing the types of the variable with that name, or
- * {@code null} if there is no variable with that name
- */
- public Set getTypes(String name) {
- return fEntries.get(name);
- }
-
-
- /**
- * returns the (first) type of the variable specified by the supplied
- * name.
- *
- * @param name the name of the variable whose (first) type is requested
- * @return the (first) type of the variable with that name, or {@code null}
- * if there is no variable with that name
- */
- public Type getType(String name) {
- if (contains(name)) {
- return fEntries.get(name).iterator().next();
- } else {
- return null;
- }
- }
-
-
- /**
- * returns true if this contains a variable with the specified name
- *
- * @param name the name of the variable whose presence is to be tested
- * @return true if this contains a variable with the specified name
- */
- public boolean contains(String name) {
- return fEntries.containsKey(name);
- }
-
-
- /**
- * returns true if this contains a variable with the specified name and type
- *
- * @param name name of the variable whose presence is to be tested
- * @param type type of the variable whose presence is to be tested
- * @return true if this contains a variable with the specified name and type
- */
- public boolean contains(String name, Type type) {
- return fEntries.containsKey(name) && fEntries.get(name).contains(type);
- }
-
-
- /**
- * returns true if this contains everything which exists in the other
- * {@code VariableSet}
- *
- * @param other another {@code VariableSet}
- * @return true if this contains everything which exists in the other
- * {@code VariableSet}
- */
- public boolean containsAll(VariableSet other) {
- for (String name : other.getNames()) {
- for (Type type : other.getTypes(name)) {
- if (!contains(name, type)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
-
- /**
- * returns true if this contains no variables
- *
- * @return true if this contains no variables
- */
- public boolean isEmpty() {
- return fEntries.isEmpty();
- }
-
-
- /**
- * adds a new typed variable to this
- *
- * @param name the variable's name
- * @param type the variable's type
- */
- public void add(String name, Type type) {
- if (fEntries.containsKey(name)) {
- fEntries.get(name).add(type);
- } else {
- Set newEntry = new LinkedHashSet();
- newEntry.add(type);
-
- fEntries.put(name, newEntry);
- }
- }
-
-
- /**
- * adds the contents of another {@code VariableSet} to this
- *
- * this method is essentially a set union operation
- *
- * @see #union(VariableSet, VariableSet)
- * @param other the {@code VariableSet} whose contents are added to this
- */
- public void add(VariableSet other) {
- for (Entry> entry : other.fEntries.entrySet()) {
- String name = entry.getKey();
- Set types = entry.getValue();
-
- if (fEntries.containsKey(name)) {
- fEntries.get(name).addAll(types);
- } else {
- fEntries.put(name, new LinkedHashSet(types));
- }
- }
- }
-
-
- /**
- * removes each element, which exists in both this and the other
- * {@code VariableSet} from this
- *
- * this method is essentially a set difference operation
- *
- * @see #difference(VariableSet, VariableSet)
- * @param other the {@code VariableSet} whose contents are removed from this
- */
- public void remove(VariableSet other) {
- if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
- return;
- }
-
- for (String name : getCommonNames(other)) {
- Set theseTypes = fEntries.get(name);
- Set thoseTypes = other.fEntries.get(name);
-
- theseTypes.removeAll(thoseTypes);
- if (theseTypes.isEmpty()) {
- fEntries.remove(name);
- }
- }
- }
-
-
- /**
- * removes all variables in this, which also exist in the other
- * {@code VariableSet}, disregarding types
- *
- * @param other the {@code VariableSet} whose contents are removed from this
- */
- public void removePolymorphic1(VariableSet other) {
- if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
- return;
- }
-
- for (String name : getCommonNames(other)) {
- fEntries.remove(name);
- }
- }
-
-
- /**
- * removes all variables in this, which exist with a more specific type in
- * the other {@code VariableSet}
- *
- * @param other the {@code VariableSet} whose contents are removed from this
- */
- public void removePolymorphic2(VariableSet other) {
- if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
- return;
- }
-
- Set commonNames = getCommonNames(other);
-
- if (commonNames.isEmpty()) {
- return;
- }
-
- List toDelete = new ArrayList();
- for (String name : commonNames) {
- Set theseTypes = fEntries.get(name);
- Set thoseTypes = other.fEntries.get(name);
-
- for (Type thisType : theseTypes) {
- for (Type thatType : thoseTypes) {
- if (thatType.conformsTo(thisType)) {
- toDelete.add(thisType);
- break;
- }
- }
- }
-
- theseTypes.removeAll(toDelete);
- if (theseTypes.isEmpty()) {
- fEntries.remove(name);
- }
-
- toDelete.clear();
- }
- }
-
-
- /**
- * constructs {@code A U B} (union of sets)
- *
- * @param vA a {@code VariableSet}
- * @param vB another {@code VariableSet}
- * @return a new {@code VariableSet}
- */
- public static VariableSet union(VariableSet vA, VariableSet vB) {
- VariableSet result = new VariableSet(vA);
- result.add(vB);
-
- return result;
- }
-
-
- /**
- * constructs {@code A \ B} (difference of sets)
- *
- * @param vA a {@code VariableSet}
- * @param vB another {@code VariableSet}
- * @return a new {@code VariableSet}
- */
- public static VariableSet difference(VariableSet vA, VariableSet vB) {
- VariableSet result = new VariableSet(vA);
- result.remove(vB);
-
- return result;
- }
-
-
- /**
- * constructs the first
- * {@link #removePolymorphic1(VariableSet) polymorphic difference} between
- * vA and vB
- *
- * @param vA a {@code VariableSet}
- * @param vB another {@code VariableSet}
- * @return a new {@code VariableSet}
- */
- public static VariableSet polymorphicDifference1(
- VariableSet vA,
- VariableSet vB) {
-
- VariableSet result = new VariableSet(vA);
- result.removePolymorphic1(vB);
-
- return result;
- }
-
-
- /**
- * constructs the second
- * {@link #removePolymorphic2(VariableSet) polymorphic difference} between
- * vA and vB
- *
- * @param vA a {@code VariableSet}
- * @param vB another {@code VariableSet}
- * @return a new {@code VariableSet}
- */
- public static VariableSet polymorphicDifference2(
- VariableSet vA,
- VariableSet vB) {
-
- VariableSet result = new VariableSet(vA);
- result.removePolymorphic2(vB);
-
- return result;
- }
-
-
- @Override
- public String toString() {
- if (fEntries.isEmpty()) {
- return "{ }";
- }
-
- final String LBRAC = "{";
- final String RBRAC = "}";
- final String COLON = ":";
- final String COMMA = ",";
-
- StringBuilder sb = new StringBuilder();
-
- sb.append(LBRAC);
- for (String name : fEntries.keySet()) {
- for (Type type : fEntries.get(name)) {
- sb.append(name);
- sb.append(COLON);
- sb.append(type);
- sb.append(COMMA);
- }
- }
-
- sb.delete(
- (sb.length() - COMMA.length()),
- sb.length());
-
- sb.append(RBRAC);
-
- return sb.toString();
- }
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.soil;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.tzi.use.uml.ocl.type.Type;
+
+
+/**
+ * A {@code VariableSet} is a set of {@link Type typed} variables and
+ * provides operations to construct the {@link #add(VariableSet) union},
+ * {@link #remove(VariableSet) difference} and two polymorphic differences
+ * ( {@link #removePolymorphic1(VariableSet) 1},
+ * {@link #removePolymorphic2(VariableSet) 2} ) between {@code VariableSet}s.
+ *
+ * @author Daniel Gent
+ */
+public class VariableSet {
+ /** maps variable names to the set of their types */
+ private Map> fEntries =
+ new HashMap>();
+
+
+ /**
+ * constructs an empty {@code VariableSet}
+ */
+ public VariableSet() {
+
+ }
+
+
+ /**
+ * copy constructor
+ *
+ * @param other {@code VariableSet} whose entries are copied
+ */
+ public VariableSet(VariableSet other) {
+ add(other);
+ }
+
+
+ /**
+ * returns the names of all variables in this
+ *
+ * @return the names of all variables in this
+ */
+ public Set getNames() {
+ return fEntries.keySet();
+ }
+
+
+ /**
+ * returns the names of variables, which exists in this and the supplied
+ * {@code VariableSet}
+ *
+ * @param other another {@code VariableSet}
+ * @return the set of all common variable names (empty set if there are none)
+ */
+ public Set getCommonNames(VariableSet other) {
+ Set result = new HashSet(fEntries.keySet());
+ result.retainAll(other.fEntries.keySet());
+
+ return result;
+ }
+
+
+ /**
+ * returns all types of the variable specified by the supplied name
+ *
+ * @param name the name of the variable whose types are requested
+ * @return a set containing the types of the variable with that name, or
+ * {@code null} if there is no variable with that name
+ */
+ public Set getTypes(String name) {
+ return fEntries.get(name);
+ }
+
+
+ /**
+ * returns the (first) type of the variable specified by the supplied
+ * name.
+ *
+ * @param name the name of the variable whose (first) type is requested
+ * @return the (first) type of the variable with that name, or {@code null}
+ * if there is no variable with that name
+ */
+ public Type getType(String name) {
+ if (contains(name)) {
+ return fEntries.get(name).iterator().next();
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * returns true if this contains a variable with the specified name
+ *
+ * @param name the name of the variable whose presence is to be tested
+ * @return true if this contains a variable with the specified name
+ */
+ public boolean contains(String name) {
+ return fEntries.containsKey(name);
+ }
+
+
+ /**
+ * returns true if this contains a variable with the specified name and type
+ *
+ * @param name name of the variable whose presence is to be tested
+ * @param type type of the variable whose presence is to be tested
+ * @return true if this contains a variable with the specified name and type
+ */
+ public boolean contains(String name, Type type) {
+ return fEntries.containsKey(name) && fEntries.get(name).contains(type);
+ }
+
+
+ /**
+ * returns true if this contains everything which exists in the other
+ * {@code VariableSet}
+ *
+ * @param other another {@code VariableSet}
+ * @return true if this contains everything which exists in the other
+ * {@code VariableSet}
+ */
+ public boolean containsAll(VariableSet other) {
+ for (String name : other.getNames()) {
+ for (Type type : other.getTypes(name)) {
+ if (!contains(name, type)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+
+ /**
+ * returns true if this contains no variables
+ *
+ * @return true if this contains no variables
+ */
+ public boolean isEmpty() {
+ return fEntries.isEmpty();
+ }
+
+
+ /**
+ * adds a new typed variable to this
+ *
+ * @param name the variable's name
+ * @param type the variable's type
+ */
+ public void add(String name, Type type) {
+ if (fEntries.containsKey(name)) {
+ fEntries.get(name).add(type);
+ } else {
+ Set newEntry = new LinkedHashSet();
+ newEntry.add(type);
+
+ fEntries.put(name, newEntry);
+ }
+ }
+
+
+ /**
+ * adds the contents of another {@code VariableSet} to this
+ *
+ * this method is essentially a set union operation
+ *
+ * @see #union(VariableSet, VariableSet)
+ * @param other the {@code VariableSet} whose contents are added to this
+ */
+ public void add(VariableSet other) {
+ for (Entry> entry : other.fEntries.entrySet()) {
+ String name = entry.getKey();
+ Set types = entry.getValue();
+
+ if (fEntries.containsKey(name)) {
+ fEntries.get(name).addAll(types);
+ } else {
+ fEntries.put(name, new LinkedHashSet(types));
+ }
+ }
+ }
+
+
+ /**
+ * removes each element, which exists in both this and the other
+ * {@code VariableSet} from this
+ *
+ * this method is essentially a set difference operation
+ *
+ * @see #difference(VariableSet, VariableSet)
+ * @param other the {@code VariableSet} whose contents are removed from this
+ */
+ public void remove(VariableSet other) {
+ if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
+ return;
+ }
+
+ for (String name : getCommonNames(other)) {
+ Set theseTypes = fEntries.get(name);
+ Set thoseTypes = other.fEntries.get(name);
+
+ theseTypes.removeAll(thoseTypes);
+ if (theseTypes.isEmpty()) {
+ fEntries.remove(name);
+ }
+ }
+ }
+
+
+ /**
+ * removes all variables in this, which also exist in the other
+ * {@code VariableSet}, disregarding types
+ *
+ * @param other the {@code VariableSet} whose contents are removed from this
+ */
+ public void removePolymorphic1(VariableSet other) {
+ if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
+ return;
+ }
+
+ for (String name : getCommonNames(other)) {
+ fEntries.remove(name);
+ }
+ }
+
+
+ /**
+ * removes all variables in this, which exist with a more specific type in
+ * the other {@code VariableSet}
+ *
+ * @param other the {@code VariableSet} whose contents are removed from this
+ */
+ public void removePolymorphic2(VariableSet other) {
+ if (fEntries.isEmpty() || other.fEntries.isEmpty()) {
+ return;
+ }
+
+ Set commonNames = getCommonNames(other);
+
+ if (commonNames.isEmpty()) {
+ return;
+ }
+
+ List toDelete = new ArrayList();
+ for (String name : commonNames) {
+ Set theseTypes = fEntries.get(name);
+ Set thoseTypes = other.fEntries.get(name);
+
+ for (Type thisType : theseTypes) {
+ for (Type thatType : thoseTypes) {
+ if (thatType.conformsTo(thisType)) {
+ toDelete.add(thisType);
+ break;
+ }
+ }
+ }
+
+ theseTypes.removeAll(toDelete);
+ if (theseTypes.isEmpty()) {
+ fEntries.remove(name);
+ }
+
+ toDelete.clear();
+ }
+ }
+
+
+ /**
+ * constructs {@code A U B} (union of sets)
+ *
+ * @param vA a {@code VariableSet}
+ * @param vB another {@code VariableSet}
+ * @return a new {@code VariableSet}
+ */
+ public static VariableSet union(VariableSet vA, VariableSet vB) {
+ VariableSet result = new VariableSet(vA);
+ result.add(vB);
+
+ return result;
+ }
+
+
+ /**
+ * constructs {@code A \ B} (difference of sets)
+ *
+ * @param vA a {@code VariableSet}
+ * @param vB another {@code VariableSet}
+ * @return a new {@code VariableSet}
+ */
+ public static VariableSet difference(VariableSet vA, VariableSet vB) {
+ VariableSet result = new VariableSet(vA);
+ result.remove(vB);
+
+ return result;
+ }
+
+
+ /**
+ * constructs the first
+ * {@link #removePolymorphic1(VariableSet) polymorphic difference} between
+ * vA and vB
+ *
+ * @param vA a {@code VariableSet}
+ * @param vB another {@code VariableSet}
+ * @return a new {@code VariableSet}
+ */
+ public static VariableSet polymorphicDifference1(
+ VariableSet vA,
+ VariableSet vB) {
+
+ VariableSet result = new VariableSet(vA);
+ result.removePolymorphic1(vB);
+
+ return result;
+ }
+
+
+ /**
+ * constructs the second
+ * {@link #removePolymorphic2(VariableSet) polymorphic difference} between
+ * vA and vB
+ *
+ * @param vA a {@code VariableSet}
+ * @param vB another {@code VariableSet}
+ * @return a new {@code VariableSet}
+ */
+ public static VariableSet polymorphicDifference2(
+ VariableSet vA,
+ VariableSet vB) {
+
+ VariableSet result = new VariableSet(vA);
+ result.removePolymorphic2(vB);
+
+ return result;
+ }
+
+
+ @Override
+ public String toString() {
+ if (fEntries.isEmpty()) {
+ return "{ }";
+ }
+
+ final String LBRAC = "{";
+ final String RBRAC = "}";
+ final String COLON = ":";
+ final String COMMA = ",";
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(LBRAC);
+ for (String name : fEntries.keySet()) {
+ for (Type type : fEntries.get(name)) {
+ sb.append(name);
+ sb.append(COLON);
+ sb.append(type);
+ sb.append(COMMA);
+ }
+ }
+
+ sb.delete(
+ (sb.length() - COMMA.length()),
+ sb.length());
+
+ sb.append(RBRAC);
+
+ return sb.toString();
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionByNameComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionByNameComparator.java
similarity index 98%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionByNameComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionByNameComparator.java
index de87971b1..b1a36e553 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionByNameComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionByNameComparator.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.util.uml.sorting;
+package org.tzi.use.uml.sys.sorting;
import org.tzi.use.uml.mm.MPrePostCondition;
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionComparator.java
similarity index 98%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionComparator.java
index 384a2004f..3c08c4586 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalConditionComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalConditionComparator.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.util.uml.sorting;
+package org.tzi.use.uml.sys.sorting;
import org.tzi.use.uml.mm.MPrePostCondition;
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalInvariantComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalInvariantComparator.java
similarity index 98%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalInvariantComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalInvariantComparator.java
index 1465192af..46d303c1c 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalInvariantComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalInvariantComparator.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.util.uml.sorting;
+package org.tzi.use.uml.sys.sorting;
import java.util.Comparator;
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalNamedElementComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalNamedElementComparator.java
similarity index 97%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalNamedElementComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalNamedElementComparator.java
index 8f51e1d9e..94171771a 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalNamedElementComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalNamedElementComparator.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.util.uml.sorting;
+package org.tzi.use.uml.sys.sorting;
import java.util.Comparator;
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalOperationComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalOperationComparator.java
similarity index 97%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalOperationComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalOperationComparator.java
index 3da8b840e..d099cb772 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/AlphabeticalOperationComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/AlphabeticalOperationComparator.java
@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.util.uml.sorting;
+package org.tzi.use.uml.sys.sorting;
import java.util.Comparator;
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/UseFileOrderComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseFileOrderComparator.java
similarity index 94%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/UseFileOrderComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseFileOrderComparator.java
index 2b829d99e..8cc4e9b2d 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/UseFileOrderComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseFileOrderComparator.java
@@ -1,40 +1,40 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.uml.sorting;
-
-import java.util.Comparator;
-
-import org.tzi.use.uml.mm.UseFileLocatable;
-
-/**
- * A comparator that compares elements by the (line) order in the USE specification file.
- *
- * @author Frank Hilken
- */
-public class UseFileOrderComparator implements Comparator {
-
- @Override
- public int compare(UseFileLocatable o1, UseFileLocatable o2) {
- final int firstPosition = o1.getPositionInModel();
- final int secondPosition = o2.getPositionInModel();
- return Integer.compare(firstPosition, secondPosition);
- }
-
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.sorting;
+
+import java.util.Comparator;
+
+import org.tzi.use.uml.mm.UseFileLocatable;
+
+/**
+ * A comparator that compares elements by the (line) order in the USE specification file.
+ *
+ * @author Frank Hilken
+ */
+public class UseFileOrderComparator implements Comparator {
+
+ @Override
+ public int compare(UseFileLocatable o1, UseFileLocatable o2) {
+ final int firstPosition = o1.getPositionInModel();
+ final int secondPosition = o2.getPositionInModel();
+ return Integer.compare(firstPosition, secondPosition);
+ }
+
+}
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/UseModelElementFileOrderComparator.java b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseModelElementFileOrderComparator.java
similarity index 95%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/UseModelElementFileOrderComparator.java
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseModelElementFileOrderComparator.java
index 3857f22f5..f0d2c7f5d 100644
--- a/use-core/src/main/java/org/tzi/use/util/uml/sorting/UseModelElementFileOrderComparator.java
+++ b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/UseModelElementFileOrderComparator.java
@@ -1,48 +1,48 @@
-/*
- * USE - UML based specification environment
- * Copyright (C) 1999-2010 Mark Richters, University of Bremen
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.tzi.use.util.uml.sorting;
-
-import java.util.Comparator;
-
-import org.tzi.use.uml.mm.MModelElement;
-import org.tzi.use.uml.mm.UseFileLocatable;
-
-/**
- * A wrapper for {@link UseFileOrderComparator} using {@link MModelElement}s.
- *
- * Note: All accessed members must be a subtype of {@link UseFileLocatable}
- *
- * @author Frank Hilken
- */
-public class UseModelElementFileOrderComparator implements Comparator {
- private final UseFileOrderComparator comparator = new UseFileOrderComparator();
-
- /**
- * {@inheritDoc}
- *
- * Note: All accessed members must be a subtype of {@link UseFileLocatable}
- *
- * @throws ClassCastException when elements are not subtype of {@link UseFileLocatable}
- */
- @Override
- public int compare(MModelElement o1, MModelElement o2) {
- return comparator.compare((UseFileLocatable) o1, (UseFileLocatable) o2);
- }
-}
+/*
+ * USE - UML based specification environment
+ * Copyright (C) 1999-2010 Mark Richters, University of Bremen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.tzi.use.uml.sys.sorting;
+
+import java.util.Comparator;
+
+import org.tzi.use.uml.mm.MModelElement;
+import org.tzi.use.uml.mm.UseFileLocatable;
+
+/**
+ * A wrapper for {@link UseFileOrderComparator} using {@link MModelElement}s.
+ *
+ * Note: All accessed members must be a subtype of {@link UseFileLocatable}
+ *
+ * @author Frank Hilken
+ */
+public class UseModelElementFileOrderComparator implements Comparator {
+ private final UseFileOrderComparator comparator = new UseFileOrderComparator();
+
+ /**
+ * {@inheritDoc}
+ *
+ * Note: All accessed members must be a subtype of {@link UseFileLocatable}
+ *
+ * @throws ClassCastException when elements are not subtype of {@link UseFileLocatable}
+ */
+ @Override
+ public int compare(MModelElement o1, MModelElement o2) {
+ return comparator.compare((UseFileLocatable) o1, (UseFileLocatable) o2);
+ }
+}
diff --git a/use-core/src/main/java/org/tzi/use/util/uml/sorting/package.html b/use-core/src/main/java/org/tzi/use/uml/sys/sorting/package.html
similarity index 100%
rename from use-core/src/main/java/org/tzi/use/util/uml/sorting/package.html
rename to use-core/src/main/java/org/tzi/use/uml/sys/sorting/package.html
diff --git a/use-core/src/main/java/org/tzi/use/parser/SrcPos.java b/use-core/src/main/java/org/tzi/use/util/SrcPos.java
similarity index 97%
rename from use-core/src/main/java/org/tzi/use/parser/SrcPos.java
rename to use-core/src/main/java/org/tzi/use/util/SrcPos.java
index ea420bff6..db428afac 100644
--- a/use-core/src/main/java/org/tzi/use/parser/SrcPos.java
+++ b/use-core/src/main/java/org/tzi/use/util/SrcPos.java
@@ -17,7 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-package org.tzi.use.parser;
+package org.tzi.use.util;
+import org.tzi.use.util.SrcPos;
import org.antlr.runtime.Token;
diff --git a/use-core/src/main/resources/grammars/generator/Generator.gpart b/use-core/src/main/resources/grammars/generator/Generator.gpart
index 33f87b964..af8341044 100644
--- a/use-core/src/main/resources/grammars/generator/Generator.gpart
+++ b/use-core/src/main/resources/grammars/generator/Generator.gpart
@@ -41,6 +41,7 @@ import java.util.HashSet;
package org.tzi.use.parser.generator;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
}
@lexer::members {
diff --git a/use-core/src/main/resources/grammars/ocl/OCL.gpart b/use-core/src/main/resources/grammars/ocl/OCL.gpart
index a70bff246..1a4cf51cb 100644
--- a/use-core/src/main/resources/grammars/ocl/OCL.gpart
+++ b/use-core/src/main/resources/grammars/ocl/OCL.gpart
@@ -42,6 +42,7 @@ package org.tzi.use.parser.ocl;
import java.io.PrintWriter;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
}
@lexer::members {
diff --git a/use-core/src/main/resources/grammars/shell/ShellCommand.gpart b/use-core/src/main/resources/grammars/shell/ShellCommand.gpart
index b8eddd6f8..db2f4e0e9 100644
--- a/use-core/src/main/resources/grammars/shell/ShellCommand.gpart
+++ b/use-core/src/main/resources/grammars/shell/ShellCommand.gpart
@@ -57,6 +57,7 @@ import java.util.Arrays;
package org.tzi.use.parser.shell;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
}
@lexer::members {
diff --git a/use-core/src/main/resources/grammars/soil/Soil.gpart b/use-core/src/main/resources/grammars/soil/Soil.gpart
index 63feb0290..c9930f39f 100644
--- a/use-core/src/main/resources/grammars/soil/Soil.gpart
+++ b/use-core/src/main/resources/grammars/soil/Soil.gpart
@@ -56,6 +56,7 @@ import java.util.Collections;
package org.tzi.use.parser.soil;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
}
@lexer::members {
diff --git a/use-core/src/main/resources/grammars/testsuite/TestSuite.gpart b/use-core/src/main/resources/grammars/testsuite/TestSuite.gpart
index 3bf864166..824f11a9f 100644
--- a/use-core/src/main/resources/grammars/testsuite/TestSuite.gpart
+++ b/use-core/src/main/resources/grammars/testsuite/TestSuite.gpart
@@ -56,6 +56,7 @@ import java.util.Arrays;
package org.tzi.use.parser.testsuite;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
}
@lexer::members {
diff --git a/use-core/src/main/resources/grammars/use/USE.gpart b/use-core/src/main/resources/grammars/use/USE.gpart
index c46373d33..cb35c84d2 100644
--- a/use-core/src/main/resources/grammars/use/USE.gpart
+++ b/use-core/src/main/resources/grammars/use/USE.gpart
@@ -83,6 +83,7 @@ import java.util.HashSet;
package org.tzi.use.parser.use;
import org.tzi.use.parser.ParseErrorHandler;
+import org.tzi.use.util.SrcPos;
// ------------------------------------
// USE parser
// ------------------------------------
diff --git a/use-core/src/test/java/org/tzi/use/TestSystem.java b/use-core/src/test/java/org/tzi/use/TestSystem.java
index e0604c143..d9ef36485 100644
--- a/use-core/src/test/java/org/tzi/use/TestSystem.java
+++ b/use-core/src/test/java/org/tzi/use/TestSystem.java
@@ -47,7 +47,7 @@
import org.tzi.use.uml.sys.soil.MEmptyStatement;
import org.tzi.use.uml.sys.soil.MObjectOperationCallStatement;
import org.tzi.use.uml.sys.soil.MVariableAssignmentStatement;
-import org.tzi.use.util.soil.VariableEnvironment;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
/**
* Helper to setup a test system.
diff --git a/use-core/src/test/java/org/tzi/use/uml/mm/MAssociationClassTest.java b/use-core/src/test/java/org/tzi/use/uml/mm/MAssociationClassTest.java
index fd6734d89..632bb1a00 100644
--- a/use-core/src/test/java/org/tzi/use/uml/mm/MAssociationClassTest.java
+++ b/use-core/src/test/java/org/tzi/use/uml/mm/MAssociationClassTest.java
@@ -19,6 +19,8 @@
package org.tzi.use.uml.mm;
+import org.tzi.use.core.test.TestModelUtil;
+
import java.util.Collections;
import java.util.List;
diff --git a/use-core/src/test/java/org/tzi/use/uml/mm/MImportedModelTest.java b/use-core/src/test/java/org/tzi/use/uml/mm/MImportedModelTest.java
index bca36fa88..9317a607b 100644
--- a/use-core/src/test/java/org/tzi/use/uml/mm/MImportedModelTest.java
+++ b/use-core/src/test/java/org/tzi/use/uml/mm/MImportedModelTest.java
@@ -18,6 +18,8 @@
*/
package org.tzi.use.uml.mm;
+import org.tzi.use.core.test.TestModelUtil;
+
import org.junit.Test;
import org.tzi.use.api.UseApiException;
import org.tzi.use.api.UseModelApi;
diff --git a/use-core/src/test/java/org/tzi/use/uml/mm/ModelCreationTest.java b/use-core/src/test/java/org/tzi/use/uml/mm/ModelCreationTest.java
index a65459ab9..735c8692a 100644
--- a/use-core/src/test/java/org/tzi/use/uml/mm/ModelCreationTest.java
+++ b/use-core/src/test/java/org/tzi/use/uml/mm/ModelCreationTest.java
@@ -19,6 +19,8 @@
package org.tzi.use.uml.mm;
+import org.tzi.use.core.test.TestModelUtil;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
diff --git a/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestProtocolStateMachine.java b/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestProtocolStateMachine.java
index ad991a92b..d79061d1c 100644
--- a/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestProtocolStateMachine.java
+++ b/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestProtocolStateMachine.java
@@ -22,7 +22,7 @@
import org.junit.Test;
import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
import org.tzi.use.uml.ocl.expr.ExpressionWithValue;
import org.tzi.use.uml.ocl.value.BooleanValue;
import org.tzi.use.uml.sys.MSystemException;
diff --git a/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestSignals.java b/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestSignals.java
index ea341ab74..433db98f4 100644
--- a/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestSignals.java
+++ b/use-core/src/test/java/org/tzi/use/uml/mm/statemachines/TestSignals.java
@@ -29,7 +29,7 @@
import org.tzi.use.uml.mm.MInvalidModelException;
import org.tzi.use.uml.mm.MModel;
import org.tzi.use.uml.mm.ModelFactory;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
import org.tzi.use.uml.mm.commonbehavior.communications.MSignal;
/**
diff --git a/use-core/src/test/java/org/tzi/use/uml/ocl/type/TypeTest2.java b/use-core/src/test/java/org/tzi/use/uml/ocl/type/TypeTest2.java
new file mode 100644
index 000000000..62657b44b
--- /dev/null
+++ b/use-core/src/test/java/org/tzi/use/uml/ocl/type/TypeTest2.java
@@ -0,0 +1,8 @@
+package org.tzi.use.uml.ocl.type;
+
+public class TypeTest2 {
+ public void testP() {
+ Type t = TypeFactory.mkBoolean();
+ System.out.println(t.shortName());
+ }
+}
diff --git a/use-core/src/test/java/org/tzi/use/uml/sys/LinkTest.java b/use-core/src/test/java/org/tzi/use/uml/sys/LinkTest.java
index c2a3ea159..0d39cb37c 100644
--- a/use-core/src/test/java/org/tzi/use/uml/sys/LinkTest.java
+++ b/use-core/src/test/java/org/tzi/use/uml/sys/LinkTest.java
@@ -29,7 +29,7 @@
import org.tzi.use.uml.mm.MAssociation;
import org.tzi.use.uml.mm.MAssociationClass;
import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
/**
diff --git a/use-core/src/test/java/org/tzi/use/uml/sys/ObjectCreation.java b/use-core/src/test/java/org/tzi/use/uml/sys/ObjectCreation.java
index c9d449df2..6dfa2d71c 100644
--- a/use-core/src/test/java/org/tzi/use/uml/sys/ObjectCreation.java
+++ b/use-core/src/test/java/org/tzi/use/uml/sys/ObjectCreation.java
@@ -22,7 +22,7 @@
import org.tzi.use.api.UseApiException;
import org.tzi.use.api.UseSystemApi;
import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
/**
diff --git a/use-core/src/test/java/org/tzi/use/uml/sys/soil/StatementEffectTest.java b/use-core/src/test/java/org/tzi/use/uml/sys/soil/StatementEffectTest.java
index 8f540574e..a763b0e57 100644
--- a/use-core/src/test/java/org/tzi/use/uml/sys/soil/StatementEffectTest.java
+++ b/use-core/src/test/java/org/tzi/use/uml/sys/soil/StatementEffectTest.java
@@ -39,7 +39,7 @@
import org.tzi.use.uml.sys.*;
import org.tzi.use.uml.sys.ppcHandling.SoilPPCHandler;
import org.tzi.use.util.NullPrintWriter;
-import org.tzi.use.util.soil.VariableEnvironment;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
/**
diff --git a/use-core/src/test/java/org/tzi/use/utilcore/soil/StateChangesTest.java b/use-core/src/test/java/org/tzi/use/utilcore/soil/StateChangesTest.java
index 49bb8303a..c99863282 100644
--- a/use-core/src/test/java/org/tzi/use/utilcore/soil/StateChangesTest.java
+++ b/use-core/src/test/java/org/tzi/use/utilcore/soil/StateChangesTest.java
@@ -30,14 +30,14 @@
import org.tzi.use.uml.mm.MAssociationClass;
import org.tzi.use.uml.mm.MClass;
import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
import org.tzi.use.uml.sys.MLink;
import org.tzi.use.uml.sys.MLinkObject;
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystem;
import org.tzi.use.uml.sys.MSystemException;
import org.tzi.use.uml.sys.MSystemState;
-import org.tzi.use.util.soil.StateDifference;
+import org.tzi.use.uml.sys.soil.StateDifference;
/**
diff --git a/use-core/src/test/java/org/tzi/use/utilcore/soil/SymbolTableTest.java b/use-core/src/test/java/org/tzi/use/utilcore/soil/SymbolTableTest.java
index 2b3efc55b..d32adbc70 100644
--- a/use-core/src/test/java/org/tzi/use/utilcore/soil/SymbolTableTest.java
+++ b/use-core/src/test/java/org/tzi/use/utilcore/soil/SymbolTableTest.java
@@ -27,7 +27,7 @@
import org.tzi.use.parser.soil.ast.ASTStatement;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
-import org.tzi.use.util.soil.SymbolTable;
+import org.tzi.use.parser.soil.environment.SymbolTable;
/**
diff --git a/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableEnvironmentTest.java b/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableEnvironmentTest.java
index 9f106cb2c..504a3be29 100644
--- a/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableEnvironmentTest.java
+++ b/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableEnvironmentTest.java
@@ -36,8 +36,8 @@
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystem;
import org.tzi.use.uml.sys.MSystemException;
-import org.tzi.use.util.soil.SymbolTable;
-import org.tzi.use.util.soil.VariableEnvironment;
+import org.tzi.use.parser.soil.environment.SymbolTable;
+import org.tzi.use.uml.sys.soil.VariableEnvironment;
/**
@@ -272,7 +272,7 @@ public void testConstructSymbolTable() {
ve.assign(n3, v3);
// ST
// [n1 -> Type(v1), n2 -> Type(v2), n3 -> Type(v3)]
- SymbolTable st = ve.constructSymbolTable();
+ SymbolTable st = new SymbolTable(ve);
assertEquals(st.getType(n1), v1.type());
assertEquals(st.getType(n2), v2.type());
assertEquals(st.getType(n3), v3.type());
@@ -284,7 +284,7 @@ public void testConstructSymbolTable() {
ve.assign(n3, v1);
// ST
// [n1 -> Type(v2), n2 -> Type(v3), n3 -> Type(v1)]
- st = ve.constructSymbolTable();
+ st = new SymbolTable(ve);
assertEquals(st.getType(n1), v2.type());
assertEquals(st.getType(n2), v3.type());
assertEquals(st.getType(n3), v1.type());
diff --git a/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableSetTest.java b/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableSetTest.java
index ec8b30fbd..f56030917 100644
--- a/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableSetTest.java
+++ b/use-core/src/test/java/org/tzi/use/utilcore/soil/VariableSetTest.java
@@ -27,7 +27,7 @@
import org.junit.Test;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
-import org.tzi.use.util.soil.VariableSet;
+import org.tzi.use.uml.sys.soil.VariableSet;
/**
diff --git a/use-gui/maven_cyclic_dependencies_entire_project_results.csv b/use-gui/maven_cyclic_dependencies_entire_project_results.csv
new file mode 100644
index 000000000..e9f960cf4
--- /dev/null
+++ b/use-gui/maven_cyclic_dependencies_entire_project_results.csv
@@ -0,0 +1 @@
+600
diff --git a/use-gui/maven_cyclic_dependencies_gui_results.csv b/use-gui/maven_cyclic_dependencies_gui_results.csv
new file mode 100644
index 000000000..8351c1939
--- /dev/null
+++ b/use-gui/maven_cyclic_dependencies_gui_results.csv
@@ -0,0 +1 @@
+14
diff --git a/use-gui/maven_cyclic_dependencies_runtime_results.csv b/use-gui/maven_cyclic_dependencies_runtime_results.csv
new file mode 100644
index 000000000..920a13966
--- /dev/null
+++ b/use-gui/maven_cyclic_dependencies_runtime_results.csv
@@ -0,0 +1 @@
+43
diff --git a/use-gui/maven_cyclic_dependencies_shell_results.csv b/use-gui/maven_cyclic_dependencies_shell_results.csv
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/use-gui/maven_cyclic_dependencies_shell_results.csv
@@ -0,0 +1 @@
+1
diff --git a/use-gui/pom.xml b/use-gui/pom.xml
index 046f9540e..26baf4326 100644
--- a/use-gui/pom.xml
+++ b/use-gui/pom.xml
@@ -16,6 +16,13 @@
use-core
${project.version}
+
+ ${project.groupId}
+ use-core
+ ${project.version}
+ test-jar
+ test
+
com.google.guava
guava
diff --git a/use-gui/src/main/java/org/tzi/use/gui/main/MainWindow.java b/use-gui/src/main/java/org/tzi/use/gui/main/MainWindow.java
index 7caea0daf..a2e98ece6 100644
--- a/use-gui/src/main/java/org/tzi/use/gui/main/MainWindow.java
+++ b/use-gui/src/main/java/org/tzi/use/gui/main/MainWindow.java
@@ -47,6 +47,7 @@
import org.tzi.use.main.Session.EvaluatedStatement;
import org.tzi.use.main.runtime.IRuntime;
import org.tzi.use.main.shell.Shell;
+import org.tzi.use.parser.generator.ASSLCompiler;
import org.tzi.use.parser.use.USECompiler;
import org.tzi.use.runtime.gui.impl.PluginActionProxy;
import org.tzi.use.uml.mm.MClass;
@@ -1178,6 +1179,7 @@ protected boolean compile(final Path f) {
fLogWriter.println(model.getStats());
// create system
system = new MSystem(model);
+ system.setInvariantCompiler(ASSLCompiler::compileInvariants);
} else {
system = null;
}
diff --git a/use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowserSorting.java b/use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowserSorting.java
index 2cd24d648..7888595a7 100644
--- a/use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowserSorting.java
+++ b/use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowserSorting.java
@@ -32,12 +32,12 @@
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.mm.statemachines.MStateMachine;
-import org.tzi.use.util.uml.sorting.AlphabeticalConditionByNameComparator;
-import org.tzi.use.util.uml.sorting.AlphabeticalConditionComparator;
-import org.tzi.use.util.uml.sorting.AlphabeticalInvariantComparator;
-import org.tzi.use.util.uml.sorting.AlphabeticalNamedElementComparator;
-import org.tzi.use.util.uml.sorting.AlphabeticalOperationComparator;
-import org.tzi.use.util.uml.sorting.UseFileOrderComparator;
+import org.tzi.use.uml.sys.sorting.AlphabeticalConditionByNameComparator;
+import org.tzi.use.uml.sys.sorting.AlphabeticalConditionComparator;
+import org.tzi.use.uml.sys.sorting.AlphabeticalInvariantComparator;
+import org.tzi.use.uml.sys.sorting.AlphabeticalNamedElementComparator;
+import org.tzi.use.uml.sys.sorting.AlphabeticalOperationComparator;
+import org.tzi.use.uml.sys.sorting.UseFileOrderComparator;
/**
diff --git a/use-gui/src/main/java/org/tzi/use/gui/mainFX/MainWindow.java b/use-gui/src/main/java/org/tzi/use/gui/mainFX/MainWindow.java
index 157bd4aee..fd291c117 100644
--- a/use-gui/src/main/java/org/tzi/use/gui/mainFX/MainWindow.java
+++ b/use-gui/src/main/java/org/tzi/use/gui/mainFX/MainWindow.java
@@ -74,6 +74,7 @@
import org.tzi.use.main.gui.Main;
import org.tzi.use.main.runtime.IRuntime;
import org.tzi.use.main.shell.Shell;
+import org.tzi.use.parser.generator.ASSLCompiler;
import org.tzi.use.parser.use.USECompiler;
import org.tzi.use.runtime.gui.impl.PluginActionProxy;
import org.tzi.use.uml.mm.MClass;
@@ -1831,6 +1832,7 @@ protected boolean compile(final Path f) {
fLogWriter.println(model.getStats());
// create system
system = new MSystem(model);
+ system.setInvariantCompiler(ASSLCompiler::compileInvariants);
system.getEventBus().register(this);
} else {
system = null;
diff --git a/use-gui/src/main/java/org/tzi/use/gui/mainFX/ModelBrowserSorting.java b/use-gui/src/main/java/org/tzi/use/gui/mainFX/ModelBrowserSorting.java
index 711326b89..8724718ce 100644
--- a/use-gui/src/main/java/org/tzi/use/gui/mainFX/ModelBrowserSorting.java
+++ b/use-gui/src/main/java/org/tzi/use/gui/mainFX/ModelBrowserSorting.java
@@ -23,7 +23,7 @@
import org.tzi.use.uml.mm.*;
import org.tzi.use.uml.mm.statemachines.MStateMachine;
-import org.tzi.use.util.uml.sorting.*;
+import org.tzi.use.uml.sys.sorting.*;
import javax.swing.event.EventListenerList;
import java.util.*;
diff --git a/use-gui/src/main/java/org/tzi/use/main/gui/fx/JavaFXAppLauncher.java b/use-gui/src/main/java/org/tzi/use/main/gui/fx/JavaFXAppLauncher.java
index 0de0b4026..5b44a7206 100644
--- a/use-gui/src/main/java/org/tzi/use/main/gui/fx/JavaFXAppLauncher.java
+++ b/use-gui/src/main/java/org/tzi/use/main/gui/fx/JavaFXAppLauncher.java
@@ -13,6 +13,8 @@
import org.tzi.use.main.Session;
import org.tzi.use.main.runtime.IRuntime;
import org.tzi.use.main.shell.Shell;
+import org.tzi.use.parser.generator.ASSLCompiler;
+import org.tzi.use.parser.ocl.OCLCompiler;
import org.tzi.use.parser.use.USECompiler;
import org.tzi.use.uml.mm.MMPrintVisitor;
import org.tzi.use.uml.mm.MMVisitor;
@@ -62,6 +64,7 @@ public void start(Stage primaryStage) throws Exception {
private void initExtensions() {
if (!Options.disableExtensions) {
ExtensionManager.EXTENSIONS_FOLDER = Options.homeDir + Options.FILE_SEPARATOR + "oclextensions";
+ ExtensionManager.getInstance().setTypeCompiler(OCLCompiler::compileType);
ExtensionManager.getInstance().loadExtensions();
}
}
@@ -120,6 +123,7 @@ private void compileSpecification(Stage primaryStage) throws IOException {
Log.verbose(model.getStats());
system = new MSystem(model);
+ system.setInvariantCompiler(ASSLCompiler::compileInvariants);
}
session.setSystem(system);
diff --git a/use-gui/src/main/java/org/tzi/use/main/gui/swing/MainSwing.java b/use-gui/src/main/java/org/tzi/use/main/gui/swing/MainSwing.java
index 0723eaa45..351b5f040 100644
--- a/use-gui/src/main/java/org/tzi/use/main/gui/swing/MainSwing.java
+++ b/use-gui/src/main/java/org/tzi/use/main/gui/swing/MainSwing.java
@@ -5,6 +5,8 @@
import org.tzi.use.main.Session;
import org.tzi.use.main.runtime.IRuntime;
import org.tzi.use.main.shell.Shell;
+import org.tzi.use.parser.generator.ASSLCompiler;
+import org.tzi.use.parser.ocl.OCLCompiler;
import org.tzi.use.parser.use.USECompiler;
import org.tzi.use.uml.mm.MMPrintVisitor;
import org.tzi.use.uml.mm.MMVisitor;
@@ -43,6 +45,7 @@ public void launch(String[] args) {
if (!Options.disableExtensions) {
ExtensionManager.EXTENSIONS_FOLDER = Options.homeDir + Options.FILE_SEPARATOR + "oclextensions";
+ ExtensionManager.getInstance().setTypeCompiler(OCLCompiler::compileType);
ExtensionManager.getInstance().loadExtensions();
}
@@ -98,6 +101,7 @@ public void launch(String[] args) {
Log.verbose(model.getStats());
system = new MSystem(model);
+ system.setInvariantCompiler(ASSLCompiler::compileInvariants);
}
session.setSystem(system);
diff --git a/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java b/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java
index ce5c49d93..5d2e9a91c 100644
--- a/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java
+++ b/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java
@@ -22,10 +22,12 @@
import org.tzi.use.config.Options;
import org.tzi.use.gen.tool.GGeneratorArguments;
import org.tzi.use.gen.tool.GNoResultException;
+import org.tzi.use.gen.tool.GGenerator;
import org.tzi.use.main.MonitorAspectGenerator;
import org.tzi.use.main.Session;
import org.tzi.use.main.runtime.IRuntime;
import org.tzi.use.main.shell.runtime.IPluginShellExtensionPoint;
+import org.tzi.use.parser.generator.ASSLCompiler;
import org.tzi.use.parser.ocl.OCLCompiler;
import org.tzi.use.parser.shell.ShellCommandCompiler;
import org.tzi.use.parser.testsuite.TestSuiteCompiler;
@@ -48,7 +50,7 @@
import org.tzi.use.uml.sys.soil.MEnterOperationStatement;
import org.tzi.use.uml.sys.soil.MExitOperationStatement;
import org.tzi.use.uml.sys.soil.MStatement;
-import org.tzi.use.uml.sys.testsuite.MTestSuite;
+import org.tzi.use.parser.testsuite.sys.MTestSuite;
import org.tzi.use.util.Log;
import org.tzi.use.util.Report;
import org.tzi.use.util.StringUtil;
@@ -56,7 +58,7 @@
import org.tzi.use.util.input.LineInput;
import org.tzi.use.util.input.Readline;
import org.tzi.use.util.input.SocketReadline;
-import org.tzi.use.util.soil.exceptions.EvaluationFailedException;
+import org.tzi.use.uml.sys.soil.EvaluationFailedException;
import java.io.*;
import java.net.InetAddress;
@@ -1247,6 +1249,7 @@ private void cmdOpenUseFile(String file) {
// create system
fSession.setSystem(new MSystem(model));
+ fSession.system().setInvariantCompiler(ASSLCompiler::compileInvariants);
}
setFileClosed();
@@ -1413,6 +1416,7 @@ private void cmdReset() throws NoSystemException {
private void cmdReloadExtensions() {
ExtensionManager.getInstance().unloadExtensions();
+ ExtensionManager.getInstance().setTypeCompiler(OCLCompiler::compileType);
ExtensionManager.getInstance().loadExtensions();
}
@@ -1539,7 +1543,7 @@ private void cmdGenUnloadInvariants(String str, MSystem system) {
}
private void cmdGenPrintLoadedInvariants(MSystem system) {
- system.generator().printLoadedInvariants();
+ this.generator(system).printLoadedInvariants();
}
private void cmdGenResult(String str, MSystem system) {
@@ -1547,12 +1551,12 @@ private void cmdGenResult(String str, MSystem system) {
try {
if (str.isEmpty()) {
PrintWriter pw = new PrintWriter(System.out);
- system.generator().printResult(pw);
+ this.generator(system).printResult(pw);
pw.flush();
} else if (str.equals("inv")) {
- system.generator().printResultStatistics();
+ this.generator(system).printResultStatistics();
} else if (str.equals("accept")) {
- system.generator().acceptResult();
+ this.generator(system).acceptResult();
} else {
Log.error("Unknown command `result " + str + "'. Try help.");
}
@@ -1634,7 +1638,7 @@ private void cmdGenInvariantFlags(String str, MSystem system) {
Log.error("syntax is `flags (-all|[invnames]) ((+d|-d) | (+n|-n))'");
}
else if (disabled == null && negated == null){
- system.generator().printInvariantFlags(invs);
+ this.generator(system).printInvariantFlags(invs);
}
else {
system.setClassInvariantFlags(invs, (disabled == null)? null : !disabled, negated);
@@ -1655,7 +1659,19 @@ private void cmdGenStartProcedure(String str, MSystem system) {
args.setFilename(this.getFilenameToOpen(args.getFilename()));
this.setFileClosed();
- system.generator().startProcedure(args.getCallString(), args);
+ this.generator(system).startProcedure(args.getCallString(), args);
+ }
+
+ private final java.util.Map systemGenerators = new java.util.WeakHashMap<>();
+
+ private GGenerator generator(MSystem system) {
+ GGenerator g = systemGenerators.get(system);
+ if (g == null) {
+ g = new GGenerator(system);
+ g.setProcedureCompiler(org.tzi.use.parser.generator.ASSLCompiler.PROCEDURE_COMPILER);
+ systemGenerators.put(system, g);
+ }
+ return g;
}
private MSystem system() throws NoSystemException {
diff --git a/use-gui/src/test/java/org/tzi/use/architecture/MavenCyclicDependenciesGUITest.java b/use-gui/src/test/java/org/tzi/use/architecture/MavenCyclicDependenciesGUITest.java
index 737895043..d9a72ea2b 100644
--- a/use-gui/src/test/java/org/tzi/use/architecture/MavenCyclicDependenciesGUITest.java
+++ b/use-gui/src/test/java/org/tzi/use/architecture/MavenCyclicDependenciesGUITest.java
@@ -7,8 +7,8 @@
import com.tngtech.archunit.library.dependencies.SliceAssignment;
import com.tngtech.archunit.library.dependencies.SliceIdentifier;
import com.tngtech.archunit.library.dependencies.SlicesRuleDefinition;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.FileWriter;
@@ -34,7 +34,7 @@ public class MavenCyclicDependenciesGUITest {
private static final String RUNTIME_PACKAGE_RESULTS = "maven_cyclic_dependencies_runtime_results.csv";
private static final String SHELL_PACKAGE_RESULTS = "maven_cyclic_dependencies_shell_results.csv";
- @Before
+ @BeforeEach
public void setup() {
// Delete the results file if it exists
File file = new File(GUI_PACKAGE_RESULTS);
diff --git a/use-gui/src/test/java/org/tzi/use/gui/views/diagrams/util/CreationTimeRecorderTest.java b/use-gui/src/test/java/org/tzi/use/gui/views/diagrams/util/CreationTimeRecorderTest.java
index a464bc6d0..6107891c0 100644
--- a/use-gui/src/test/java/org/tzi/use/gui/views/diagrams/util/CreationTimeRecorderTest.java
+++ b/use-gui/src/test/java/org/tzi/use/gui/views/diagrams/util/CreationTimeRecorderTest.java
@@ -28,7 +28,7 @@
import org.tzi.use.gui.views.diagrams.behavior.communicationdiagram.CreationTimeRecorder;
import org.tzi.use.gui.views.diagrams.behavior.communicationdiagram.MMessage;
import org.tzi.use.uml.mm.MModel;
-import org.tzi.use.uml.mm.TestModelUtil;
+import org.tzi.use.core.test.TestModelUtil;
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MSystem;
import org.tzi.use.uml.sys.events.Event;