/** * Copyright (c) 2015-2016 Obeo, Inria * 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: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> */ package org.occiware.clouddesigner.occi.platform.impl; import java.lang.reflect.InvocationTargetException; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.occiware.clouddesigner.occi.impl.ResourceImpl; import org.occiware.clouddesigner.occi.platform.Component; import org.occiware.clouddesigner.occi.platform.PlatformPackage; import org.occiware.clouddesigner.occi.platform.Status; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Component</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ComponentImpl#getState <em>State</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ComponentImpl#getMessage <em>Message</em>}</li> * </ul> * * @generated */ public class ComponentImpl extends ResourceImpl implements Component { /** * The default value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected static final Status STATE_EDEFAULT = Status.ACTIVE; /** * The cached value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected Status state = STATE_EDEFAULT; /** * The default value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected static final String MESSAGE_EDEFAULT = null; /** * The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected String message = MESSAGE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ComponentImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PlatformPackage.Literals.COMPONENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Status getState() { return state; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setState(Status newState) { Status oldState = state; state = newState == null ? STATE_EDEFAULT : newState; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.COMPONENT__STATE, oldState, state)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getMessage() { return message; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setMessage(String newMessage) { String oldMessage = message; message = newMessage; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.COMPONENT__MESSAGE, oldMessage, message)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void start() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void stop() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PlatformPackage.COMPONENT__STATE: return getState(); case PlatformPackage.COMPONENT__MESSAGE: return getMessage(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PlatformPackage.COMPONENT__STATE: setState((Status)newValue); return; case PlatformPackage.COMPONENT__MESSAGE: setMessage((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PlatformPackage.COMPONENT__STATE: setState(STATE_EDEFAULT); return; case PlatformPackage.COMPONENT__MESSAGE: setMessage(MESSAGE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PlatformPackage.COMPONENT__STATE: return state != STATE_EDEFAULT; case PlatformPackage.COMPONENT__MESSAGE: return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case PlatformPackage.COMPONENT___START: start(); return null; case PlatformPackage.COMPONENT___STOP: stop(); return null; } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (state: "); result.append(state); result.append(", message: "); result.append(message); result.append(')'); return result.toString(); } } //ComponentImpl