001    /*
002     * Copyright (c) 2003, 2006 IBM Corporation and others.
003     * All rights reserved.   This program and the accompanying materials
004     * are made available under the terms of the Eclipse Public License v1.0
005     * which accompanies this distribution, and is available at
006     * http://www.eclipse.org/legal/epl-v10.html
007     *
008     * Contributors:
009     *   IBM - initial API and implementation
010     *
011     * $Id: SupersetEObjectResolvingEList.java,v 1.3 2006/12/14 15:47:33 khussey Exp $
012     */
013    package org.eclipse.uml2.common.util;
014    
015    import org.eclipse.emf.common.notify.Notification;
016    import org.eclipse.emf.ecore.EObject;
017    import org.eclipse.emf.ecore.InternalEObject;
018    
019    @Deprecated
020    public class SupersetEObjectResolvingEList<E>
021                    extends SupersetEObjectEList<E> {
022    
023            private static final long serialVersionUID = 1L;
024    
025            public static class Unsettable<E>
026                            extends SupersetEObjectResolvingEList<E> {
027    
028                    private static final long serialVersionUID = 1L;
029    
030                    protected boolean isSet;
031    
032                    public Unsettable(Class<?> dataClass, InternalEObject owner,
033                                    int featureID, int[] subsetFeatureIDs) {
034                            super(dataClass, owner, featureID, subsetFeatureIDs);
035                    }
036    
037                    public Unsettable(Class<?> dataClass, InternalEObject owner,
038                                    int featureID, int subsetFeatureID) {
039                            this(dataClass, owner, featureID, new int[]{subsetFeatureID});
040                    }
041    
042                    @Override
043                    protected void didChange() {
044                            isSet = true;
045                    }
046    
047                    @Override
048                    public boolean isSet() {
049                            return isSet;
050                    }
051    
052                    @Override
053                    public void unset() {
054                            super.unset();
055    
056                            if (isNotificationRequired()) {
057                                    boolean oldIsSet = isSet;
058                                    isSet = false;
059    
060                                    owner.eNotify(createNotification(Notification.UNSET, oldIsSet,
061                                            false));
062                            } else {
063                                    isSet = false;
064                            }
065                    }
066            }
067    
068            public SupersetEObjectResolvingEList(Class<?> dataClass,
069                            InternalEObject owner, int featureID, int[] subsetFeatureIDs) {
070                    super(dataClass, owner, featureID, subsetFeatureIDs);
071            }
072    
073            public SupersetEObjectResolvingEList(Class<?> dataClass,
074                            InternalEObject owner, int featureID, int subsetFeatureID) {
075                    this(dataClass, owner, featureID, new int[]{subsetFeatureID});
076            }
077    
078            @Override
079            protected boolean hasProxies() {
080                    return true;
081            }
082    
083            @SuppressWarnings("unchecked")
084            @Override
085            protected E resolve(int index, E object) {
086                    return (E) resolve(index, (EObject) object);
087            }
088    
089    }