org.openxma.dsl.ddl.ddlDsl.impl.CreateIndexImpl Maven / Gradle / Ivy
/**
*
*
*
*/
package org.openxma.dsl.ddl.ddlDsl.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.openxma.dsl.ddl.ddlDsl.Column;
import org.openxma.dsl.ddl.ddlDsl.CreateIndex;
import org.openxma.dsl.ddl.ddlDsl.CreateTable;
import org.openxma.dsl.ddl.ddlDsl.DdlDslPackage;
import org.openxma.dsl.ddl.ddlDsl.SortDirectionEnum;
/**
*
* An implementation of the model object 'Create Index'.
*
*
* The following features are implemented:
*
* - {@link org.openxma.dsl.ddl.ddlDsl.impl.CreateIndexImpl#isUnique Unique}
* - {@link org.openxma.dsl.ddl.ddlDsl.impl.CreateIndexImpl#getTable Table}
* - {@link org.openxma.dsl.ddl.ddlDsl.impl.CreateIndexImpl#getColumns Columns}
* - {@link org.openxma.dsl.ddl.ddlDsl.impl.CreateIndexImpl#getSortOrders Sort Orders}
*
*
*
* @generated
*/
public class CreateIndexImpl extends CreateImpl implements CreateIndex
{
/**
* The default value of the '{@link #isUnique() Unique}' attribute.
*
*
* @see #isUnique()
* @generated
* @ordered
*/
protected static final boolean UNIQUE_EDEFAULT = false;
/**
* The cached value of the '{@link #isUnique() Unique}' attribute.
*
*
* @see #isUnique()
* @generated
* @ordered
*/
protected boolean unique = UNIQUE_EDEFAULT;
/**
* The cached value of the '{@link #getTable() Table}' reference.
*
*
* @see #getTable()
* @generated
* @ordered
*/
protected CreateTable table;
/**
* The cached value of the '{@link #getColumns() Columns}' reference list.
*
*
* @see #getColumns()
* @generated
* @ordered
*/
protected EList columns;
/**
* The cached value of the '{@link #getSortOrders() Sort Orders}' attribute list.
*
*
* @see #getSortOrders()
* @generated
* @ordered
*/
protected EList sortOrders;
/**
*
*
* @generated
*/
protected CreateIndexImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DdlDslPackage.Literals.CREATE_INDEX;
}
/**
*
*
* @generated
*/
public boolean isUnique()
{
return unique;
}
/**
*
*
* @generated
*/
public void setUnique(boolean newUnique)
{
boolean oldUnique = unique;
unique = newUnique;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DdlDslPackage.CREATE_INDEX__UNIQUE, oldUnique, unique));
}
/**
*
*
* @generated
*/
public CreateTable getTable()
{
if (table != null && table.eIsProxy()) {
InternalEObject oldTable = (InternalEObject)table;
table = (CreateTable)eResolveProxy(oldTable);
if (table != oldTable) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DdlDslPackage.CREATE_INDEX__TABLE, oldTable, table));
}
}
return table;
}
/**
*
*
* @generated
*/
public CreateTable basicGetTable()
{
return table;
}
/**
*
*
* @generated
*/
public void setTable(CreateTable newTable)
{
CreateTable oldTable = table;
table = newTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DdlDslPackage.CREATE_INDEX__TABLE, oldTable, table));
}
/**
*
*
* @generated
*/
public EList getColumns()
{
if (columns == null) {
columns = new EObjectResolvingEList(Column.class, this, DdlDslPackage.CREATE_INDEX__COLUMNS);
}
return columns;
}
/**
*
*
* @generated
*/
public EList getSortOrders()
{
if (sortOrders == null) {
sortOrders = new EDataTypeEList(SortDirectionEnum.class, this, DdlDslPackage.CREATE_INDEX__SORT_ORDERS);
}
return sortOrders;
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID) {
case DdlDslPackage.CREATE_INDEX__UNIQUE:
return isUnique();
case DdlDslPackage.CREATE_INDEX__TABLE:
if (resolve) return getTable();
return basicGetTable();
case DdlDslPackage.CREATE_INDEX__COLUMNS:
return getColumns();
case DdlDslPackage.CREATE_INDEX__SORT_ORDERS:
return getSortOrders();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID) {
case DdlDslPackage.CREATE_INDEX__UNIQUE:
setUnique((Boolean)newValue);
return;
case DdlDslPackage.CREATE_INDEX__TABLE:
setTable((CreateTable)newValue);
return;
case DdlDslPackage.CREATE_INDEX__COLUMNS:
getColumns().clear();
getColumns().addAll((Collection extends Column>)newValue);
return;
case DdlDslPackage.CREATE_INDEX__SORT_ORDERS:
getSortOrders().clear();
getSortOrders().addAll((Collection extends SortDirectionEnum>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID) {
case DdlDslPackage.CREATE_INDEX__UNIQUE:
setUnique(UNIQUE_EDEFAULT);
return;
case DdlDslPackage.CREATE_INDEX__TABLE:
setTable((CreateTable)null);
return;
case DdlDslPackage.CREATE_INDEX__COLUMNS:
getColumns().clear();
return;
case DdlDslPackage.CREATE_INDEX__SORT_ORDERS:
getSortOrders().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID) {
case DdlDslPackage.CREATE_INDEX__UNIQUE:
return unique != UNIQUE_EDEFAULT;
case DdlDslPackage.CREATE_INDEX__TABLE:
return table != null;
case DdlDslPackage.CREATE_INDEX__COLUMNS:
return columns != null && !columns.isEmpty();
case DdlDslPackage.CREATE_INDEX__SORT_ORDERS:
return sortOrders != null && !sortOrders.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (unique: ");
result.append(unique);
result.append(", sortOrders: ");
result.append(sortOrders);
result.append(')');
return result.toString();
}
} //CreateIndexImpl