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: SupersetEObjectContainmentEList.java,v 1.4 2006/12/14 15:47:32 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 SupersetEObjectContainmentEList<E>
021                    extends SupersetEObjectEList<E> {
022    
023            private static final long serialVersionUID = 1L;
024    
025            public static class Unsettable<E>
026                            extends SupersetEObjectContainmentEList<E> {
027    
028                    private static final long serialVersionUID = 1L;
029    
030                    public static class Resolving<E>
031                                    extends Unsettable<E> {
032    
033                            private static final long serialVersionUID = 1L;
034    
035                            public Resolving(Class<?> dataClass, InternalEObject owner,
036                                            int featureID, int[] subsetFeatureIDs) {
037                                    super(dataClass, owner, featureID, subsetFeatureIDs);
038                            }
039    
040                            public Resolving(Class<?> dataClass, InternalEObject owner,
041                                            int featureID, int subsetFeatureID) {
042                                    this(dataClass, owner, featureID, new int[]{subsetFeatureID});
043                            }
044    
045                            @Override
046                            protected boolean hasProxies() {
047                                    return true;
048                            }
049    
050                            @SuppressWarnings("unchecked")
051                            @Override
052                            protected E resolve(int index, E object) {
053                                    return (E) resolve(index, (EObject) object);
054                            }
055                    }
056    
057                    protected boolean isSet;
058    
059                    public Unsettable(Class<?> dataClass, InternalEObject owner,
060                                    int featureID, int[] subsetFeatureIDs) {
061                            super(dataClass, owner, featureID, subsetFeatureIDs);
062                    }
063    
064                    public Unsettable(Class<?> dataClass, InternalEObject owner,
065                                    int featureID, int subsetFeatureID) {
066                            this(dataClass, owner, featureID, new int[]{subsetFeatureID});
067                    }
068    
069                    @Override
070                    protected void didChange() {
071                            isSet = true;
072                    }
073    
074                    @Override
075                    public boolean isSet() {
076                            return isSet;
077                    }
078    
079                    @Override
080                    public void unset() {
081                            super.unset();
082    
083                            if (isNotificationRequired()) {
084                                    boolean oldIsSet = isSet;
085                                    isSet = false;
086    
087                                    owner.eNotify(createNotification(Notification.UNSET, oldIsSet,
088                                            false));
089                            } else {
090                                    isSet = false;
091                            }
092                    }
093            }
094    
095            public static class Resolving<E>
096                            extends SupersetEObjectContainmentEList<E> {
097    
098                    private static final long serialVersionUID = 1L;
099    
100                    public Resolving(Class<?> dataClass, InternalEObject owner,
101                                    int featureID, int[] subsetFeatureIDs) {
102                            super(dataClass, owner, featureID, subsetFeatureIDs);
103                    }
104    
105                    public Resolving(Class<?> dataClass, InternalEObject owner,
106                                    int featureID, int subsetFeatureID) {
107                            this(dataClass, owner, featureID, new int[]{subsetFeatureID});
108                    }
109    
110                    @Override
111                    protected boolean hasProxies() {
112                            return true;
113                    }
114    
115                    @SuppressWarnings("unchecked")
116                    @Override
117                    protected E resolve(int index, E object) {
118                            return (E) resolve(index, (EObject) object);
119                    }
120            }
121    
122            public SupersetEObjectContainmentEList(Class<?> dataClass,
123                            InternalEObject owner, int featureID, int[] subsetFeatureIDs) {
124                    super(dataClass, owner, featureID, subsetFeatureIDs);
125            }
126    
127            public SupersetEObjectContainmentEList(Class<?> dataClass,
128                            InternalEObject owner, int featureID, int subsetFeatureID) {
129                    this(dataClass, owner, featureID, new int[]{subsetFeatureID});
130            }
131    
132            @Override
133            protected boolean hasInverse() {
134                    return true;
135            }
136    
137            @Override
138            protected boolean hasNavigableInverse() {
139                    return false;
140            }
141    
142            @Override
143            protected boolean isContainment() {
144                    return true;
145            }
146    
147    }