|
| 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