blob: 0581c6e47f8fbdf5808cf1348bd7628b52c218ec [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 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 Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.library.edit.command;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
/**
*
* @author Phong Nguyen Le - Sep 26, 2005
* @since 1.0
*/
class Reference {
EObject owner;
EStructuralFeature feature;
Object value;
int index = -1;
Reference(EObject owner, EStructuralFeature feature, Object value) {
this.owner = owner;
this.feature = feature;
this.value = value;
if (feature.isMany()) {
List list = (List) owner.eGet(feature);
index = list.indexOf(value);
}
}
Reference(EObject owner, EStructuralFeature feature, Object value, int index) {
this.owner = owner;
this.feature = feature;
this.value = value;
this.index = index;
}
}