/**
* Copyright (c) 2011 Hannes Niederhausen.
* 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:
* Hannes Niederhausen - Initial API and implementation
*
*/
package de.hannesniederhausen.storynotes.model.impl;
import de.hannesniederhausen.storynotes.model.File;
import de.hannesniederhausen.storynotes.model.Project;
import de.hannesniederhausen.storynotes.model.StorynotesPackage;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>File</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link de.hannesniederhausen.storynotes.model.impl.FileImpl#getFilename <em>Filename</em>}</li>
* <li>{@link de.hannesniederhausen.storynotes.model.impl.FileImpl#getAuthor <em>Author</em>}</li>
* <li>{@link de.hannesniederhausen.storynotes.model.impl.FileImpl#getVersion <em>Version</em>}</li>
* <li>{@link de.hannesniederhausen.storynotes.model.impl.FileImpl#getProjects <em>Projects</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class FileImpl extends EObjectImpl implements File {
/**
* The default value of the '{@link #getFilename() <em>Filename</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFilename()
* @generated
* @ordered
*/
protected static final String FILENAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getFilename() <em>Filename</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFilename()
* @generated
* @ordered
*/
protected String filename = FILENAME_EDEFAULT;
/**
* The default value of the '{@link #getAuthor() <em>Author</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAuthor()
* @generated
* @ordered
*/
protected static final String AUTHOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getAuthor() <em>Author</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAuthor()
* @generated
* @ordered
*/
protected String author = AUTHOR_EDEFAULT;
/**
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected static final String VERSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected String version = VERSION_EDEFAULT;
/**
* The cached value of the '{@link #getProjects() <em>Projects</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProjects()
* @generated
* @ordered
*/
protected EList<Project> projects;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FileImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StorynotesPackage.Literals.FILE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFilename() {
return filename;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFilename(String newFilename) {
String oldFilename = filename;
filename = newFilename;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
StorynotesPackage.FILE__FILENAME, oldFilename, filename));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAuthor() {
return author;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAuthor(String newAuthor) {
String oldAuthor = author;
author = newAuthor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
StorynotesPackage.FILE__AUTHOR, oldAuthor, author));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getVersion() {
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(String newVersion) {
String oldVersion = version;
version = newVersion;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
StorynotesPackage.FILE__VERSION, oldVersion, version));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Project> getProjects() {
if (projects == null) {
projects = new EObjectContainmentEList<Project>(Project.class,
this, StorynotesPackage.FILE__PROJECTS);
}
return projects;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case StorynotesPackage.FILE__PROJECTS:
return ((InternalEList<?>) getProjects()).basicRemove(otherEnd,
msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case StorynotesPackage.FILE__FILENAME:
return getFilename();
case StorynotesPackage.FILE__AUTHOR:
return getAuthor();
case StorynotesPackage.FILE__VERSION:
return getVersion();
case StorynotesPackage.FILE__PROJECTS:
return getProjects();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StorynotesPackage.FILE__FILENAME:
setFilename((String) newValue);
return;
case StorynotesPackage.FILE__AUTHOR:
setAuthor((String) newValue);
return;
case StorynotesPackage.FILE__VERSION:
setVersion((String) newValue);
return;
case StorynotesPackage.FILE__PROJECTS:
getProjects().clear();
getProjects().addAll((Collection<? extends Project>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StorynotesPackage.FILE__FILENAME:
setFilename(FILENAME_EDEFAULT);
return;
case StorynotesPackage.FILE__AUTHOR:
setAuthor(AUTHOR_EDEFAULT);
return;
case StorynotesPackage.FILE__VERSION:
setVersion(VERSION_EDEFAULT);
return;
case StorynotesPackage.FILE__PROJECTS:
getProjects().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StorynotesPackage.FILE__FILENAME:
return FILENAME_EDEFAULT == null ? filename != null
: !FILENAME_EDEFAULT.equals(filename);
case StorynotesPackage.FILE__AUTHOR:
return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT
.equals(author);
case StorynotesPackage.FILE__VERSION:
return VERSION_EDEFAULT == null ? version != null
: !VERSION_EDEFAULT.equals(version);
case StorynotesPackage.FILE__PROJECTS:
return projects != null && !projects.isEmpty();
}
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(" (filename: ");
result.append(filename);
result.append(", author: ");
result.append(author);
result.append(", version: ");
result.append(version);
result.append(')');
return result.toString();
}
} //FileImpl