/*******************************************************************************
* Copyright © 2008, 2013 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*
*******************************************************************************/
package org.eclipse.edt.ide.ui.internal.formatting.profile.impl;
import org.eclipse.edt.ide.ui.internal.formatting.profile.Preview;
import org.eclipse.edt.ide.ui.internal.formatting.profile.ProfilePackage;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Preview</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.PreviewImpl#getCode <em>Code</em>}</li>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.PreviewImpl#getRef <em>Ref</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PreviewImpl extends EObjectImpl implements Preview {
/**
* The default value of the '{@link #getCode() <em>Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected static final String CODE_EDEFAULT = null;
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected String code = CODE_EDEFAULT;
/**
* The default value of the '{@link #getRef() <em>Ref</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRef()
* @generated
* @ordered
*/
protected static final String REF_EDEFAULT = null;
/**
* The cached value of the '{@link #getRef() <em>Ref</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRef()
* @generated
* @ordered
*/
protected String ref = REF_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PreviewImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return ProfilePackage.Literals.PREVIEW;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCode() {
return code;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCode(String newCode) {
String oldCode = code;
code = newCode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.PREVIEW__CODE, oldCode, code));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getRef() {
return ref;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRef(String newRef) {
String oldRef = ref;
ref = newRef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.PREVIEW__REF, oldRef, ref));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ProfilePackage.PREVIEW__CODE:
return getCode();
case ProfilePackage.PREVIEW__REF:
return getRef();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProfilePackage.PREVIEW__CODE:
setCode((String)newValue);
return;
case ProfilePackage.PREVIEW__REF:
setRef((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case ProfilePackage.PREVIEW__CODE:
setCode(CODE_EDEFAULT);
return;
case ProfilePackage.PREVIEW__REF:
setRef(REF_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProfilePackage.PREVIEW__CODE:
return CODE_EDEFAULT == null ? code != null : !CODE_EDEFAULT.equals(code);
case ProfilePackage.PREVIEW__REF:
return REF_EDEFAULT == null ? ref != null : !REF_EDEFAULT.equals(ref);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (code: ");
result.append(code);
result.append(", ref: ");
result.append(ref);
result.append(')');
return result.toString();
}
} //PreviewImpl