/** * 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.infrastructure.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.infrastructure.InfrastructurePackage; import org.occiware.clouddesigner.occi.infrastructure.Storage; import org.occiware.clouddesigner.occi.infrastructure.StorageStatus; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Storage</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.StorageImpl#getSize <em>Size</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.StorageImpl#getState <em>State</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.StorageImpl#getMessage <em>Message</em>}</li> * </ul> * * @generated */ public class StorageImpl extends ResourceImpl implements Storage { /** * The default value of the '{@link #getSize() <em>Size</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSize() * @generated * @ordered */ protected static final float SIZE_EDEFAULT = 0.0F; /** * The cached value of the '{@link #getSize() <em>Size</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSize() * @generated * @ordered */ protected float size = SIZE_EDEFAULT; /** * The default value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected static final StorageStatus STATE_EDEFAULT = StorageStatus.ONLINE; /** * The cached value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected StorageStatus 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 StorageImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return InfrastructurePackage.Literals.STORAGE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public float getSize() { return size; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSize(float newSize) { float oldSize = size; size = newSize; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.STORAGE__SIZE, oldSize, size)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StorageStatus getState() { return state; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setState(StorageStatus newState) { StorageStatus oldState = state; state = newState == null ? STATE_EDEFAULT : newState; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.STORAGE__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, InfrastructurePackage.STORAGE__MESSAGE, oldMessage, message)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void online() { // 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 offline() { // 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 InfrastructurePackage.STORAGE__SIZE: return getSize(); case InfrastructurePackage.STORAGE__STATE: return getState(); case InfrastructurePackage.STORAGE__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 InfrastructurePackage.STORAGE__SIZE: setSize((Float)newValue); return; case InfrastructurePackage.STORAGE__STATE: setState((StorageStatus)newValue); return; case InfrastructurePackage.STORAGE__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 InfrastructurePackage.STORAGE__SIZE: setSize(SIZE_EDEFAULT); return; case InfrastructurePackage.STORAGE__STATE: setState(STATE_EDEFAULT); return; case InfrastructurePackage.STORAGE__MESSAGE: setMessage(MESSAGE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case InfrastructurePackage.STORAGE__SIZE: return size != SIZE_EDEFAULT; case InfrastructurePackage.STORAGE__STATE: return state != STATE_EDEFAULT; case InfrastructurePackage.STORAGE__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 InfrastructurePackage.STORAGE___ONLINE: online(); return null; case InfrastructurePackage.STORAGE___OFFLINE: offline(); 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(" (size: "); result.append(size); result.append(", state: "); result.append(state); result.append(", message: "); result.append(message); result.append(')'); return result.toString(); } } //StorageImpl