| /***************************************************************************** |
| * 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 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * CEA LIST - Initial API and implementation |
| * |
| *****************************************************************************/ |
| package org.eclipse.papyrus.moka.fuml.standardlibrary.library.list; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue; |
| import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.BasicBehaviors.OpaqueBehaviorExecution; |
| import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue; |
| import org.eclipse.papyrus.moka.fuml.debug.Debug; |
| |
| public class ListConcat extends OpaqueBehaviorExecution { |
| |
| @Override |
| public void doBody(List<IParameterValue> inputParameters, List<IParameterValue> outputParameters) { |
| try { |
| List<IValue> list1 = inputParameters.get(0).getValues(); |
| List<IValue> list2 = inputParameters.get(1).getValues(); |
| List<IValue> result = new ArrayList<IValue>(); |
| result.addAll(list1); |
| result.addAll(list2); |
| outputParameters.get(0).setValues(result); |
| } catch (Exception e) { |
| Debug.println("An error occured during the execution of ListConcat " + e.getMessage()); |
| } |
| } |
| |
| @Override |
| public IValue new_() { |
| return new ListConcat(); |
| } |
| } |