Skip to main content
summaryrefslogtreecommitdiffstats
blob: 078ea787dc0599ec4e853b846929b8381592191e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*****************************************************************************
 * Copyright (c) 2012 CEA LIST.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  CEA LIST - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.moka.fuml.Semantics.Activities.ExtraStructuredActivities;

import java.util.List;

import org.eclipse.papyrus.moka.fuml.debug.Debug;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.ObjectNodeActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.Token;
import org.eclipse.uml2.uml.ExpansionNode;
import org.eclipse.uml2.uml.ExpansionRegion;

public class ExpansionNodeActivation extends ObjectNodeActivation {

	public void fire(List<Token> incomingTokens) {
		// Take tokens from all incoming edges.
		Debug.println("[fire] Expansion node " + this.node.getName() + "...");
		this.addTokens(incomingTokens);
	}

	public void receiveOffer() {
		// Forward the offer on to the expansion region.
		this.getExpansionRegionActivation().receiveOffer();
	}

	public Boolean isReady() {
		// An expansion node is always fired by its expansion region.
		return false;
	}

	public ExpansionRegionActivation getExpansionRegionActivation() {
		// Return the expansion region activation corresponding to this
		// expansion node, in the context of the activity node activation group
		// this expansion node activation is in.
		ExpansionNode node = (ExpansionNode)(this.node);
		ExpansionRegion region = node.getRegionAsInput();
		if(region == null) {
			region = node.getRegionAsOutput();
		}
		return (ExpansionRegionActivation)(this.group.getNodeActivation(region));
	}
}

Back to the top