/******************************************************************************* * Copyright (c) 2008 IBM Corporation, Zeligsoft Inc., and others. * 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: * IBM - Initial API and implementation * Zeligsoft - Bug 207365 *******************************************************************************/ package org.eclipse.ocl.expressions.operations; import java.util.Map; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.ocl.Environment; import org.eclipse.ocl.expressions.RealLiteralExp; import org.eclipse.ocl.expressions.util.ExpressionsValidator; import org.eclipse.ocl.internal.l10n.OCLMessages; import org.eclipse.ocl.util.OCLUtil; /** * <!-- begin-user-doc --> * A static utility class that provides operations related to '<em><b>Real Literal Exp</b></em>' model objects. * <!-- end-user-doc --> * * <p> * The following operations are supported: * </p> * <ul> * <li>{@link org.eclipse.ocl.expressions.RealLiteralExp#checkRealType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Real Type</em>}</li> * </ul> * * @generated */ public class RealLiteralExpOperations extends OCLExpressionOperations { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RealLiteralExpOperations() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * self.type.name = 'Real' * @param realLiteralExp The receiving '<em><b>Real Literal Exp</b></em>' model object. * @param diagnostics The chain of diagnostics to which problems are to be appended. * @param context The cache of context-specific information. * <!-- end-model-doc --> * @generated NOT */ public static <C> boolean checkRealType(RealLiteralExp<C> realLiteralExp, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = true; Environment<?, C, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> env = OCLUtil .getValidationEnvironment(realLiteralExp, context); if (env != null) { C type = realLiteralExp.getType(); result = (type != null) && ("Real".equals(env.getUMLReflection().getName(type))); //$NON-NLS-1$ } if (!result) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, ExpressionsValidator.DIAGNOSTIC_SOURCE, ExpressionsValidator.REAL_LITERAL_EXP__REAL_TYPE, OCLMessages.TypeConformanceRealLiteral_ERROR_, new Object[]{realLiteralExp})); } } return result; } } // RealLiteralExpOperations