/******************************************************************************* * Copyright (c) 2006-2012 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * 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: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation ******************************************************************************/ /** * <copyright> * </copyright> * * $Id$ */ package org.oasisopen.names.tc.opendocument.xmlns.form.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.oasisopen.names.tc.opendocument.xmlns.form.FormPackage; import org.oasisopen.names.tc.opendocument.xmlns.form.ListValueType4; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>List Value Type4</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.form.impl.ListValueType4Impl#getCurrency <em>Currency</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.form.impl.ListValueType4Impl#getValue <em>Value</em>}</li> * </ul> * </p> * * @generated */ public class ListValueType4Impl extends EObjectImpl implements ListValueType4 { /** * The default value of the '{@link #getCurrency() <em>Currency</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCurrency() * @generated * @ordered */ protected static final String CURRENCY_EDEFAULT = null; /** * The cached value of the '{@link #getCurrency() <em>Currency</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCurrency() * @generated * @ordered */ protected String currency = CURRENCY_EDEFAULT; /** * The default value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected static final double VALUE_EDEFAULT = 0.0; /** * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected double value = VALUE_EDEFAULT; /** * This is true if the Value attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean valueESet; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ListValueType4Impl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FormPackage.eINSTANCE.getListValueType4(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCurrency() { return currency; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCurrency(String newCurrency) { String oldCurrency = currency; currency = newCurrency; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FormPackage.LIST_VALUE_TYPE4__CURRENCY, oldCurrency, currency)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public double getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(double newValue) { double oldValue = value; value = newValue; boolean oldValueESet = valueESet; valueESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FormPackage.LIST_VALUE_TYPE4__VALUE, oldValue, value, !oldValueESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetValue() { double oldValue = value; boolean oldValueESet = valueESet; value = VALUE_EDEFAULT; valueESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, FormPackage.LIST_VALUE_TYPE4__VALUE, oldValue, VALUE_EDEFAULT, oldValueESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetValue() { return valueESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case FormPackage.LIST_VALUE_TYPE4__CURRENCY: return getCurrency(); case FormPackage.LIST_VALUE_TYPE4__VALUE: return new Double(getValue()); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case FormPackage.LIST_VALUE_TYPE4__CURRENCY: setCurrency((String)newValue); return; case FormPackage.LIST_VALUE_TYPE4__VALUE: setValue(((Double)newValue).doubleValue()); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case FormPackage.LIST_VALUE_TYPE4__CURRENCY: setCurrency(CURRENCY_EDEFAULT); return; case FormPackage.LIST_VALUE_TYPE4__VALUE: unsetValue(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case FormPackage.LIST_VALUE_TYPE4__CURRENCY: return CURRENCY_EDEFAULT == null ? currency != null : !CURRENCY_EDEFAULT.equals(currency); case FormPackage.LIST_VALUE_TYPE4__VALUE: return isSetValue(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (currency: "); result.append(currency); result.append(", value: "); if (valueESet) result.append(value); else result.append("<unset>"); result.append(')'); return result.toString(); } } //ListValueType4Impl