blob: 0b43d2750349dbea81076abb8914b0da7f174b08 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010, 2013 E.D.Willink and others.
* 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:
* E.D.Willink - Initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.pivot.internal;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectValidator;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.CollectionKind;
import org.eclipse.ocl.pivot.CollectionLiteralExp;
import org.eclipse.ocl.pivot.CollectionLiteralPart;
import org.eclipse.ocl.pivot.Comment;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.ElementExtension;
import org.eclipse.ocl.pivot.PivotPackage;
import org.eclipse.ocl.pivot.PivotTables;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.ValueSpecification;
import org.eclipse.ocl.pivot.evaluation.Evaluator;
import org.eclipse.ocl.pivot.ids.EnumerationLiteralId;
import org.eclipse.ocl.pivot.ids.IdResolver;
import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
import org.eclipse.ocl.pivot.library.logical.BooleanImpliesOperation;
import org.eclipse.ocl.pivot.library.oclany.OclAnyOclIsKindOfOperation;
import org.eclipse.ocl.pivot.messages.PivotMessages;
import org.eclipse.ocl.pivot.util.PivotValidator;
import org.eclipse.ocl.pivot.util.Visitor;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.StringUtil;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Collection Literal Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.pivot.internal.CollectionLiteralExpImpl#getKind <em>Kind</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.CollectionLiteralExpImpl#getOwnedParts <em>Owned Parts</em>}</li>
* </ul>
*
* @generated
*/
public class CollectionLiteralExpImpl
extends LiteralExpImpl
implements CollectionLiteralExp {
/**
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected static final CollectionKind KIND_EDEFAULT = CollectionKind.COLLECTION;
/**
* The offset of the flags representing the value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected static final int KIND_EFLAG_OFFSET = 9;
/**
* The flags representing the default value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected static final int KIND_EFLAG_DEFAULT = KIND_EDEFAULT.ordinal() << KIND_EFLAG_OFFSET;
/**
* The array of enumeration values for '{@link CollectionKind Collection Kind}'
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
private static final CollectionKind[] KIND_EFLAG_VALUES = CollectionKind.values();
/**
* The flags representing the value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected static final int KIND_EFLAG = 0x7 << KIND_EFLAG_OFFSET;
/**
* The cached value of the '{@link #getOwnedParts() <em>Owned Parts</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedParts()
* @generated
* @ordered
*/
protected EList<CollectionLiteralPart> ownedParts;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CollectionLiteralExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PivotPackage.Literals.COLLECTION_LITERAL_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public CollectionKind getKind() {
return KIND_EFLAG_VALUES[(eFlags & KIND_EFLAG) >>> KIND_EFLAG_OFFSET];
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setKind(CollectionKind newKind) {
CollectionKind oldKind = KIND_EFLAG_VALUES[(eFlags & KIND_EFLAG) >>> KIND_EFLAG_OFFSET];
if (newKind == null) newKind = KIND_EDEFAULT;
eFlags = eFlags & ~KIND_EFLAG | newKind.ordinal() << KIND_EFLAG_OFFSET;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PivotPackage.COLLECTION_LITERAL_EXP__KIND, oldKind, newKind));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("null")
@Override
public @NonNull List<CollectionLiteralPart> getOwnedParts()
{
if (ownedParts == null)
{
ownedParts = new EObjectContainmentEList<CollectionLiteralPart>(CollectionLiteralPart.class, this, PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS);
}
return ownedParts;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateCollectionKindIsConcrete(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
* inv validateCollectionKindIsConcrete: kind <> CollectionKind::Collection
*/
@NonNull /*@Caught*/ Object CAUGHT_ne;
try {
final @Nullable /*@Thrown*/ Enumerator kind = this.getKind();
final @Nullable /*@Thrown*/ EnumerationLiteralId BOXED_kind = kind == null ? null : PivotTables.ENUMid_CollectionKind.getEnumerationLiteralId(ClassUtil.nonNullState(kind.getName()));
final /*@Thrown*/ boolean ne = BOXED_kind != PivotTables.ELITid_Collection;
CAUGHT_ne = ne;
}
catch (Exception e) {
CAUGHT_ne = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_ne == ValueUtil.TRUE_VALUE) {
return true;
}
if (diagnostics != null) {
int severity = Diagnostic.WARNING;
String message = StringUtil.bind(PivotMessages.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{"CollectionLiteralExp", "CollectionKindIsConcrete", EObjectValidator.getObjectLabel(this, context)});
diagnostics.add(new BasicDiagnostic(severity, PivotValidator.DIAGNOSTIC_SOURCE, PivotValidator.COLLECTION_LITERAL_EXP__VALIDATE_COLLECTION_KIND_IS_CONCRETE, message, new Object [] { this }));
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateSetKindIsSet(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
* inv validateSetKindIsSet: kind = CollectionKind::Set implies
* type.oclIsKindOf(SetType)
*/
final @NonNull /*@NonInvalid*/ Evaluator evaluator = PivotUtilInternal.getEvaluator(this);
final @NonNull /*@NonInvalid*/ IdResolver idResolver = evaluator.getIdResolver();
@Nullable /*@Caught*/ Object CAUGHT_implies;
try {
@NonNull /*@Caught*/ Object CAUGHT_eq;
try {
final @Nullable /*@Thrown*/ Enumerator kind = this.getKind();
final @Nullable /*@Thrown*/ EnumerationLiteralId BOXED_kind = kind == null ? null : PivotTables.ENUMid_CollectionKind.getEnumerationLiteralId(ClassUtil.nonNullState(kind.getName()));
final /*@Thrown*/ boolean eq = BOXED_kind == PivotTables.ELITid_Set;
CAUGHT_eq = eq;
}
catch (Exception e) {
CAUGHT_eq = ValueUtil.createInvalidValue(e);
}
@NonNull /*@Caught*/ Object CAUGHT_oclIsKindOf;
try {
final @NonNull /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_SetType_0 = idResolver.getClass(PivotTables.CLSSid_SetType, null);
final @Nullable /*@Thrown*/ Type type = this.getType();
final /*@Thrown*/ boolean oclIsKindOf = OclAnyOclIsKindOfOperation.INSTANCE.evaluate(evaluator, type, TYP_SetType_0).booleanValue();
CAUGHT_oclIsKindOf = oclIsKindOf;
}
catch (Exception e) {
CAUGHT_oclIsKindOf = ValueUtil.createInvalidValue(e);
}
final @Nullable /*@Thrown*/ Boolean implies = BooleanImpliesOperation.INSTANCE.evaluate(CAUGHT_eq, CAUGHT_oclIsKindOf);
CAUGHT_implies = implies;
}
catch (Exception e) {
CAUGHT_implies = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_implies == ValueUtil.TRUE_VALUE) {
return true;
}
if (diagnostics != null) {
int severity = CAUGHT_implies == null ? Diagnostic.ERROR : Diagnostic.WARNING;
String message = StringUtil.bind(PivotMessages.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{"CollectionLiteralExp", "SetKindIsSet", EObjectValidator.getObjectLabel(this, context)});
diagnostics.add(new BasicDiagnostic(severity, PivotValidator.DIAGNOSTIC_SOURCE, PivotValidator.COLLECTION_LITERAL_EXP__VALIDATE_SET_KIND_IS_SET, message, new Object [] { this }));
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateOrderedSetKindIsOrderedSet(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
*
* inv validateOrderedSetKindIsOrderedSet: kind = CollectionKind::OrderedSet implies
* type.oclIsKindOf(OrderedSetType)
*/
final @NonNull /*@NonInvalid*/ Evaluator evaluator = PivotUtilInternal.getEvaluator(this);
final @NonNull /*@NonInvalid*/ IdResolver idResolver = evaluator.getIdResolver();
@Nullable /*@Caught*/ Object CAUGHT_implies;
try {
@NonNull /*@Caught*/ Object CAUGHT_eq;
try {
final @Nullable /*@Thrown*/ Enumerator kind = this.getKind();
final @Nullable /*@Thrown*/ EnumerationLiteralId BOXED_kind = kind == null ? null : PivotTables.ENUMid_CollectionKind.getEnumerationLiteralId(ClassUtil.nonNullState(kind.getName()));
final /*@Thrown*/ boolean eq = BOXED_kind == PivotTables.ELITid_OrderedSet;
CAUGHT_eq = eq;
}
catch (Exception e) {
CAUGHT_eq = ValueUtil.createInvalidValue(e);
}
@NonNull /*@Caught*/ Object CAUGHT_oclIsKindOf;
try {
final @NonNull /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_OrderedSetType_0 = idResolver.getClass(PivotTables.CLSSid_OrderedSetType, null);
final @Nullable /*@Thrown*/ Type type = this.getType();
final /*@Thrown*/ boolean oclIsKindOf = OclAnyOclIsKindOfOperation.INSTANCE.evaluate(evaluator, type, TYP_OrderedSetType_0).booleanValue();
CAUGHT_oclIsKindOf = oclIsKindOf;
}
catch (Exception e) {
CAUGHT_oclIsKindOf = ValueUtil.createInvalidValue(e);
}
final @Nullable /*@Thrown*/ Boolean implies = BooleanImpliesOperation.INSTANCE.evaluate(CAUGHT_eq, CAUGHT_oclIsKindOf);
CAUGHT_implies = implies;
}
catch (Exception e) {
CAUGHT_implies = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_implies == ValueUtil.TRUE_VALUE) {
return true;
}
if (diagnostics != null) {
int severity = CAUGHT_implies == null ? Diagnostic.ERROR : Diagnostic.WARNING;
String message = StringUtil.bind(PivotMessages.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{"CollectionLiteralExp", "OrderedSetKindIsOrderedSet", EObjectValidator.getObjectLabel(this, context)});
diagnostics.add(new BasicDiagnostic(severity, PivotValidator.DIAGNOSTIC_SOURCE, PivotValidator.COLLECTION_LITERAL_EXP__VALIDATE_ORDERED_SET_KIND_IS_ORDERED_SET, message, new Object [] { this }));
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateSequenceKindIsSequence(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
*
* inv validateSequenceKindIsSequence: kind = CollectionKind::Sequence implies
* type.oclIsKindOf(SequenceType)
*/
final @NonNull /*@NonInvalid*/ Evaluator evaluator = PivotUtilInternal.getEvaluator(this);
final @NonNull /*@NonInvalid*/ IdResolver idResolver = evaluator.getIdResolver();
@Nullable /*@Caught*/ Object CAUGHT_implies;
try {
@NonNull /*@Caught*/ Object CAUGHT_eq;
try {
final @Nullable /*@Thrown*/ Enumerator kind = this.getKind();
final @Nullable /*@Thrown*/ EnumerationLiteralId BOXED_kind = kind == null ? null : PivotTables.ENUMid_CollectionKind.getEnumerationLiteralId(ClassUtil.nonNullState(kind.getName()));
final /*@Thrown*/ boolean eq = BOXED_kind == PivotTables.ELITid_Sequence;
CAUGHT_eq = eq;
}
catch (Exception e) {
CAUGHT_eq = ValueUtil.createInvalidValue(e);
}
@NonNull /*@Caught*/ Object CAUGHT_oclIsKindOf;
try {
final @NonNull /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_SequenceType_0 = idResolver.getClass(PivotTables.CLSSid_SequenceType, null);
final @Nullable /*@Thrown*/ Type type = this.getType();
final /*@Thrown*/ boolean oclIsKindOf = OclAnyOclIsKindOfOperation.INSTANCE.evaluate(evaluator, type, TYP_SequenceType_0).booleanValue();
CAUGHT_oclIsKindOf = oclIsKindOf;
}
catch (Exception e) {
CAUGHT_oclIsKindOf = ValueUtil.createInvalidValue(e);
}
final @Nullable /*@Thrown*/ Boolean implies = BooleanImpliesOperation.INSTANCE.evaluate(CAUGHT_eq, CAUGHT_oclIsKindOf);
CAUGHT_implies = implies;
}
catch (Exception e) {
CAUGHT_implies = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_implies == ValueUtil.TRUE_VALUE) {
return true;
}
if (diagnostics != null) {
int severity = CAUGHT_implies == null ? Diagnostic.ERROR : Diagnostic.WARNING;
String message = StringUtil.bind(PivotMessages.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{"CollectionLiteralExp", "SequenceKindIsSequence", EObjectValidator.getObjectLabel(this, context)});
diagnostics.add(new BasicDiagnostic(severity, PivotValidator.DIAGNOSTIC_SOURCE, PivotValidator.COLLECTION_LITERAL_EXP__VALIDATE_SEQUENCE_KIND_IS_SEQUENCE, message, new Object [] { this }));
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateBagKindIsBag(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
* inv validateBagKindIsBag: kind = CollectionKind::Bag implies
* type.oclIsKindOf(BagType)
*/
final @NonNull /*@NonInvalid*/ Evaluator evaluator = PivotUtilInternal.getEvaluator(this);
final @NonNull /*@NonInvalid*/ IdResolver idResolver = evaluator.getIdResolver();
@Nullable /*@Caught*/ Object CAUGHT_implies;
try {
@NonNull /*@Caught*/ Object CAUGHT_eq;
try {
final @Nullable /*@Thrown*/ Enumerator kind = this.getKind();
final @Nullable /*@Thrown*/ EnumerationLiteralId BOXED_kind = kind == null ? null : PivotTables.ENUMid_CollectionKind.getEnumerationLiteralId(ClassUtil.nonNullState(kind.getName()));
final /*@Thrown*/ boolean eq = BOXED_kind == PivotTables.ELITid_Bag;
CAUGHT_eq = eq;
}
catch (Exception e) {
CAUGHT_eq = ValueUtil.createInvalidValue(e);
}
@NonNull /*@Caught*/ Object CAUGHT_oclIsKindOf;
try {
final @NonNull /*@NonInvalid*/ org.eclipse.ocl.pivot.Class TYP_BagType_0 = idResolver.getClass(PivotTables.CLSSid_BagType, null);
final @Nullable /*@Thrown*/ Type type = this.getType();
final /*@Thrown*/ boolean oclIsKindOf = OclAnyOclIsKindOfOperation.INSTANCE.evaluate(evaluator, type, TYP_BagType_0).booleanValue();
CAUGHT_oclIsKindOf = oclIsKindOf;
}
catch (Exception e) {
CAUGHT_oclIsKindOf = ValueUtil.createInvalidValue(e);
}
final @Nullable /*@Thrown*/ Boolean implies = BooleanImpliesOperation.INSTANCE.evaluate(CAUGHT_eq, CAUGHT_oclIsKindOf);
CAUGHT_implies = implies;
}
catch (Exception e) {
CAUGHT_implies = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_implies == ValueUtil.TRUE_VALUE) {
return true;
}
if (diagnostics != null) {
int severity = CAUGHT_implies == null ? Diagnostic.ERROR : Diagnostic.WARNING;
String message = StringUtil.bind(PivotMessages.ValidationConstraintIsNotSatisfied_ERROR_, new Object[]{"CollectionLiteralExp", "BagKindIsBag", EObjectValidator.getObjectLabel(this, context)});
diagnostics.add(new BasicDiagnostic(severity, PivotValidator.DIAGNOSTIC_SOURCE, PivotValidator.COLLECTION_LITERAL_EXP__VALIDATE_BAG_KIND_IS_BAG, message, new Object [] { this }));
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID)
{
case PivotPackage.COLLECTION_LITERAL_EXP__ANNOTATING_COMMENTS:
return ((InternalEList<?>)getAnnotatingComments()).basicRemove(otherEnd, msgs);
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_ANNOTATIONS:
return ((InternalEList<?>)getOwnedAnnotations()).basicRemove(otherEnd, msgs);
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_COMMENTS:
return ((InternalEList<?>)getOwnedComments()).basicRemove(otherEnd, msgs);
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_EXTENSIONS:
return ((InternalEList<?>)getOwnedExtensions()).basicRemove(otherEnd, msgs);
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS:
return ((InternalEList<?>)getOwnedParts()).basicRemove(otherEnd, msgs);
}
return eDynamicInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID)
{
case PivotPackage.COLLECTION_LITERAL_EXP__ANNOTATING_COMMENTS:
return getAnnotatingComments();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_ANNOTATIONS:
return getOwnedAnnotations();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_COMMENTS:
return getOwnedComments();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_EXTENSIONS:
return getOwnedExtensions();
case PivotPackage.COLLECTION_LITERAL_EXP__NAME:
return getName();
case PivotPackage.COLLECTION_LITERAL_EXP__IS_MANY:
return isIsMany();
case PivotPackage.COLLECTION_LITERAL_EXP__IS_REQUIRED:
return isIsRequired();
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE:
if (resolve) return getType();
return basicGetType();
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE_VALUE:
return getTypeValue();
case PivotPackage.COLLECTION_LITERAL_EXP__KIND:
return getKind();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS:
return getOwnedParts();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID)
{
case PivotPackage.COLLECTION_LITERAL_EXP__ANNOTATING_COMMENTS:
getAnnotatingComments().clear();
getAnnotatingComments().addAll((Collection<? extends Comment>)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_ANNOTATIONS:
getOwnedAnnotations().clear();
getOwnedAnnotations().addAll((Collection<? extends Element>)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_COMMENTS:
getOwnedComments().clear();
getOwnedComments().addAll((Collection<? extends Comment>)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_EXTENSIONS:
getOwnedExtensions().clear();
getOwnedExtensions().addAll((Collection<? extends ElementExtension>)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__NAME:
setName((String)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__IS_REQUIRED:
setIsRequired((Boolean)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE:
setType((Type)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE_VALUE:
setTypeValue((Type)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__KIND:
setKind((CollectionKind)newValue);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS:
getOwnedParts().clear();
getOwnedParts().addAll((Collection<? extends CollectionLiteralPart>)newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID)
{
case PivotPackage.COLLECTION_LITERAL_EXP__ANNOTATING_COMMENTS:
getAnnotatingComments().clear();
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_ANNOTATIONS:
getOwnedAnnotations().clear();
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_COMMENTS:
getOwnedComments().clear();
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_EXTENSIONS:
getOwnedExtensions().clear();
return;
case PivotPackage.COLLECTION_LITERAL_EXP__NAME:
setName(NAME_EDEFAULT);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__IS_REQUIRED:
setIsRequired(IS_REQUIRED_EDEFAULT);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE:
setType((Type)null);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE_VALUE:
setTypeValue((Type)null);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__KIND:
setKind(KIND_EDEFAULT);
return;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS:
getOwnedParts().clear();
return;
}
eDynamicUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID)
{
case PivotPackage.COLLECTION_LITERAL_EXP__ANNOTATING_COMMENTS:
return annotatingComments != null && !annotatingComments.isEmpty();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_ANNOTATIONS:
return ownedAnnotations != null && !ownedAnnotations.isEmpty();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_COMMENTS:
return ownedComments != null && !ownedComments.isEmpty();
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_EXTENSIONS:
return ownedExtensions != null && !ownedExtensions.isEmpty();
case PivotPackage.COLLECTION_LITERAL_EXP__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PivotPackage.COLLECTION_LITERAL_EXP__IS_MANY:
return isIsMany() != IS_MANY_EDEFAULT;
case PivotPackage.COLLECTION_LITERAL_EXP__IS_REQUIRED:
return ((eFlags & IS_REQUIRED_EFLAG) != 0) != IS_REQUIRED_EDEFAULT;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE:
return type != null;
case PivotPackage.COLLECTION_LITERAL_EXP__TYPE_VALUE:
return typeValue != null;
case PivotPackage.COLLECTION_LITERAL_EXP__KIND:
return (eFlags & KIND_EFLAG) != KIND_EFLAG_DEFAULT;
case PivotPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS:
return ownedParts != null && !ownedParts.isEmpty();
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("unchecked")
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException
{
switch (operationID)
{
case PivotPackage.COLLECTION_LITERAL_EXP___ALL_OWNED_ELEMENTS:
return allOwnedElements();
case PivotPackage.COLLECTION_LITERAL_EXP___GET_VALUE__TYPE_STRING:
return getValue((Type)arguments.get(0), (String)arguments.get(1));
case PivotPackage.COLLECTION_LITERAL_EXP___COMPATIBLE_BODY__VALUESPECIFICATION:
return CompatibleBody((ValueSpecification)arguments.get(0));
case PivotPackage.COLLECTION_LITERAL_EXP___VALIDATE_BAG_KIND_IS_BAG__DIAGNOSTICCHAIN_MAP:
return validateBagKindIsBag((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case PivotPackage.COLLECTION_LITERAL_EXP___VALIDATE_COLLECTION_KIND_IS_CONCRETE__DIAGNOSTICCHAIN_MAP:
return validateCollectionKindIsConcrete((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case PivotPackage.COLLECTION_LITERAL_EXP___VALIDATE_ORDERED_SET_KIND_IS_ORDERED_SET__DIAGNOSTICCHAIN_MAP:
return validateOrderedSetKindIsOrderedSet((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case PivotPackage.COLLECTION_LITERAL_EXP___VALIDATE_SEQUENCE_KIND_IS_SEQUENCE__DIAGNOSTICCHAIN_MAP:
return validateSequenceKindIsSequence((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case PivotPackage.COLLECTION_LITERAL_EXP___VALIDATE_SET_KIND_IS_SET__DIAGNOSTICCHAIN_MAP:
return validateSetKindIsSet((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
}
return eDynamicInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
@Override
public <R> R accept(@NonNull Visitor<R> visitor) {
return visitor.visitCollectionLiteralExp(this);
}
} //CollectionLiteralExpImpl