/*******************************************************************************
* 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.office.impl;
import java.util.Collection;
import javax.xml.datatype.XMLGregorianCalendar;
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.oasisopen.names.tc.opendocument.xmlns.office.ChangeInfoType;
import org.oasisopen.names.tc.opendocument.xmlns.office.OfficePackage;
import org.oasisopen.names.tc.opendocument.xmlns.text.PType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Change Info Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.office.impl.ChangeInfoTypeImpl#getCreator <em>Creator</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.office.impl.ChangeInfoTypeImpl#getDate <em>Date</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.office.impl.ChangeInfoTypeImpl#getP <em>P</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ChangeInfoTypeImpl extends EObjectImpl implements ChangeInfoType {
/**
* The default value of the '{@link #getCreator() <em>Creator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCreator()
* @generated
* @ordered
*/
protected static final String CREATOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getCreator() <em>Creator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCreator()
* @generated
* @ordered
*/
protected String creator = CREATOR_EDEFAULT;
/**
* The default value of the '{@link #getDate() <em>Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDate()
* @generated
* @ordered
*/
protected static final XMLGregorianCalendar DATE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDate() <em>Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDate()
* @generated
* @ordered
*/
protected XMLGregorianCalendar date = DATE_EDEFAULT;
/**
* The cached value of the '{@link #getP() <em>P</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getP()
* @generated
* @ordered
*/
protected EList<PType> p;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ChangeInfoTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OfficePackage.Literals.CHANGE_INFO_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCreator() {
return creator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCreator(String newCreator) {
String oldCreator = creator;
creator = newCreator;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OfficePackage.CHANGE_INFO_TYPE__CREATOR, oldCreator, creator));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XMLGregorianCalendar getDate() {
return date;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDate(XMLGregorianCalendar newDate) {
XMLGregorianCalendar oldDate = date;
date = newDate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OfficePackage.CHANGE_INFO_TYPE__DATE, oldDate, date));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<PType> getP() {
if (p == null) {
p = new EObjectContainmentEList<PType>(PType.class, this, OfficePackage.CHANGE_INFO_TYPE__P);
}
return p;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OfficePackage.CHANGE_INFO_TYPE__P:
return ((InternalEList<?>)getP()).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 OfficePackage.CHANGE_INFO_TYPE__CREATOR:
return getCreator();
case OfficePackage.CHANGE_INFO_TYPE__DATE:
return getDate();
case OfficePackage.CHANGE_INFO_TYPE__P:
return getP();
}
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 OfficePackage.CHANGE_INFO_TYPE__CREATOR:
setCreator((String)newValue);
return;
case OfficePackage.CHANGE_INFO_TYPE__DATE:
setDate((XMLGregorianCalendar)newValue);
return;
case OfficePackage.CHANGE_INFO_TYPE__P:
getP().clear();
getP().addAll((Collection<? extends PType>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OfficePackage.CHANGE_INFO_TYPE__CREATOR:
setCreator(CREATOR_EDEFAULT);
return;
case OfficePackage.CHANGE_INFO_TYPE__DATE:
setDate(DATE_EDEFAULT);
return;
case OfficePackage.CHANGE_INFO_TYPE__P:
getP().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OfficePackage.CHANGE_INFO_TYPE__CREATOR:
return CREATOR_EDEFAULT == null ? creator != null : !CREATOR_EDEFAULT.equals(creator);
case OfficePackage.CHANGE_INFO_TYPE__DATE:
return DATE_EDEFAULT == null ? date != null : !DATE_EDEFAULT.equals(date);
case OfficePackage.CHANGE_INFO_TYPE__P:
return p != null && !p.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(" (creator: ");
result.append(creator);
result.append(", date: ");
result.append(date);
result.append(')');
return result.toString();
}
} //ChangeInfoTypeImpl