All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.eclipse.ocl.cst.impl.CSTFactoryImpl Maven / Gradle / Ivy
/**
*
*
* Copyright (c) 2005, 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 - Bugs 243976, 251349
*
*
*
* $Id: CSTFactoryImpl.java,v 1.9 2009/12/27 15:49:51 asanchez Exp $
*/
package org.eclipse.ocl.cst.impl;
import lpg.runtime.IToken;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
import org.eclipse.ocl.cst.CSTFactory;
import org.eclipse.ocl.cst.CSTPackage;
import org.eclipse.ocl.cst.CallExpCS;
import org.eclipse.ocl.cst.ClassifierContextDeclCS;
import org.eclipse.ocl.cst.CollectionLiteralExpCS;
import org.eclipse.ocl.cst.CollectionLiteralPartCS;
import org.eclipse.ocl.cst.CollectionRangeCS;
import org.eclipse.ocl.cst.CollectionTypeCS;
import org.eclipse.ocl.cst.CollectionTypeIdentifierEnum;
import org.eclipse.ocl.cst.DefCS;
import org.eclipse.ocl.cst.DefExpressionCS;
import org.eclipse.ocl.cst.DerValueCS;
import org.eclipse.ocl.cst.DotOrArrowEnum;
import org.eclipse.ocl.cst.FeatureCallExpCS;
import org.eclipse.ocl.cst.IfExpCS;
import org.eclipse.ocl.cst.InitValueCS;
import org.eclipse.ocl.cst.IntegerLiteralExpCS;
import org.eclipse.ocl.cst.InvCS;
import org.eclipse.ocl.cst.InvalidLiteralExpCS;
import org.eclipse.ocl.cst.IsMarkedPreCS;
import org.eclipse.ocl.cst.IterateExpCS;
import org.eclipse.ocl.cst.IteratorExpCS;
import org.eclipse.ocl.cst.LetExpCS;
import org.eclipse.ocl.cst.LoopExpCS;
import org.eclipse.ocl.cst.MessageExpCS;
import org.eclipse.ocl.cst.MessageExpKind;
import org.eclipse.ocl.cst.NullLiteralExpCS;
import org.eclipse.ocl.cst.OCLDocumentCS;
import org.eclipse.ocl.cst.OCLMessageArgCS;
import org.eclipse.ocl.cst.OperationCS;
import org.eclipse.ocl.cst.OperationCallExpCS;
import org.eclipse.ocl.cst.OperationContextDeclCS;
import org.eclipse.ocl.cst.PackageDeclarationCS;
import org.eclipse.ocl.cst.PathNameCS;
import org.eclipse.ocl.cst.PrePostOrBodyDeclCS;
import org.eclipse.ocl.cst.PrePostOrBodyEnum;
import org.eclipse.ocl.cst.PrimitiveLiteralExpCS;
import org.eclipse.ocl.cst.PrimitiveTypeCS;
import org.eclipse.ocl.cst.PropertyContextCS;
import org.eclipse.ocl.cst.RealLiteralExpCS;
import org.eclipse.ocl.cst.SimpleNameCS;
import org.eclipse.ocl.cst.SimpleTypeEnum;
import org.eclipse.ocl.cst.StringLiteralExpCS;
import org.eclipse.ocl.cst.TupleLiteralExpCS;
import org.eclipse.ocl.cst.TupleTypeCS;
import org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS;
import org.eclipse.ocl.cst.VariableCS;
import org.eclipse.ocl.cst.VariableExpCS;
/**
*
* An implementation of the model Factory .
*
* @generated
*/
public class CSTFactoryImpl
extends EFactoryImpl
implements CSTFactory {
/**
* Creates the default factory implementation.
*
*
* @generated
*/
public static CSTFactory init() {
try {
CSTFactory theCSTFactory = (CSTFactory) EPackage.Registry.INSTANCE
.getEFactory("http://www.eclipse.org/ocl/1.1.0/OCL/CST"); //$NON-NLS-1$
if (theCSTFactory != null) {
return theCSTFactory;
}
} catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new CSTFactoryImpl();
}
/**
* Creates an instance of the factory.
*
*
* @generated
*/
public CSTFactoryImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case CSTPackage.PACKAGE_DECLARATION_CS :
return createPackageDeclarationCS();
case CSTPackage.PATH_NAME_CS :
return createPathNameCS();
case CSTPackage.SIMPLE_NAME_CS :
return createSimpleNameCS();
case CSTPackage.PROPERTY_CONTEXT_CS :
return createPropertyContextCS();
case CSTPackage.CLASSIFIER_CONTEXT_DECL_CS :
return createClassifierContextDeclCS();
case CSTPackage.OPERATION_CONTEXT_DECL_CS :
return createOperationContextDeclCS();
case CSTPackage.OPERATION_CS :
return createOperationCS();
case CSTPackage.VARIABLE_CS :
return createVariableCS();
case CSTPackage.PRE_POST_OR_BODY_DECL_CS :
return createPrePostOrBodyDeclCS();
case CSTPackage.DER_VALUE_CS :
return createDerValueCS();
case CSTPackage.INIT_VALUE_CS :
return createInitValueCS();
case CSTPackage.INV_CS :
return createInvCS();
case CSTPackage.DEF_CS :
return createDefCS();
case CSTPackage.DEF_EXPRESSION_CS :
return createDefExpressionCS();
case CSTPackage.VARIABLE_EXP_CS :
return createVariableExpCS();
case CSTPackage.IS_MARKED_PRE_CS :
return createIsMarkedPreCS();
case CSTPackage.PRIMITIVE_TYPE_CS :
return createPrimitiveTypeCS();
case CSTPackage.TUPLE_TYPE_CS :
return createTupleTypeCS();
case CSTPackage.COLLECTION_TYPE_CS :
return createCollectionTypeCS();
case CSTPackage.LET_EXP_CS :
return createLetExpCS();
case CSTPackage.IF_EXP_CS :
return createIfExpCS();
case CSTPackage.MESSAGE_EXP_CS :
return createMessageExpCS();
case CSTPackage.OCL_MESSAGE_ARG_CS :
return createOCLMessageArgCS();
case CSTPackage.COLLECTION_LITERAL_EXP_CS :
return createCollectionLiteralExpCS();
case CSTPackage.COLLECTION_LITERAL_PART_CS :
return createCollectionLiteralPartCS();
case CSTPackage.TUPLE_LITERAL_EXP_CS :
return createTupleLiteralExpCS();
case CSTPackage.PRIMITIVE_LITERAL_EXP_CS :
return createPrimitiveLiteralExpCS();
case CSTPackage.INTEGER_LITERAL_EXP_CS :
return createIntegerLiteralExpCS();
case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS :
return createUnlimitedNaturalLiteralExpCS();
case CSTPackage.REAL_LITERAL_EXP_CS :
return createRealLiteralExpCS();
case CSTPackage.STRING_LITERAL_EXP_CS :
return createStringLiteralExpCS();
case CSTPackage.BOOLEAN_LITERAL_EXP_CS :
return createBooleanLiteralExpCS();
case CSTPackage.NULL_LITERAL_EXP_CS :
return createNullLiteralExpCS();
case CSTPackage.INVALID_LITERAL_EXP_CS :
return createInvalidLiteralExpCS();
case CSTPackage.COLLECTION_RANGE_CS :
return createCollectionRangeCS();
case CSTPackage.CALL_EXP_CS :
return createCallExpCS();
case CSTPackage.LOOP_EXP_CS :
return createLoopExpCS();
case CSTPackage.ITERATOR_EXP_CS :
return createIteratorExpCS();
case CSTPackage.ITERATE_EXP_CS :
return createIterateExpCS();
case CSTPackage.FEATURE_CALL_EXP_CS :
return createFeatureCallExpCS();
case CSTPackage.OPERATION_CALL_EXP_CS :
return createOperationCallExpCS();
case CSTPackage.OCL_DOCUMENT_CS :
return createOCLDocumentCS();
default :
throw new IllegalArgumentException(
"The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
*
*
* @generated
*/
@Override
public Object createFromString(EDataType eDataType, String initialValue) {
switch (eDataType.getClassifierID()) {
case CSTPackage.SIMPLE_TYPE_ENUM :
return createSimpleTypeEnumFromString(eDataType, initialValue);
case CSTPackage.PRE_POST_OR_BODY_ENUM :
return createPrePostOrBodyEnumFromString(eDataType,
initialValue);
case CSTPackage.COLLECTION_TYPE_IDENTIFIER_ENUM :
return createCollectionTypeIdentifierEnumFromString(eDataType,
initialValue);
case CSTPackage.MESSAGE_EXP_KIND :
return createMessageExpKindFromString(eDataType, initialValue);
case CSTPackage.DOT_OR_ARROW_ENUM :
return createDotOrArrowEnumFromString(eDataType, initialValue);
case CSTPackage.ITOKEN :
return createITokenFromString(eDataType, initialValue);
default :
throw new IllegalArgumentException(
"The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
*
*
* @generated
*/
@Override
public String convertToString(EDataType eDataType, Object instanceValue) {
switch (eDataType.getClassifierID()) {
case CSTPackage.SIMPLE_TYPE_ENUM :
return convertSimpleTypeEnumToString(eDataType, instanceValue);
case CSTPackage.PRE_POST_OR_BODY_ENUM :
return convertPrePostOrBodyEnumToString(eDataType,
instanceValue);
case CSTPackage.COLLECTION_TYPE_IDENTIFIER_ENUM :
return convertCollectionTypeIdentifierEnumToString(eDataType,
instanceValue);
case CSTPackage.MESSAGE_EXP_KIND :
return convertMessageExpKindToString(eDataType, instanceValue);
case CSTPackage.DOT_OR_ARROW_ENUM :
return convertDotOrArrowEnumToString(eDataType, instanceValue);
case CSTPackage.ITOKEN :
return convertITokenToString(eDataType, instanceValue);
default :
throw new IllegalArgumentException(
"The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
*
*
* @generated
*/
public PackageDeclarationCS createPackageDeclarationCS() {
PackageDeclarationCSImpl packageDeclarationCS = new PackageDeclarationCSImpl();
return packageDeclarationCS;
}
/**
*
*
* @generated
*/
public PropertyContextCS createPropertyContextCS() {
PropertyContextCSImpl propertyContextCS = new PropertyContextCSImpl();
return propertyContextCS;
}
/**
*
*
* @generated
*/
public ClassifierContextDeclCS createClassifierContextDeclCS() {
ClassifierContextDeclCSImpl classifierContextDeclCS = new ClassifierContextDeclCSImpl();
return classifierContextDeclCS;
}
/**
*
*
* @generated
*/
public OperationContextDeclCS createOperationContextDeclCS() {
OperationContextDeclCSImpl operationContextDeclCS = new OperationContextDeclCSImpl();
return operationContextDeclCS;
}
/**
*
*
* @generated
*/
public PrePostOrBodyDeclCS createPrePostOrBodyDeclCS() {
PrePostOrBodyDeclCSImpl prePostOrBodyDeclCS = new PrePostOrBodyDeclCSImpl();
return prePostOrBodyDeclCS;
}
/**
*
*
* @generated
*/
public OperationCS createOperationCS() {
OperationCSImpl operationCS = new OperationCSImpl();
return operationCS;
}
/**
*
*
* @generated
*/
public DerValueCS createDerValueCS() {
DerValueCSImpl derValueCS = new DerValueCSImpl();
return derValueCS;
}
/**
*
*
* @generated
*/
public InitValueCS createInitValueCS() {
InitValueCSImpl initValueCS = new InitValueCSImpl();
return initValueCS;
}
/**
*
*
* @generated
*/
public InvCS createInvCS() {
InvCSImpl invCS = new InvCSImpl();
return invCS;
}
/**
*
*
* @generated
*/
public DefCS createDefCS() {
DefCSImpl defCS = new DefCSImpl();
return defCS;
}
/**
*
*
* @generated
*/
public DefExpressionCS createDefExpressionCS() {
DefExpressionCSImpl defExpressionCS = new DefExpressionCSImpl();
return defExpressionCS;
}
/**
*
*
* @generated
*/
public PathNameCS createPathNameCS() {
PathNameCSImpl pathNameCS = new PathNameCSImpl();
return pathNameCS;
}
/**
*
*
* @generated
*/
public VariableExpCS createVariableExpCS() {
VariableExpCSImpl variableExpCS = new VariableExpCSImpl();
return variableExpCS;
}
/**
*
*
* @generated
*/
public SimpleNameCS createSimpleNameCS() {
SimpleNameCSImpl simpleNameCS = new SimpleNameCSImpl();
return simpleNameCS;
}
/**
*
*
* @generated
*/
public PrimitiveTypeCS createPrimitiveTypeCS() {
PrimitiveTypeCSImpl primitiveTypeCS = new PrimitiveTypeCSImpl();
return primitiveTypeCS;
}
/**
*
*
* @generated
*/
public TupleTypeCS createTupleTypeCS() {
TupleTypeCSImpl tupleTypeCS = new TupleTypeCSImpl();
return tupleTypeCS;
}
/**
*
*
* @generated
*/
public CollectionTypeCS createCollectionTypeCS() {
CollectionTypeCSImpl collectionTypeCS = new CollectionTypeCSImpl();
return collectionTypeCS;
}
/**
*
*
* @generated
*/
public LetExpCS createLetExpCS() {
LetExpCSImpl letExpCS = new LetExpCSImpl();
return letExpCS;
}
/**
*
*
* @generated
*/
public IfExpCS createIfExpCS() {
IfExpCSImpl ifExpCS = new IfExpCSImpl();
return ifExpCS;
}
/**
*
*
* @generated
*/
public MessageExpCS createMessageExpCS() {
MessageExpCSImpl messageExpCS = new MessageExpCSImpl();
return messageExpCS;
}
/**
*
*
* @generated
*/
public OCLMessageArgCS createOCLMessageArgCS() {
OCLMessageArgCSImpl oclMessageArgCS = new OCLMessageArgCSImpl();
return oclMessageArgCS;
}
/**
*
*
* @generated
*/
public VariableCS createVariableCS() {
VariableCSImpl variableCS = new VariableCSImpl();
return variableCS;
}
/**
*
*
* @generated
*/
public CollectionLiteralExpCS createCollectionLiteralExpCS() {
CollectionLiteralExpCSImpl collectionLiteralExpCS = new CollectionLiteralExpCSImpl();
return collectionLiteralExpCS;
}
/**
*
*
* @generated
*/
public TupleLiteralExpCS createTupleLiteralExpCS() {
TupleLiteralExpCSImpl tupleLiteralExpCS = new TupleLiteralExpCSImpl();
return tupleLiteralExpCS;
}
/**
*
*
* @generated
*/
public PrimitiveLiteralExpCS createPrimitiveLiteralExpCS() {
PrimitiveLiteralExpCSImpl primitiveLiteralExpCS = new PrimitiveLiteralExpCSImpl();
return primitiveLiteralExpCS;
}
/**
*
*
* @generated
*/
public IntegerLiteralExpCS createIntegerLiteralExpCS() {
IntegerLiteralExpCSImpl integerLiteralExpCS = new IntegerLiteralExpCSImpl();
return integerLiteralExpCS;
}
/**
*
*
* @generated
*/
public UnlimitedNaturalLiteralExpCS createUnlimitedNaturalLiteralExpCS() {
UnlimitedNaturalLiteralExpCSImpl unlimitedNaturalLiteralExpCS = new UnlimitedNaturalLiteralExpCSImpl();
return unlimitedNaturalLiteralExpCS;
}
/**
*
*
* @generated
*/
public RealLiteralExpCS createRealLiteralExpCS() {
RealLiteralExpCSImpl realLiteralExpCS = new RealLiteralExpCSImpl();
return realLiteralExpCS;
}
/**
*
*
* @generated
*/
public StringLiteralExpCS createStringLiteralExpCS() {
StringLiteralExpCSImpl stringLiteralExpCS = new StringLiteralExpCSImpl();
return stringLiteralExpCS;
}
/**
*
*
* @generated
*/
public BooleanLiteralExpCS createBooleanLiteralExpCS() {
BooleanLiteralExpCSImpl booleanLiteralExpCS = new BooleanLiteralExpCSImpl();
return booleanLiteralExpCS;
}
/**
*
*
* @generated
*/
public CollectionLiteralPartCS createCollectionLiteralPartCS() {
CollectionLiteralPartCSImpl collectionLiteralPartCS = new CollectionLiteralPartCSImpl();
return collectionLiteralPartCS;
}
/**
*
*
* @generated
*/
public CollectionRangeCS createCollectionRangeCS() {
CollectionRangeCSImpl collectionRangeCS = new CollectionRangeCSImpl();
return collectionRangeCS;
}
/**
*
*
* @generated
*/
public CallExpCS createCallExpCS() {
CallExpCSImpl callExpCS = new CallExpCSImpl();
return callExpCS;
}
/**
*
*
* @generated
*/
public LoopExpCS createLoopExpCS() {
LoopExpCSImpl loopExpCS = new LoopExpCSImpl();
return loopExpCS;
}
/**
*
*
* @generated
*/
public IteratorExpCS createIteratorExpCS() {
IteratorExpCSImpl iteratorExpCS = new IteratorExpCSImpl();
return iteratorExpCS;
}
/**
*
*
* @generated
*/
public IterateExpCS createIterateExpCS() {
IterateExpCSImpl iterateExpCS = new IterateExpCSImpl();
return iterateExpCS;
}
/**
*
*
* @generated
*/
public FeatureCallExpCS createFeatureCallExpCS() {
FeatureCallExpCSImpl featureCallExpCS = new FeatureCallExpCSImpl();
return featureCallExpCS;
}
/**
*
*
* @generated
*/
public OperationCallExpCS createOperationCallExpCS() {
OperationCallExpCSImpl operationCallExpCS = new OperationCallExpCSImpl();
return operationCallExpCS;
}
/**
*
*
* @generated
*/
public IsMarkedPreCS createIsMarkedPreCS() {
IsMarkedPreCSImpl isMarkedPreCS = new IsMarkedPreCSImpl();
return isMarkedPreCS;
}
/**
*
* @since 1.3
*
* @generated
*/
public OCLDocumentCS createOCLDocumentCS() {
OCLDocumentCSImpl oclDocumentCS = new OCLDocumentCSImpl();
return oclDocumentCS;
}
/**
*
*
* @generated
*/
public NullLiteralExpCS createNullLiteralExpCS() {
NullLiteralExpCSImpl nullLiteralExpCS = new NullLiteralExpCSImpl();
return nullLiteralExpCS;
}
/**
*
*
* @generated
*/
public InvalidLiteralExpCS createInvalidLiteralExpCS() {
InvalidLiteralExpCSImpl invalidLiteralExpCS = new InvalidLiteralExpCSImpl();
return invalidLiteralExpCS;
}
/**
*
*
* @generated
*/
public PrePostOrBodyEnum createPrePostOrBodyEnumFromString(
EDataType eDataType, String initialValue) {
PrePostOrBodyEnum result = PrePostOrBodyEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return result;
}
/**
*
*
* @generated
*/
public String convertPrePostOrBodyEnumToString(EDataType eDataType,
Object instanceValue) {
return instanceValue == null
? null
: instanceValue.toString();
}
/**
*
*
* @generated
*/
public SimpleTypeEnum createSimpleTypeEnumFromString(EDataType eDataType,
String initialValue) {
SimpleTypeEnum result = SimpleTypeEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return result;
}
/**
*
*
* @generated
*/
public String convertSimpleTypeEnumToString(EDataType eDataType,
Object instanceValue) {
return instanceValue == null
? null
: instanceValue.toString();
}
/**
*
*
* @generated
*/
public CollectionTypeIdentifierEnum createCollectionTypeIdentifierEnumFromString(
EDataType eDataType, String initialValue) {
CollectionTypeIdentifierEnum result = CollectionTypeIdentifierEnum
.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return result;
}
/**
*
*
* @generated
*/
public String convertCollectionTypeIdentifierEnumToString(
EDataType eDataType, Object instanceValue) {
return instanceValue == null
? null
: instanceValue.toString();
}
/**
*
*
* @generated
*/
public DotOrArrowEnum createDotOrArrowEnumFromString(EDataType eDataType,
String initialValue) {
DotOrArrowEnum result = DotOrArrowEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return result;
}
/**
*
*
* @generated
*/
public String convertDotOrArrowEnumToString(EDataType eDataType,
Object instanceValue) {
return instanceValue == null
? null
: instanceValue.toString();
}
/**
*
* @since 1.3
*
* @generated
*/
public IToken createITokenFromString(EDataType eDataType,
String initialValue) {
return (IToken) super.createFromString(eDataType, initialValue);
}
/**
*
* @since 1.3
*
* @generated
*/
public String convertITokenToString(EDataType eDataType,
Object instanceValue) {
return super.convertToString(eDataType, instanceValue);
}
/**
*
*
* @generated
*/
public MessageExpKind createMessageExpKindFromString(EDataType eDataType,
String initialValue) {
MessageExpKind result = MessageExpKind.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return result;
}
/**
*
*
* @generated
*/
public String convertMessageExpKindToString(EDataType eDataType,
Object instanceValue) {
return instanceValue == null
? null
: instanceValue.toString();
}
/**
*
*
* @generated
*/
public CSTPackage getCSTPackage() {
return (CSTPackage) getEPackage();
}
/**
*
*
* @deprecated
* @generated
*/
@Deprecated
public static CSTPackage getPackage() {
return CSTPackage.eINSTANCE;
}
} //CSTFactoryImpl