blob: 839d8c4367fe2a758133f82a977b1c706a7089a6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 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.jem.internal.instantiation.impl;
/*
*/
import java.util.Collection;
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.EStructuralFeature;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.jem.internal.instantiation.*;
import org.eclipse.jem.internal.instantiation.InstantiationPackage;
import org.eclipse.jem.internal.instantiation.PTAnonymousClassDeclaration;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>PT Anonymous Class Declaration</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.jem.internal.instantiation.impl.PTAnonymousClassDeclarationImpl#getDeclaration <em>Declaration</em>}</li>
* <li>{@link org.eclipse.jem.internal.instantiation.impl.PTAnonymousClassDeclarationImpl#getImports <em>Imports</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PTAnonymousClassDeclarationImpl extends PTExpressionImpl implements PTAnonymousClassDeclaration {
/**
* The default value of the '{@link #getDeclaration() <em>Declaration</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDeclaration()
* @generated
* @ordered
*/
protected static final String DECLARATION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDeclaration() <em>Declaration</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDeclaration()
* @generated
* @ordered
*/
protected String declaration = DECLARATION_EDEFAULT;
/**
* The cached value of the '{@link #getImports() <em>Imports</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImports()
* @generated
* @ordered
*/
protected EList imports = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PTAnonymousClassDeclarationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return InstantiationPackage.eINSTANCE.getPTAnonymousClassDeclaration();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDeclaration() {
return declaration;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDeclaration(String newDeclaration) {
String oldDeclaration = declaration;
declaration = newDeclaration;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__DECLARATION, oldDeclaration, declaration));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getImports() {
if (imports == null) {
imports = new EDataTypeUniqueEList(String.class, this, InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__IMPORTS);
}
return imports;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__DECLARATION:
return getDeclaration();
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__IMPORTS:
return getImports();
}
return eDynamicGet(eFeature, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__DECLARATION:
setDeclaration((String)newValue);
return;
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__IMPORTS:
getImports().clear();
getImports().addAll((Collection)newValue);
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__DECLARATION:
setDeclaration(DECLARATION_EDEFAULT);
return;
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__IMPORTS:
getImports().clear();
return;
}
eDynamicUnset(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__DECLARATION:
return DECLARATION_EDEFAULT == null ? declaration != null : !DECLARATION_EDEFAULT.equals(declaration);
case InstantiationPackage.PT_ANONYMOUS_CLASS_DECLARATION__IMPORTS:
return imports != null && !imports.isEmpty();
}
return eDynamicIsSet(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (declaration: ");
result.append(declaration);
result.append(", imports: ");
result.append(imports);
result.append(')');
return result.toString();
}
protected void accept0(ParseVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
} //PTAnonymousClassDeclarationImpl