001    /*
002     * Copyright (c) 2005, 2007 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: DerivedUnionEObjectEList.java,v 1.6 2007/04/04 03:15:12 khussey Exp $
012     */
013    package org.eclipse.uml2.common.util;
014    
015    import java.util.List;
016    import java.util.ListIterator;
017    
018    import org.eclipse.emf.ecore.EStructuralFeature;
019    import org.eclipse.emf.ecore.InternalEObject;
020    
021    /**
022     * A derived list representing a union of all the elements from its source
023     * features. This list is ideal for implementing derived union features.
024     * 
025     * @since 1.2
026     */
027    public class DerivedUnionEObjectEList<E>
028                    extends DerivedEObjectEList<E> {
029    
030            public DerivedUnionEObjectEList(Class<?> dataClass, InternalEObject owner,
031                            int featureID, int[] sourceFeatureIDs) {
032                    super(dataClass, owner, featureID, sourceFeatureIDs);
033            }
034    
035            @Override
036            public List<E> basicList() {
037                    return new DerivedUnionEObjectEList<E>(dataClass, owner, featureID,
038                            sourceFeatureIDs) {
039    
040                            @Override
041                            public ListIterator<E> listIterator(int index) {
042                                    return basicListIterator(index);
043                            }
044                    };
045            }
046    
047            @Override
048            protected boolean isIncluded(EStructuralFeature feature) {
049                    return true;
050            }
051    
052    }