/*******************************************************************************
* 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.text.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.oasisopen.names.tc.opendocument.xmlns.text.HiddenTextType;
import org.oasisopen.names.tc.opendocument.xmlns.text.TextPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Hidden Text Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.HiddenTextTypeImpl#getMixed <em>Mixed</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.HiddenTextTypeImpl#getCondition <em>Condition</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.HiddenTextTypeImpl#getIsHidden <em>Is Hidden</em>}</li>
* <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.HiddenTextTypeImpl#getStringValue <em>String Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class HiddenTextTypeImpl extends EObjectImpl implements HiddenTextType {
/**
* The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMixed()
* @generated
* @ordered
*/
protected FeatureMap mixed;
/**
* The default value of the '{@link #getCondition() <em>Condition</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected static final String CONDITION_EDEFAULT = null;
/**
* The cached value of the '{@link #getCondition() <em>Condition</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected String condition = CONDITION_EDEFAULT;
/**
* The default value of the '{@link #getIsHidden() <em>Is Hidden</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsHidden()
* @generated
* @ordered
*/
protected static final org.oasisopen.names.tc.opendocument.xmlns.text.Boolean IS_HIDDEN_EDEFAULT = org.oasisopen.names.tc.opendocument.xmlns.text.Boolean.TRUE;
/**
* The cached value of the '{@link #getIsHidden() <em>Is Hidden</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsHidden()
* @generated
* @ordered
*/
protected org.oasisopen.names.tc.opendocument.xmlns.text.Boolean isHidden = IS_HIDDEN_EDEFAULT;
/**
* This is true if the Is Hidden attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean isHiddenESet;
/**
* The default value of the '{@link #getStringValue() <em>String Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStringValue()
* @generated
* @ordered
*/
protected static final String STRING_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getStringValue() <em>String Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStringValue()
* @generated
* @ordered
*/
protected String stringValue = STRING_VALUE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HiddenTextTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TextPackage.eINSTANCE.getHiddenTextType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getMixed() {
if (mixed == null) {
mixed = new BasicFeatureMap(this, TextPackage.HIDDEN_TEXT_TYPE__MIXED);
}
return mixed;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCondition() {
return condition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCondition(String newCondition) {
String oldCondition = condition;
condition = newCondition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.HIDDEN_TEXT_TYPE__CONDITION, oldCondition, condition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public org.oasisopen.names.tc.opendocument.xmlns.text.Boolean getIsHidden() {
return isHidden;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsHidden(org.oasisopen.names.tc.opendocument.xmlns.text.Boolean newIsHidden) {
org.oasisopen.names.tc.opendocument.xmlns.text.Boolean oldIsHidden = isHidden;
isHidden = newIsHidden == null ? IS_HIDDEN_EDEFAULT : newIsHidden;
boolean oldIsHiddenESet = isHiddenESet;
isHiddenESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN, oldIsHidden, isHidden, !oldIsHiddenESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetIsHidden() {
org.oasisopen.names.tc.opendocument.xmlns.text.Boolean oldIsHidden = isHidden;
boolean oldIsHiddenESet = isHiddenESet;
isHidden = IS_HIDDEN_EDEFAULT;
isHiddenESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN, oldIsHidden, IS_HIDDEN_EDEFAULT, oldIsHiddenESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetIsHidden() {
return isHiddenESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getStringValue() {
return stringValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStringValue(String newStringValue) {
String oldStringValue = stringValue;
stringValue = newStringValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.HIDDEN_TEXT_TYPE__STRING_VALUE, oldStringValue, stringValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TextPackage.HIDDEN_TEXT_TYPE__MIXED:
return ((InternalEList<?>)getMixed()).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 TextPackage.HIDDEN_TEXT_TYPE__MIXED:
if (coreType) return getMixed();
return ((FeatureMap.Internal)getMixed()).getWrapper();
case TextPackage.HIDDEN_TEXT_TYPE__CONDITION:
return getCondition();
case TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN:
return getIsHidden();
case TextPackage.HIDDEN_TEXT_TYPE__STRING_VALUE:
return getStringValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TextPackage.HIDDEN_TEXT_TYPE__MIXED:
((FeatureMap.Internal)getMixed()).set(newValue);
return;
case TextPackage.HIDDEN_TEXT_TYPE__CONDITION:
setCondition((String)newValue);
return;
case TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN:
setIsHidden((org.oasisopen.names.tc.opendocument.xmlns.text.Boolean)newValue);
return;
case TextPackage.HIDDEN_TEXT_TYPE__STRING_VALUE:
setStringValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TextPackage.HIDDEN_TEXT_TYPE__MIXED:
getMixed().clear();
return;
case TextPackage.HIDDEN_TEXT_TYPE__CONDITION:
setCondition(CONDITION_EDEFAULT);
return;
case TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN:
unsetIsHidden();
return;
case TextPackage.HIDDEN_TEXT_TYPE__STRING_VALUE:
setStringValue(STRING_VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TextPackage.HIDDEN_TEXT_TYPE__MIXED:
return mixed != null && !mixed.isEmpty();
case TextPackage.HIDDEN_TEXT_TYPE__CONDITION:
return CONDITION_EDEFAULT == null ? condition != null : !CONDITION_EDEFAULT.equals(condition);
case TextPackage.HIDDEN_TEXT_TYPE__IS_HIDDEN:
return isSetIsHidden();
case TextPackage.HIDDEN_TEXT_TYPE__STRING_VALUE:
return STRING_VALUE_EDEFAULT == null ? stringValue != null : !STRING_VALUE_EDEFAULT.equals(stringValue);
}
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(" (mixed: ");
result.append(mixed);
result.append(", condition: ");
result.append(condition);
result.append(", isHidden: ");
if (isHiddenESet) result.append(isHidden); else result.append("<unset>");
result.append(", stringValue: ");
result.append(stringValue);
result.append(')');
return result.toString();
}
} //HiddenTextTypeImpl