| /******************************************************************************* |
| * Copyright (c) 2004-2008 Peter Pasztor, Akos Horvath, Gergely Varro, Istvan Rath and Daniel Varro |
| * 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: |
| * Peter Pasztor, Akos Horvath, Gergely Varro, Istvan Rath - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.gtasm.interpreter.impl.executionEnvironment; |
| |
| import java.util.Map; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Variable; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.ASMRuleInvocation; |
| import org.eclipse.viatra2.framework.IFramework; |
| |
| public class BlockRuleExecutionEnvironment extends ExecutionEnvironment { |
| /** |
| * This implies to the both BlockRule subclasses, LetRule and |
| * CollectionIteratorRule. |
| */ |
| protected ASMRuleInvocation rule; |
| |
| public BlockRuleExecutionEnvironment(IFramework framework, |
| ASMRuleInvocation innerRule) { |
| super(framework); |
| |
| rule = innerRule; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.viatra2.gtasm.interpreter.executionEnvironment.ExecutionEnvironment#onBegin() |
| */ |
| |
| public BlockRuleExecutionEnvironment(IFramework framework) { |
| super(framework); |
| } |
| |
| public void onBegin(Map<Variable, Object> variables) { |
| // Put in everything. |
| variableValues = // (Hashtable<Variable,Object>) |
| variables; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.viatra2.gtasm.interpreter.executionEnvironment.ExecutionEnvironment#onTerminate() |
| */ |
| @Override |
| public Map<Variable, Object> onTerminate() { |
| // Return everything, the parent execution environment will sort out the |
| // variables. |
| return variableValues; |
| } |
| |
| } |