blob: 5298f6d2793aa602adf05a368b995bd031647398 [file] [log] [blame]
/*
* Copyright (c) 2006 IBM Corporation 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:
* IBM - initial API and implementation
*
* $Id: SubsetSupersetEObjectResolvingEList.java,v 1.3 2006/12/14 15:47:33 khussey Exp $
*/
package org.eclipse.uml2.common.util;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
/**
* @since 1.2
*/
public class SubsetSupersetEObjectResolvingEList<E>
extends SubsetSupersetEObjectEList<E> {
private static final long serialVersionUID = 1L;
public static class Unsettable<E>
extends SubsetSupersetEObjectResolvingEList<E> {
private static final long serialVersionUID = 1L;
protected boolean isSet;
public Unsettable(Class<?> dataClass, InternalEObject owner,
int featureID, int[] supersetFeatureIDs, int[] subsetFeatureIDs) {
super(dataClass, owner, featureID, supersetFeatureIDs,
subsetFeatureIDs);
}
@Override
protected void didChange() {
isSet = true;
}
@Override
public boolean isSet() {
return isSet;
}
@Override
public void unset() {
super.unset();
if (isNotificationRequired()) {
boolean oldIsSet = isSet;
isSet = false;
owner.eNotify(createNotification(Notification.UNSET, oldIsSet,
false));
} else {
isSet = false;
}
}
}
public SubsetSupersetEObjectResolvingEList(Class<?> dataClass,
InternalEObject owner, int featureID, int[] supersetFeatureIDs,
int[] subsetFeatureIDs) {
super(dataClass, owner, featureID, supersetFeatureIDs, subsetFeatureIDs);
}
@Override
protected boolean hasProxies() {
return true;
}
@SuppressWarnings("unchecked")
@Override
protected E resolve(int index, E object) {
return (E) resolve(index, (EObject) object);
}
}