blob: 5fb69f515b238ccb9812882571e7f5f1f5d5626f [file] [log] [blame]
/*
* Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
*
* $Id: SubsetEObjectContainmentEList.java,v 1.3.2.1 2004/11/25 12:16:03 khussey Exp $
*/
package org.eclipse.uml2.internal.util;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.InternalEObject;
/**
*
*/
public class SubsetEObjectContainmentEList
extends SubsetEObjectEList {
public static class Unsettable
extends SubsetEObjectContainmentEList {
protected boolean isSet;
public Unsettable(Class dataClass, InternalEObject owner,
int featureID, int[] supersetFeatureIDs) {
super(dataClass, owner, featureID, supersetFeatureIDs);
}
public Unsettable(Class dataClass, InternalEObject owner,
int featureID, int supersetFeatureID) {
this(dataClass, owner, featureID, new int[]{supersetFeatureID});
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.common.util.BasicEList#didChange()
*/
protected void didChange() {
isSet = true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.common.notify.impl.NotifyingListImpl#isSet()
*/
public boolean isSet() {
return isSet;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.ecore.EStructuralFeature.Setting#unset()
*/
public void unset() {
super.unset();
if (isNotificationRequired()) {
boolean oldIsSet = isSet;
isSet = false;
owner.eNotify(createNotification(Notification.UNSET, oldIsSet,
false));
} else {
isSet = false;
}
}
}
public SubsetEObjectContainmentEList(Class dataClass,
InternalEObject owner, int featureID, int[] supersetFeatureIDs) {
super(dataClass, owner, featureID, supersetFeatureIDs);
}
public SubsetEObjectContainmentEList(Class dataClass,
InternalEObject owner, int featureID, int supersetFeatureID) {
this(dataClass, owner, featureID, new int[]{supersetFeatureID});
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.common.notify.impl.NotifyingListImpl#hasInverse()
*/
protected boolean hasInverse() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.ecore.util.EcoreEList#hasNavigableInverse()
*/
protected boolean hasNavigableInverse() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.emf.ecore.util.EcoreEList#isContainment()
*/
protected boolean isContainment() {
return true;
}
/*
* (non-Javadoc)
*
* @see java.util.Collection#addAll(java.util.Collection)
*/
public boolean addAll(Collection collection) {
return super.addAll(new ArrayList(collection));
}
/*
* (non-Javadoc)
*
* @see java.util.List#addAll(int, java.util.Collection)
*/
public boolean addAll(int index, Collection collection) {
return super.addAll(index, new ArrayList(collection));
}
}