/**************************************************************************
* ERA - Eclipse Requirements Analysis
* ==============================================
* Copyright (C) 2009-2013 by Georg Blaschke, Christoph P. Neumann
* and Bernd Haberstumpf (http://era.origo.ethz.ch)
**************************************************************************
* Licensed under the Eclipse Public License - v 1.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.eclipse.org/org/documents/epl-v10.html
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************
*/
package era.foss.erf.impl;
import era.foss.erf.DatatypeDefinitionString;
import era.foss.erf.ErfPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datatype Definition String</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link era.foss.erf.impl.DatatypeDefinitionStringImpl#getMaxLength <em>Max Length</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DatatypeDefinitionStringImpl extends DatatypeDefinitionSimpleImpl implements DatatypeDefinitionString {
/**
* The default value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMaxLength()
* @generated
* @ordered
*/
protected static final Integer MAX_LENGTH_EDEFAULT = null;
/**
* The cached value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMaxLength()
* @generated
* @ordered
*/
protected Integer maxLength = MAX_LENGTH_EDEFAULT;
/**
* This is true if the Max Length attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean maxLengthESet;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatatypeDefinitionStringImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ErfPackage.Literals.DATATYPE_DEFINITION_STRING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->.
*
* @return the max length
* @generated
*/
public Integer getMaxLength() {
return maxLength;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->.
*
* @param newMaxLength the new max length
* @generated
*/
public void setMaxLength( Integer newMaxLength ) {
Integer oldMaxLength = maxLength;
maxLength = newMaxLength;
boolean oldMaxLengthESet = maxLengthESet;
maxLengthESet = true;
if( eNotificationRequired() ) eNotify( new ENotificationImpl(
this,
Notification.SET,
ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH,
oldMaxLength,
maxLength,
!oldMaxLengthESet ) );
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetMaxLength() {
Integer oldMaxLength = maxLength;
boolean oldMaxLengthESet = maxLengthESet;
maxLength = MAX_LENGTH_EDEFAULT;
maxLengthESet = false;
if( eNotificationRequired() ) eNotify( new ENotificationImpl(
this,
Notification.UNSET,
ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH,
oldMaxLength,
MAX_LENGTH_EDEFAULT,
oldMaxLengthESet ) );
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->.
*
* @return true, if is sets the max length
* @generated
*/
public boolean isSetMaxLength() {
return maxLengthESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet( int featureID, boolean resolve, boolean coreType ) {
switch (featureID) {
case ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH:
return getMaxLength();
}
return super.eGet( featureID, resolve, coreType );
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet( int featureID, Object newValue ) {
switch (featureID) {
case ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH:
setMaxLength( (Integer)newValue );
return;
}
super.eSet( featureID, newValue );
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset( int featureID ) {
switch (featureID) {
case ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH:
unsetMaxLength();
return;
}
super.eUnset( featureID );
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet( int featureID ) {
switch (featureID) {
case ErfPackage.DATATYPE_DEFINITION_STRING__MAX_LENGTH:
return isSetMaxLength();
}
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( " (maxLength: " );
if( maxLengthESet ) result.append( maxLength );
else result.append( "<unset>" );
result.append( ')' );
return result.toString();
}
} //DatatypeDefinitionStringImpl