/*******************************************************************************
* 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.drawing.impl;
import java.math.BigInteger;
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;
import org.oasisopen.names.tc.opendocument.xmlns.drawing.DrawingPackage;
import org.oasisopen.names.tc.opendocument.xmlns.drawing.HatchType;
import org.oasisopen.names.tc.opendocument.xmlns.drawing.StyleType1;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Hatch Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getColor <em>Color</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getDisplayName <em>Display Name</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getDistance <em>Distance</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getName <em>Name</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getRotation <em>Rotation</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.drawing.impl.HatchTypeImpl#getStyle <em>Style</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class HatchTypeImpl extends EObjectImpl implements HatchType {
/**
* The default value of the '{@link #getColor() <em>Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColor()
* @generated
* @ordered
*/
protected static final String COLOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getColor() <em>Color</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColor()
* @generated
* @ordered
*/
protected String color = COLOR_EDEFAULT;
/**
* The default value of the '{@link #getDisplayName() <em>Display Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplayName()
* @generated
* @ordered
*/
protected static final String DISPLAY_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getDisplayName() <em>Display Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplayName()
* @generated
* @ordered
*/
protected String displayName = DISPLAY_NAME_EDEFAULT;
/**
* The default value of the '{@link #getDistance() <em>Distance</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDistance()
* @generated
* @ordered
*/
protected static final String DISTANCE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDistance() <em>Distance</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDistance()
* @generated
* @ordered
*/
protected String distance = DISTANCE_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;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getRotation() <em>Rotation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRotation()
* @generated
* @ordered
*/
protected static final BigInteger ROTATION_EDEFAULT = null;
/**
* The cached value of the '{@link #getRotation() <em>Rotation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRotation()
* @generated
* @ordered
*/
protected BigInteger rotation = ROTATION_EDEFAULT;
/**
* The default value of the '{@link #getStyle() <em>Style</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStyle()
* @generated
* @ordered
*/
protected static final StyleType1 STYLE_EDEFAULT = StyleType1.SINGLE;
/**
* The cached value of the '{@link #getStyle() <em>Style</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStyle()
* @generated
* @ordered
*/
protected StyleType1 style = STYLE_EDEFAULT;
/**
* This is true if the Style attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean styleESet;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HatchTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DrawingPackage.eINSTANCE.getHatchType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getColor() {
return color;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setColor(String newColor) {
String oldColor = color;
color = newColor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__COLOR, oldColor, color));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDisplayName() {
return displayName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDisplayName(String newDisplayName) {
String oldDisplayName = displayName;
displayName = newDisplayName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__DISPLAY_NAME, oldDisplayName, displayName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDistance() {
return distance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDistance(String newDistance) {
String oldDistance = distance;
distance = newDistance;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__DISTANCE, oldDistance, distance));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BigInteger getRotation() {
return rotation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRotation(BigInteger newRotation) {
BigInteger oldRotation = rotation;
rotation = newRotation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__ROTATION, oldRotation, rotation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StyleType1 getStyle() {
return style;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStyle(StyleType1 newStyle) {
StyleType1 oldStyle = style;
style = newStyle == null ? STYLE_EDEFAULT : newStyle;
boolean oldStyleESet = styleESet;
styleESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DrawingPackage.HATCH_TYPE__STYLE, oldStyle, style, !oldStyleESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetStyle() {
StyleType1 oldStyle = style;
boolean oldStyleESet = styleESet;
style = STYLE_EDEFAULT;
styleESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, DrawingPackage.HATCH_TYPE__STYLE, oldStyle, STYLE_EDEFAULT, oldStyleESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetStyle() {
return styleESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DrawingPackage.HATCH_TYPE__COLOR:
return getColor();
case DrawingPackage.HATCH_TYPE__DISPLAY_NAME:
return getDisplayName();
case DrawingPackage.HATCH_TYPE__DISTANCE:
return getDistance();
case DrawingPackage.HATCH_TYPE__NAME:
return getName();
case DrawingPackage.HATCH_TYPE__ROTATION:
return getRotation();
case DrawingPackage.HATCH_TYPE__STYLE:
return getStyle();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DrawingPackage.HATCH_TYPE__COLOR:
setColor((String)newValue);
return;
case DrawingPackage.HATCH_TYPE__DISPLAY_NAME:
setDisplayName((String)newValue);
return;
case DrawingPackage.HATCH_TYPE__DISTANCE:
setDistance((String)newValue);
return;
case DrawingPackage.HATCH_TYPE__NAME:
setName((String)newValue);
return;
case DrawingPackage.HATCH_TYPE__ROTATION:
setRotation((BigInteger)newValue);
return;
case DrawingPackage.HATCH_TYPE__STYLE:
setStyle((StyleType1)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DrawingPackage.HATCH_TYPE__COLOR:
setColor(COLOR_EDEFAULT);
return;
case DrawingPackage.HATCH_TYPE__DISPLAY_NAME:
setDisplayName(DISPLAY_NAME_EDEFAULT);
return;
case DrawingPackage.HATCH_TYPE__DISTANCE:
setDistance(DISTANCE_EDEFAULT);
return;
case DrawingPackage.HATCH_TYPE__NAME:
setName(NAME_EDEFAULT);
return;
case DrawingPackage.HATCH_TYPE__ROTATION:
setRotation(ROTATION_EDEFAULT);
return;
case DrawingPackage.HATCH_TYPE__STYLE:
unsetStyle();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DrawingPackage.HATCH_TYPE__COLOR:
return COLOR_EDEFAULT == null ? color != null : !COLOR_EDEFAULT.equals(color);
case DrawingPackage.HATCH_TYPE__DISPLAY_NAME:
return DISPLAY_NAME_EDEFAULT == null ? displayName != null : !DISPLAY_NAME_EDEFAULT.equals(displayName);
case DrawingPackage.HATCH_TYPE__DISTANCE:
return DISTANCE_EDEFAULT == null ? distance != null : !DISTANCE_EDEFAULT.equals(distance);
case DrawingPackage.HATCH_TYPE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case DrawingPackage.HATCH_TYPE__ROTATION:
return ROTATION_EDEFAULT == null ? rotation != null : !ROTATION_EDEFAULT.equals(rotation);
case DrawingPackage.HATCH_TYPE__STYLE:
return isSetStyle();
}
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(" (color: ");
result.append(color);
result.append(", displayName: ");
result.append(displayName);
result.append(", distance: ");
result.append(distance);
result.append(", name: ");
result.append(name);
result.append(", rotation: ");
result.append(rotation);
result.append(", style: ");
if (styleESet) result.append(style); else result.append("<unset>");
result.append(')');
return result.toString();
}
} //HatchTypeImpl