blob: c7a6410982e4d59fdff776a5c7554ad868093976 [file] [log] [blame]
package org.eclipse.stem.core.predicate.impl;
/*******************************************************************************
* Copyright (c) 2008 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 API and implementation
*******************************************************************************/
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.stem.core.graph.Graph;
import org.eclipse.stem.core.model.STEMTime;
import org.eclipse.stem.core.predicate.Predicate;
import org.eclipse.stem.core.predicate.PredicatePackage;
import org.eclipse.stem.core.predicate.PredicateReference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Reference</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.stem.core.predicate.impl.PredicateReferenceImpl#getPredicate <em>Predicate</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PredicateReferenceImpl extends PredicateImpl implements PredicateReference {
/**
* The cached value of the '{@link #getPredicate() <em>Predicate</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPredicate()
* @generated
* @ordered
*/
protected Predicate predicate;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PredicateReferenceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PredicatePackage.Literals.PREDICATE_REFERENCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Predicate getPredicate() {
if (predicate != null && predicate.eIsProxy()) {
InternalEObject oldPredicate = (InternalEObject)predicate;
predicate = (Predicate)eResolveProxy(oldPredicate);
if (predicate != oldPredicate) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PredicatePackage.PREDICATE_REFERENCE__PREDICATE, oldPredicate, predicate));
}
}
return predicate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Predicate basicGetPredicate() {
return predicate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPredicate(Predicate newPredicate) {
Predicate oldPredicate = predicate;
predicate = newPredicate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PredicatePackage.PREDICATE_REFERENCE__PREDICATE, oldPredicate, predicate));
}
/**
* @see org.eclipse.stem.core.predicate.impl.PredicateImpl#evaluate(org.eclipse.stem.core.model.STEMTime, long, org.eclipse.stem.core.model.Decorator)
*/
@Override
public boolean evaluate(STEMTime time, long timerPeriod, Graph graph) {
return getPredicate().evaluate(time, timerPeriod, graph);
} // evaluate
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PredicatePackage.PREDICATE_REFERENCE__PREDICATE:
if (resolve) return getPredicate();
return basicGetPredicate();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PredicatePackage.PREDICATE_REFERENCE__PREDICATE:
setPredicate((Predicate)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PredicatePackage.PREDICATE_REFERENCE__PREDICATE:
setPredicate((Predicate)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PredicatePackage.PREDICATE_REFERENCE__PREDICATE:
return predicate != null;
}
return super.eIsSet(featureID);
}
} //PredicateReferenceImpl