Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracuccuru2013-03-07 18:52:25 +0000
committeracuccuru2013-03-07 18:52:25 +0000
commit3cec9052534e5918f65c9777b78e35cc0f061ed7 (patch)
treee97c3cc910d8ba8376f5e4efc8c4f6e43604fa5e
parentf5965fee15c2211f67c04b2eedff721d06fcbcd5 (diff)
downloadorg.eclipse.papyrus-3cec9052534e5918f65c9777b78e35cc0f061ed7.tar.gz
org.eclipse.papyrus-3cec9052534e5918f65c9777b78e35cc0f061ed7.tar.xz
org.eclipse.papyrus-3cec9052534e5918f65c9777b78e35cc0f061ed7.zip
Fixes bugs related to OMG issues:
- 402563: [moka] LoopNodeActivation does not correctly handle the firing of an activity final node https://bugs.eclipse.org/bugs/show_bug.cgi?id=402563 - 402570: [moka] Problem with ActivityExecution::terminate https://bugs.eclipse.org/bugs/show_bug.cgi?id=402570 - 402571: [moka] RealValue::toString puts too many digits in the mantissa https://bugs.eclipse.org/bugs/show_bug.cgi?id=402571 - 402572: [moka] Objects with cyclic references cannot be converted to string representations https://bugs.eclipse.org/bugs/show_bug.cgi?id=402572 - 402575: [moka] Feature values need to be created for private structural features of parent classifiers https://bugs.eclipse.org/bugs/show_bug.cgi?id=402575 This fix is provided by Ed Seidewitz. Cf. attachment 228086 of bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=402563
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/CompleteStructuredActivities/LoopNodeActivation.java36
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityExecution.java6
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/CompoundValue.java15
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/RealValue.java4
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/StructuredValue.java29
5 files changed, 63 insertions, 27 deletions
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/CompleteStructuredActivities/LoopNodeActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/CompleteStructuredActivities/LoopNodeActivation.java
index c50db083893..00f1a2f0a68 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/CompleteStructuredActivities/LoopNodeActivation.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/CompleteStructuredActivities/LoopNodeActivation.java
@@ -31,6 +31,7 @@ import org.eclipse.uml2.uml.Pin;
public class LoopNodeActivation extends StructuredActivityNodeActivation {
public List<Values> bodyOutputLists = new ArrayList<Values>();
+ public Boolean isTerminateAll;
public void doStructuredActivity() {
// Set the initial values for the body outputs to the values of the loop
@@ -48,9 +49,6 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
// consumed when running the test for the last time.]
LoopNode loopNode = (LoopNode)(this.node);
List<InputPin> loopVariableInputs = loopNode.getLoopVariableInputs();
- // List<OutputPin> loopVariables = loopNode.getLoopVariables();
- // List<OutputPin> resultPins = loopNode.getResults();
- // List<Values> bodyOutputLists = this.bodyOutputLists;
this.bodyOutputLists.clear(); // Added
@@ -60,6 +58,7 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
bodyOutputList.values = this.takeTokens(loopVariableInput);
this.bodyOutputLists.add(bodyOutputList);
}
+ this.isTerminateAll = false;
this.doLoop(true);
}
@@ -106,14 +105,14 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
continuing = this.runTest();
}
}
- if(this.isRunning() && !this.isSuspended()) {
+ if(!this.isTerminateAll & this.isRunning() & !this.isSuspended()) {
this.activationGroup.terminateAll();
} else {
continuing = false;
}
Debug.println("[doStructuredActivity] " + (continuing ? "Continuing." : this.isSuspended() ? "Suspended" : "Done."));
}
- if(this.isRunning() && !this.isSuspended()) {
+ if(!this.isTerminateAll & this.isRunning() & !this.isSuspended()) {
for(int i = 0; i < bodyOutputLists.size(); i++) {
Values bodyOutputList = bodyOutputLists.get(i);
OutputPin resultPin = resultPins.get(i);
@@ -144,7 +143,7 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
Debug.println("[runBody] Running body...");
LoopNode loopNode = (LoopNode)this.node;
this.activationGroup.runNodes(this.makeActivityNodeList(loopNode.getBodyParts()));
- if(!this.isSuspended()) {
+ if(!this.isTerminateAll && !this.isSuspended()) {
this.saveBodyOutputs();
}
}
@@ -190,11 +189,14 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
public void terminateAll() {
// Copy the values of the body outputs to the loop outputs, and then
// terminate all activations in the loop.
- List<OutputPin> resultPins = this.getResults(); // CHANGED from: ((LoopNode)this.node).getResults();
- for(int i = 0; i < bodyOutputLists.size(); i++) {
- Values bodyOutputList = bodyOutputLists.get(i);
+ this.isTerminateAll = true;
+ LoopNode loopNode = (LoopNode) this.node;
+ List<OutputPin> bodyOutputs = loopNode.getBodyOutputs();
+ List<OutputPin> resultPins = this.getResults();
+ for (int i = 0; i < bodyOutputs.size(); i++) {
+ OutputPin bodyOutput = bodyOutputs.get(i);
OutputPin resultPin = resultPins.get(i);
- this.putTokens(resultPin, bodyOutputList.values);
+ this.putTokens(resultPin, this.getPinValues(bodyOutput));
}
super.terminateAll();
}
@@ -205,12 +207,14 @@ public class LoopNodeActivation extends StructuredActivityNodeActivation {
// without being suspended again, complete the action.
LoopNode loopNode = (LoopNode)(this.node);
this.saveBodyOutputs();
- if(loopNode.isMustIsolate()) {
- _beginIsolation();
- this.continueLoop();
- _endIsolation();
- } else {
- this.continueLoop();
+ if (!this.isTerminateAll) {
+ if(loopNode.isMustIsolate()) {
+ _beginIsolation();
+ this.continueLoop();
+ _endIsolation();
+ } else {
+ this.continueLoop();
+ }
}
if(this.isSuspended()) {
// NOTE: If the subsequent iteration of the loop suspends it again,
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityExecution.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityExecution.java
index 7c95b284698..4703d817724 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityExecution.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityExecution.java
@@ -41,7 +41,7 @@ public class ActivityExecution extends Execution {
Debug.println("[event] Execute activity=" + activity.getName());
this.activationGroup = new ActivityNodeActivationGroup();
this.activationGroup.activityExecution = this;
- this.activationGroup.activate(activity.getOwnedNodes(), activity.getEdges());
+ this.activationGroup.activate(activity.getNodes(), activity.getEdges());
// Debug.println("[execute] Getting output parameter node activations...");
List<ActivityParameterNodeActivation> outputActivations = this.activationGroup.getOutputParameterNodeActivations();
// Debug.println("[execute] There are " + outputActivations.size() +
@@ -79,6 +79,8 @@ public class ActivityExecution extends Execution {
public void terminate() {
// Terminate all node activations (which will ultimately result in the
// activity execution completing).
- this.activationGroup.terminateAll();
+ if (this.activationGroup != null) {
+ this.activationGroup.terminateAll();
+ }
}
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/CompoundValue.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/CompoundValue.java
index 2ae611d4471..926636b5ef3 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/CompoundValue.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/CompoundValue.java
@@ -127,7 +127,20 @@ public abstract class CompoundValue extends StructuredValue {
buffer = buffer + "\n\t\t" + featureValue.feature.getName() + "[" + featureValue.position + "] =";
int j = 1;
while(j <= featureValue.values.size()) {
- buffer = buffer + " " + featureValue.values.get(j - 1).toString();
+ Value value = featureValue.values.get(j - 1);
+ if (value instanceof Reference) {
+ Object_ object = ((Reference)value).referent;
+ buffer = buffer + " Reference to (" + object.objectId() + ":";
+ types = object.getTypes();
+ int n = 1;
+ while (n <= types.size()) {
+ buffer = buffer + " " + types.get(n - 1).getName();
+ n = n + 1;
+ }
+ buffer = buffer + ")";
+ } else {
+ buffer = buffer + " " + value.toString();
+ }
j = j + 1;
}
k = k + 1;
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/RealValue.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/RealValue.java
index f74a3b69670..77a0555c5a2 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/RealValue.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/RealValue.java
@@ -75,8 +75,8 @@ public class RealValue extends PrimitiveValue {
exponent = exponent + 1;
}
}
- // This gives 10 significant digits in the mantissa.
- for(int i = 0; i < 10; i++) {
+ // This gives 9 significant digits in the mantissa.
+ for(int i = 0; i < 9; i++) {
positiveValue = positiveValue * 10;
}
IntegerValue integerValue = new IntegerValue();
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/StructuredValue.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/StructuredValue.java
index c4150124483..3aafdb67095 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/StructuredValue.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Classes/Kernel/StructuredValue.java
@@ -66,13 +66,30 @@ public abstract class StructuredValue extends Value {
List<Classifier> types = this.getTypes();
for(int i = 0; i < types.size(); i++) {
Classifier type = types.get(i);
- List<NamedElement> members = type.getMembers();
- for(int j = 0; j < members.size(); j++) {
- NamedElement member = members.get(j);
- if(member instanceof StructuralFeature) {
- this.setFeatureValue((StructuralFeature)member, new ArrayList<Value>(), 0);
- }
+ this.createFeatureValuesFromType(type); // REPLACED body of loop
+ }
+ }
+
+ // ADDED
+ public void createFeatureValuesFromType(Classifier type) {
+ // Create empty feature values for all structural features from the
+ // given type and all its direct and indirect parents.
+ // [Note that this is necessary in order to set the feature values for
+ // private structural features of parent classifiers, since these are
+ // not actually inherited.]
+ List<NamedElement> ownedMembers = type.getOwnedMembers();
+ for(int i = 0; i < ownedMembers.size(); i++) {
+ NamedElement member = ownedMembers.get(i);
+ if(member instanceof StructuralFeature) {
+ this.setFeatureValue((StructuralFeature)member, new ArrayList<Value>(), 0);
}
}
+
+ List<Classifier> generals = type.getGenerals();
+ for (int i = 0; i < generals.size(); i++) {
+ Classifier general = generals.get(i);
+ this.createFeatureValuesFromType(general);
+ }
}
+ //
}

Back to the top