/** | |
* Copyright (c) 2020 CEA LIST. | |
* | |
* 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\n\nContributors: | |
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr | |
* - Initial API and Implementation | |
*/ | |
package org.eclipse.efm.ecore.formalml.datatype.impl; | |
import org.eclipse.efm.ecore.formalml.datatype.DatatypePackage; | |
import org.eclipse.efm.ecore.formalml.datatype.PrimitiveStringType; | |
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>Primitive String Type</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.efm.ecore.formalml.datatype.impl.PrimitiveStringTypeImpl#getSize <em>Size</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class PrimitiveStringTypeImpl extends PrimitiveTypeImpl implements PrimitiveStringType { | |
/** | |
* The default value of the '{@link #getSize() <em>Size</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSize() | |
* @generated | |
* @ordered | |
*/ | |
protected static final int SIZE_EDEFAULT = 0; | |
/** | |
* The cached value of the '{@link #getSize() <em>Size</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSize() | |
* @generated | |
* @ordered | |
*/ | |
protected int size = SIZE_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected PrimitiveStringTypeImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return DatatypePackage.Literals.PRIMITIVE_STRING_TYPE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public int getSize() { | |
return size; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setSize(int newSize) { | |
int oldSize = size; | |
size = newSize; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, DatatypePackage.PRIMITIVE_STRING_TYPE__SIZE, oldSize, size)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_STRING_TYPE__SIZE: | |
return getSize(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_STRING_TYPE__SIZE: | |
setSize((Integer)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_STRING_TYPE__SIZE: | |
setSize(SIZE_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_STRING_TYPE__SIZE: | |
return size != SIZE_EDEFAULT; | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuilder result = new StringBuilder(super.toString()); | |
result.append(" (size: "); | |
result.append(size); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //PrimitiveStringTypeImpl |