blob: 4fb8ad369b58f22c7d99b0b199511c20a38de056 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Willink Transformations 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:
* Adolfo Sanchez-Barbudo Herrera - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.qvtd.doc.miniocl.impl;
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.qvtd.doc.miniocl.BooleanLiteralExp;
import org.eclipse.qvtd.doc.miniocl.CollectionItem;
import org.eclipse.qvtd.doc.miniocl.CollectionKind;
import org.eclipse.qvtd.doc.miniocl.CollectionLiteralExp;
import org.eclipse.qvtd.doc.miniocl.CollectionRange;
import org.eclipse.qvtd.doc.miniocl.Constraint;
import org.eclipse.qvtd.doc.miniocl.ExpressionInOCL;
import org.eclipse.qvtd.doc.miniocl.Feature;
import org.eclipse.qvtd.doc.miniocl.Import;
import org.eclipse.qvtd.doc.miniocl.IntegerLiteralExp;
import org.eclipse.qvtd.doc.miniocl.IterateExp;
import org.eclipse.qvtd.doc.miniocl.IteratorExp;
import org.eclipse.qvtd.doc.miniocl.LetExp;
import org.eclipse.qvtd.doc.miniocl.MiniOCLFactory;
import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage;
import org.eclipse.qvtd.doc.miniocl.NullLiteralExp;
import org.eclipse.qvtd.doc.miniocl.OpaqueExpression;
import org.eclipse.qvtd.doc.miniocl.Operation;
import org.eclipse.qvtd.doc.miniocl.OperationCallExp;
import org.eclipse.qvtd.doc.miniocl.Parameter;
import org.eclipse.qvtd.doc.miniocl.Property;
import org.eclipse.qvtd.doc.miniocl.PropertyCallExp;
import org.eclipse.qvtd.doc.miniocl.Root;
import org.eclipse.qvtd.doc.miniocl.Variable;
import org.eclipse.qvtd.doc.miniocl.VariableExp;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class MiniOCLFactoryImpl extends EFactoryImpl implements MiniOCLFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static MiniOCLFactory init() {
try {
MiniOCLFactory theMiniOCLFactory = (MiniOCLFactory)EPackage.Registry.INSTANCE.getEFactory(MiniOCLPackage.eNS_URI);
if (theMiniOCLFactory != null) {
return theMiniOCLFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new MiniOCLFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MiniOCLFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case MiniOCLPackage.BOOLEAN_LITERAL_EXP: return createBooleanLiteralExp();
case MiniOCLPackage.CLASS: return createClass();
case MiniOCLPackage.COLLECTION_LITERAL_EXP: return createCollectionLiteralExp();
case MiniOCLPackage.COLLECTION_ITEM: return createCollectionItem();
case MiniOCLPackage.COLLECTION_RANGE: return createCollectionRange();
case MiniOCLPackage.CONSTRAINT: return createConstraint();
case MiniOCLPackage.EXPRESSION_IN_OCL: return createExpressionInOCL();
case MiniOCLPackage.FEATURE: return createFeature();
case MiniOCLPackage.IMPORT: return createImport();
case MiniOCLPackage.INTEGER_LITERAL_EXP: return createIntegerLiteralExp();
case MiniOCLPackage.ITERATOR_EXP: return createIteratorExp();
case MiniOCLPackage.ITERATE_EXP: return createIterateExp();
case MiniOCLPackage.LET_EXP: return createLetExp();
case MiniOCLPackage.NULL_LITERAL_EXP: return createNullLiteralExp();
case MiniOCLPackage.OPAQUE_EXPRESSION: return createOpaqueExpression();
case MiniOCLPackage.OPERATION_CALL_EXP: return createOperationCallExp();
case MiniOCLPackage.OPERATION: return createOperation();
case MiniOCLPackage.PACKAGE: return createPackage();
case MiniOCLPackage.PARAMETER: return createParameter();
case MiniOCLPackage.PROPERTY: return createProperty();
case MiniOCLPackage.PROPERTY_CALL_EXP: return createPropertyCallExp();
case MiniOCLPackage.ROOT: return createRoot();
case MiniOCLPackage.VARIABLE: return createVariable();
case MiniOCLPackage.VARIABLE_EXP: return createVariableExp();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object createFromString(EDataType eDataType, String initialValue) {
switch (eDataType.getClassifierID()) {
case MiniOCLPackage.COLLECTION_KIND:
return createCollectionKindFromString(eDataType, initialValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String convertToString(EDataType eDataType, Object instanceValue) {
switch (eDataType.getClassifierID()) {
case MiniOCLPackage.COLLECTION_KIND:
return convertCollectionKindToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BooleanLiteralExp createBooleanLiteralExp() {
BooleanLiteralExpImpl booleanLiteralExp = new BooleanLiteralExpImpl();
return booleanLiteralExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Root createRoot() {
RootImpl root = new RootImpl();
return root;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.eclipse.qvtd.doc.miniocl.Package createPackage() {
PackageImpl package_ = new PackageImpl();
return package_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.eclipse.qvtd.doc.miniocl.Class createClass() {
ClassImpl class_ = new ClassImpl();
return class_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CollectionLiteralExp createCollectionLiteralExp() {
CollectionLiteralExpImpl collectionLiteralExp = new CollectionLiteralExpImpl();
return collectionLiteralExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CollectionItem createCollectionItem() {
CollectionItemImpl collectionItem = new CollectionItemImpl();
return collectionItem;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CollectionRange createCollectionRange() {
CollectionRangeImpl collectionRange = new CollectionRangeImpl();
return collectionRange;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Feature createFeature() {
FeatureImpl feature = new FeatureImpl();
return feature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Import createImport() {
ImportImpl import_ = new ImportImpl();
return import_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IntegerLiteralExp createIntegerLiteralExp() {
IntegerLiteralExpImpl integerLiteralExp = new IntegerLiteralExpImpl();
return integerLiteralExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IteratorExp createIteratorExp() {
IteratorExpImpl iteratorExp = new IteratorExpImpl();
return iteratorExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IterateExp createIterateExp() {
IterateExpImpl iterateExp = new IterateExpImpl();
return iterateExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LetExp createLetExp() {
LetExpImpl letExp = new LetExpImpl();
return letExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NullLiteralExp createNullLiteralExp() {
NullLiteralExpImpl nullLiteralExp = new NullLiteralExpImpl();
return nullLiteralExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OpaqueExpression createOpaqueExpression() {
OpaqueExpressionImpl opaqueExpression = new OpaqueExpressionImpl();
return opaqueExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property createProperty() {
PropertyImpl property = new PropertyImpl();
return property;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operation createOperation() {
OperationImpl operation = new OperationImpl();
return operation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Parameter createParameter() {
ParameterImpl parameter = new ParameterImpl();
return parameter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PropertyCallExp createPropertyCallExp() {
PropertyCallExpImpl propertyCallExp = new PropertyCallExpImpl();
return propertyCallExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OperationCallExp createOperationCallExp() {
OperationCallExpImpl operationCallExp = new OperationCallExpImpl();
return operationCallExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable createVariable() {
VariableImpl variable = new VariableImpl();
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableExp createVariableExp() {
VariableExpImpl variableExp = new VariableExpImpl();
return variableExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CollectionKind createCollectionKindFromString(EDataType eDataType, String initialValue) {
CollectionKind result = CollectionKind.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertCollectionKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ExpressionInOCL createExpressionInOCL() {
ExpressionInOCLImpl expressionInOCL = new ExpressionInOCLImpl();
return expressionInOCL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Constraint createConstraint() {
ConstraintImpl constraint = new ConstraintImpl();
return constraint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MiniOCLPackage getMiniOCLPackage() {
return (MiniOCLPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static MiniOCLPackage getPackage() {
return MiniOCLPackage.eINSTANCE;
}
} //MiniOCLFactoryImpl