blob: 047ffedb69f5dcac7c3b7632df6ddf09d9a7dc02 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 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 v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jem.java.internal.impl;
/*
*/
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jem.java.Block;
import org.eclipse.jem.java.JavaRefPackage;
/**
* @generated
*/
public class BlockImpl extends EObjectImpl implements Block {
/**
* The default value of the '{@link #getSource() <em>Source</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected static final String SOURCE_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
/**
* @generated This field/method will be replaced during code generation.
*/
protected String source = SOURCE_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getContents() <em>Contents</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContents()
* @generated
* @ordered
*/
protected EList contents = null;
protected BlockImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return JavaRefPackage.Literals.BLOCK;
}
/**
* @generated This field/method will be replaced during code generation
*/
public String getSource() {
return source;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setSource(String newSource) {
String oldSource = source;
source = newSource;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.BLOCK__SOURCE, oldSource, source));
}
/**
* @generated This field/method will be replaced during code generation
*/
public String getName() {
return name;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.BLOCK__NAME, oldName, name));
}
/**
* @generated This field/method will be replaced during code generation
*/
public EList getContents() {
if (contents == null) {
contents = new EObjectContainmentEList(Block.class, this, JavaRefPackage.BLOCK__CONTENTS);
}
return contents;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaRefPackage.BLOCK__CONTENTS:
return ((InternalEList)getContents()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case JavaRefPackage.BLOCK__SOURCE:
return getSource();
case JavaRefPackage.BLOCK__NAME:
return getName();
case JavaRefPackage.BLOCK__CONTENTS:
return getContents();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JavaRefPackage.BLOCK__SOURCE:
setSource((String)newValue);
return;
case JavaRefPackage.BLOCK__NAME:
setName((String)newValue);
return;
case JavaRefPackage.BLOCK__CONTENTS:
getContents().clear();
getContents().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case JavaRefPackage.BLOCK__SOURCE:
setSource(SOURCE_EDEFAULT);
return;
case JavaRefPackage.BLOCK__NAME:
setName(NAME_EDEFAULT);
return;
case JavaRefPackage.BLOCK__CONTENTS:
getContents().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaRefPackage.BLOCK__SOURCE:
return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT.equals(source);
case JavaRefPackage.BLOCK__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case JavaRefPackage.BLOCK__CONTENTS:
return contents != null && !contents.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (source: ");
result.append(source);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
}