/*******************************************************************************
* 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.style.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.style.DropCapType;
import org.oasisopen.names.tc.opendocument.xmlns.style.StylePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Drop Cap Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.style.impl.DropCapTypeImpl#getDistance <em>Distance</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.style.impl.DropCapTypeImpl#getLength <em>Length</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.style.impl.DropCapTypeImpl#getLines <em>Lines</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.style.impl.DropCapTypeImpl#getStyleName <em>Style Name</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DropCapTypeImpl extends EObjectImpl implements DropCapType {
/**
* 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 = "0cm";
/**
* 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;
/**
* This is true if the Distance attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean distanceESet;
/**
* The default value of the '{@link #getLength() <em>Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLength()
* @generated
* @ordered
*/
protected static final Object LENGTH_EDEFAULT = 1; // TODO The default value literal "1" is not valid.
/**
* The cached value of the '{@link #getLength() <em>Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLength()
* @generated
* @ordered
*/
protected Object length = LENGTH_EDEFAULT;
/**
* This is true if the Length attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean lengthESet;
/**
* The default value of the '{@link #getLines() <em>Lines</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLines()
* @generated
* @ordered
*/
protected static final BigInteger LINES_EDEFAULT = new BigInteger("1");
/**
* The cached value of the '{@link #getLines() <em>Lines</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLines()
* @generated
* @ordered
*/
protected BigInteger lines = LINES_EDEFAULT;
/**
* This is true if the Lines attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean linesESet;
/**
* The default value of the '{@link #getStyleName() <em>Style Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStyleName()
* @generated
* @ordered
*/
protected static final String STYLE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getStyleName() <em>Style Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStyleName()
* @generated
* @ordered
*/
protected String styleName = STYLE_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DropCapTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StylePackage.eINSTANCE.getDropCapType();
}
/**
* <!-- 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;
boolean oldDistanceESet = distanceESet;
distanceESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.DROP_CAP_TYPE__DISTANCE, oldDistance, distance, !oldDistanceESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetDistance() {
String oldDistance = distance;
boolean oldDistanceESet = distanceESet;
distance = DISTANCE_EDEFAULT;
distanceESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, StylePackage.DROP_CAP_TYPE__DISTANCE, oldDistance, DISTANCE_EDEFAULT, oldDistanceESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetDistance() {
return distanceESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object getLength() {
return length;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLength(Object newLength) {
Object oldLength = length;
length = newLength;
boolean oldLengthESet = lengthESet;
lengthESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.DROP_CAP_TYPE__LENGTH, oldLength, length, !oldLengthESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetLength() {
Object oldLength = length;
boolean oldLengthESet = lengthESet;
length = LENGTH_EDEFAULT;
lengthESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, StylePackage.DROP_CAP_TYPE__LENGTH, oldLength, LENGTH_EDEFAULT, oldLengthESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetLength() {
return lengthESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BigInteger getLines() {
return lines;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLines(BigInteger newLines) {
BigInteger oldLines = lines;
lines = newLines;
boolean oldLinesESet = linesESet;
linesESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.DROP_CAP_TYPE__LINES, oldLines, lines, !oldLinesESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetLines() {
BigInteger oldLines = lines;
boolean oldLinesESet = linesESet;
lines = LINES_EDEFAULT;
linesESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, StylePackage.DROP_CAP_TYPE__LINES, oldLines, LINES_EDEFAULT, oldLinesESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetLines() {
return linesESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getStyleName() {
return styleName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStyleName(String newStyleName) {
String oldStyleName = styleName;
styleName = newStyleName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StylePackage.DROP_CAP_TYPE__STYLE_NAME, oldStyleName, styleName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case StylePackage.DROP_CAP_TYPE__DISTANCE:
return getDistance();
case StylePackage.DROP_CAP_TYPE__LENGTH:
return getLength();
case StylePackage.DROP_CAP_TYPE__LINES:
return getLines();
case StylePackage.DROP_CAP_TYPE__STYLE_NAME:
return getStyleName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StylePackage.DROP_CAP_TYPE__DISTANCE:
setDistance((String)newValue);
return;
case StylePackage.DROP_CAP_TYPE__LENGTH:
setLength(newValue);
return;
case StylePackage.DROP_CAP_TYPE__LINES:
setLines((BigInteger)newValue);
return;
case StylePackage.DROP_CAP_TYPE__STYLE_NAME:
setStyleName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StylePackage.DROP_CAP_TYPE__DISTANCE:
unsetDistance();
return;
case StylePackage.DROP_CAP_TYPE__LENGTH:
unsetLength();
return;
case StylePackage.DROP_CAP_TYPE__LINES:
unsetLines();
return;
case StylePackage.DROP_CAP_TYPE__STYLE_NAME:
setStyleName(STYLE_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StylePackage.DROP_CAP_TYPE__DISTANCE:
return isSetDistance();
case StylePackage.DROP_CAP_TYPE__LENGTH:
return isSetLength();
case StylePackage.DROP_CAP_TYPE__LINES:
return isSetLines();
case StylePackage.DROP_CAP_TYPE__STYLE_NAME:
return STYLE_NAME_EDEFAULT == null ? styleName != null : !STYLE_NAME_EDEFAULT.equals(styleName);
}
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(" (distance: ");
if (distanceESet) result.append(distance); else result.append("<unset>");
result.append(", length: ");
if (lengthESet) result.append(length); else result.append("<unset>");
result.append(", lines: ");
if (linesESet) result.append(lines); else result.append("<unset>");
result.append(", styleName: ");
result.append(styleName);
result.append(')');
return result.toString();
}
} //DropCapTypeImpl