Skip to content

Commit 5438616

Browse files
committed
FUML15-13 Implemented UnmarshallAction.
1 parent 4a29100 commit 5438616

7 files changed

Lines changed: 444 additions & 225 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2019 Model Driven Solutions, Inc.
3+
*
4+
* Licensed under the Academic Free License version 3.0
5+
* (http://www.opensource.org/licenses/afl-3.0.php), except as stated
6+
* in the file entitled Licensing-Information.
7+
*/
8+
9+
package fuml.semantics.actions;
10+
11+
import fuml.semantics.simpleclassifiers.FeatureValue;
12+
import fuml.semantics.simpleclassifiers.FeatureValueList;
13+
import fuml.semantics.simpleclassifiers.StructuredValue;
14+
import fuml.semantics.values.Value;
15+
import fuml.syntax.actions.OutputPin;
16+
import fuml.syntax.actions.OutputPinList;
17+
import fuml.syntax.actions.UnmarshallAction;
18+
19+
public class UnmarshallActionActivation extends ActionActivation {
20+
21+
@Override
22+
public void doAction() {
23+
UnmarshallAction action = (UnmarshallAction) this.node;
24+
OutputPinList resultPins = action.result;
25+
26+
Value value = this.takeTokens(action.object).getValue(0);
27+
28+
if (value instanceof StructuredValue) {
29+
FeatureValueList featureValues = ((StructuredValue)value).getFeatureValues();
30+
for (int i=0; i < featureValues.size(); i++) {
31+
FeatureValue featureValue = featureValues.getValue(i);
32+
OutputPin resultPin = resultPins.getValue(i);
33+
this.putTokens(resultPin, featureValue.values);
34+
}
35+
}
36+
}
37+
38+
}

0 commit comments

Comments
 (0)