blob: d09a8d8c79c3394452b66b8d0a8a015406780d84 [file] [log] [blame]
/*****************************************************************************
* 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.boolean_;
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.CommonBehaviors.BasicBehaviors.IParameterValue;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.BooleanValue;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Classes.Kernel.Value;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.BasicBehaviors.OpaqueBehaviorExecution;
import org.eclipse.papyrus.moka.fuml.debug.Debug;
import org.eclipse.uml2.uml.PrimitiveType;
public class And extends OpaqueBehaviorExecution {
@Override
public void doBody(List<IParameterValue> inputParameters, List<IParameterValue> outputParameters) {
try {
Boolean x = ((BooleanValue) inputParameters.get(0).getValues().get(0)).value;
Boolean y = ((BooleanValue) inputParameters.get(1).getValues().get(0)).value;
BooleanValue result = new BooleanValue();
result.value = x && y;
result.type = (PrimitiveType) this.locus.getFactory().getBuiltInType("Boolean"); // ADDED
List<IValue> outputs = new ArrayList<IValue>();
outputs.add(result);
outputParameters.get(0).setValues(outputs);
} catch (Exception e) {
Debug.println("An error occured during the execution of And " + e.getMessage());
}
}
@Override
public Value new_() {
return new And();
}
}