blob: b45235116f3f5b62be32a9917d2b61f1506e5619 [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.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.stem.core.model.Decorator;
import org.eclipse.stem.core.model.ModelFactory;
import org.eclipse.stem.core.model.STEMTime;
import org.eclipse.stem.core.predicate.AbsoluteTimeTest;
import org.eclipse.stem.core.predicate.PredicatePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Absolute Time Test</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.stem.core.predicate.impl.AbsoluteTimeTestImpl#getTime <em>Time</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AbsoluteTimeTestImpl extends TimeTestImpl implements AbsoluteTimeTest {
/**
* The cached value of the '{@link #getTime() <em>Time</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTime()
* @generated
* @ordered
*/
protected STEMTime time;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected AbsoluteTimeTestImpl() {
super();
setTime(ModelFactory.eINSTANCE.createSTEMTime());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PredicatePackage.Literals.ABSOLUTE_TIME_TEST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public STEMTime getTime() {
return time;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTime(STEMTime newTime, NotificationChain msgs) {
STEMTime oldTime = time;
time = newTime;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PredicatePackage.ABSOLUTE_TIME_TEST__TIME, oldTime, newTime);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTime(STEMTime newTime) {
if (newTime != time) {
NotificationChain msgs = null;
if (time != null)
msgs = ((InternalEObject)time).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PredicatePackage.ABSOLUTE_TIME_TEST__TIME, null, msgs);
if (newTime != null)
msgs = ((InternalEObject)newTime).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PredicatePackage.ABSOLUTE_TIME_TEST__TIME, null, msgs);
msgs = basicSetTime(newTime, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PredicatePackage.ABSOLUTE_TIME_TEST__TIME, newTime, newTime));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PredicatePackage.ABSOLUTE_TIME_TEST__TIME:
return basicSetTime(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PredicatePackage.ABSOLUTE_TIME_TEST__TIME:
return getTime();
}
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.ABSOLUTE_TIME_TEST__TIME:
setTime((STEMTime)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PredicatePackage.ABSOLUTE_TIME_TEST__TIME:
setTime((STEMTime)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PredicatePackage.ABSOLUTE_TIME_TEST__TIME:
return time != null;
}
return super.eIsSet(featureID);
}
/**
* @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, Decorator action) {
return time.equals(getTime());
}
} //AbsoluteTimeTestImpl