| /******************************************************************************* |
| * Copyright (c) 2014 Bosch Software Innovations GmbH and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * and Eclipse Distribution License v1.0 which accompany this distribution. |
| * |
| * The Eclipse Public License is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * The Eclipse Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Contributors: |
| * Bosch Software Innovations GmbH - Please refer to git log |
| * |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.vorto.functionblock.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.vorto.functionblock.Constraint; |
| import org.eclipse.vorto.functionblock.ConstraintIntervalType; |
| import org.eclipse.vorto.functionblock.Entity; |
| import org.eclipse.vorto.functionblock.EnumLiteral; |
| import org.eclipse.vorto.functionblock.Event; |
| import org.eclipse.vorto.functionblock.FBFeature; |
| import org.eclipse.vorto.functionblock.FunctionBlock; |
| import org.eclipse.vorto.functionblock.FunctionblockFactory; |
| import org.eclipse.vorto.functionblock.FunctionblockModel; |
| import org.eclipse.vorto.functionblock.FunctionblockPackage; |
| import org.eclipse.vorto.functionblock.ObjectParam; |
| import org.eclipse.vorto.functionblock.ObjectProperty; |
| import org.eclipse.vorto.functionblock.ObjectType; |
| import org.eclipse.vorto.functionblock.Operation; |
| import org.eclipse.vorto.functionblock.Parameter; |
| import org.eclipse.vorto.functionblock.Presence; |
| import org.eclipse.vorto.functionblock.PrimitiveParam; |
| import org.eclipse.vorto.functionblock.PrimitiveProperty; |
| import org.eclipse.vorto.functionblock.PrimitiveType; |
| import org.eclipse.vorto.functionblock.Property; |
| import org.eclipse.vorto.functionblock.ReturnObjectType; |
| import org.eclipse.vorto.functionblock.ReturnPrimitiveType; |
| import org.eclipse.vorto.functionblock.ReturnType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class FunctionblockFactoryImpl extends EFactoryImpl implements FunctionblockFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static FunctionblockFactory init() { |
| try { |
| FunctionblockFactory theFunctionblockFactory = (FunctionblockFactory)EPackage.Registry.INSTANCE.getEFactory(FunctionblockPackage.eNS_URI); |
| if (theFunctionblockFactory != null) { |
| return theFunctionblockFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new FunctionblockFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FunctionblockFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case FunctionblockPackage.FUNCTIONBLOCK_MODEL: return createFunctionblockModel(); |
| case FunctionblockPackage.FUNCTION_BLOCK: return createFunctionBlock(); |
| case FunctionblockPackage.FB_FEATURE: return createFBFeature(); |
| case FunctionblockPackage.OBJECT_TYPE: return createObjectType(); |
| case FunctionblockPackage.PROPERTY: return createProperty(); |
| case FunctionblockPackage.ENTITY: return createEntity(); |
| case FunctionblockPackage.PRESENCE: return createPresence(); |
| case FunctionblockPackage.PRIMITIVE_PROPERTY: return createPrimitiveProperty(); |
| case FunctionblockPackage.OBJECT_PROPERTY: return createObjectProperty(); |
| case FunctionblockPackage.CONSTRAINT: return createConstraint(); |
| case FunctionblockPackage.OPERATION: return createOperation(); |
| case FunctionblockPackage.RETURN_TYPE: return createReturnType(); |
| case FunctionblockPackage.RETURN_OBJECT_TYPE: return createReturnObjectType(); |
| case FunctionblockPackage.RETURN_PRIMITIVE_TYPE: return createReturnPrimitiveType(); |
| case FunctionblockPackage.PARAMETER: return createParameter(); |
| case FunctionblockPackage.OBJECT_PARAM: return createObjectParam(); |
| case FunctionblockPackage.PRIMITIVE_PARAM: return createPrimitiveParam(); |
| case FunctionblockPackage.ENUM: return createEnum(); |
| case FunctionblockPackage.ENUM_LITERAL: return createEnumLiteral(); |
| case FunctionblockPackage.EVENT: return createEvent(); |
| 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 FunctionblockPackage.PRIMITIVE_TYPE: |
| return createPrimitiveTypeFromString(eDataType, initialValue); |
| case FunctionblockPackage.CONSTRAINT_INTERVAL_TYPE: |
| return createConstraintIntervalTypeFromString(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 FunctionblockPackage.PRIMITIVE_TYPE: |
| return convertPrimitiveTypeToString(eDataType, instanceValue); |
| case FunctionblockPackage.CONSTRAINT_INTERVAL_TYPE: |
| return convertConstraintIntervalTypeToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FunctionblockModel createFunctionblockModel() { |
| FunctionblockModelImpl functionblockModel = new FunctionblockModelImpl(); |
| return functionblockModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FunctionBlock createFunctionBlock() { |
| FunctionBlockImpl functionBlock = new FunctionBlockImpl(); |
| return functionBlock; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FBFeature createFBFeature() { |
| FBFeatureImpl fbFeature = new FBFeatureImpl(); |
| return fbFeature; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ObjectType createObjectType() { |
| ObjectTypeImpl objectType = new ObjectTypeImpl(); |
| return objectType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property createProperty() { |
| PropertyImpl property = new PropertyImpl(); |
| return property; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Entity createEntity() { |
| EntityImpl entity = new EntityImpl(); |
| return entity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Presence createPresence() { |
| PresenceImpl presence = new PresenceImpl(); |
| return presence; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PrimitiveProperty createPrimitiveProperty() { |
| PrimitivePropertyImpl primitiveProperty = new PrimitivePropertyImpl(); |
| return primitiveProperty; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ObjectProperty createObjectProperty() { |
| ObjectPropertyImpl objectProperty = new ObjectPropertyImpl(); |
| return objectProperty; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Constraint createConstraint() { |
| ConstraintImpl constraint = new ConstraintImpl(); |
| return constraint; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Operation createOperation() { |
| OperationImpl operation = new OperationImpl(); |
| return operation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReturnType createReturnType() { |
| ReturnTypeImpl returnType = new ReturnTypeImpl(); |
| return returnType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReturnObjectType createReturnObjectType() { |
| ReturnObjectTypeImpl returnObjectType = new ReturnObjectTypeImpl(); |
| return returnObjectType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReturnPrimitiveType createReturnPrimitiveType() { |
| ReturnPrimitiveTypeImpl returnPrimitiveType = new ReturnPrimitiveTypeImpl(); |
| return returnPrimitiveType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Parameter createParameter() { |
| ParameterImpl parameter = new ParameterImpl(); |
| return parameter; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ObjectParam createObjectParam() { |
| ObjectParamImpl objectParam = new ObjectParamImpl(); |
| return objectParam; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PrimitiveParam createPrimitiveParam() { |
| PrimitiveParamImpl primitiveParam = new PrimitiveParamImpl(); |
| return primitiveParam; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.vorto.functionblock.Enum createEnum() { |
| EnumImpl enum_ = new EnumImpl(); |
| return enum_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EnumLiteral createEnumLiteral() { |
| EnumLiteralImpl enumLiteral = new EnumLiteralImpl(); |
| return enumLiteral; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Event createEvent() { |
| EventImpl event = new EventImpl(); |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PrimitiveType createPrimitiveTypeFromString(EDataType eDataType, String initialValue) { |
| PrimitiveType result = PrimitiveType.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 convertPrimitiveTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ConstraintIntervalType createConstraintIntervalTypeFromString(EDataType eDataType, String initialValue) { |
| ConstraintIntervalType result = ConstraintIntervalType.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 convertConstraintIntervalTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FunctionblockPackage getFunctionblockPackage() { |
| return (FunctionblockPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static FunctionblockPackage getPackage() { |
| return FunctionblockPackage.eINSTANCE; |
| } |
| |
| } //FunctionblockFactoryImpl |