blob: 690dffb4c278c52b65ae77621b5f8e95616941b3 [file] [log] [blame]
package org.eclipse.jem.internal.instantiation.impl;
/*******************************************************************************
* Copyright (c) 2004 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
*******************************************************************************/
/*
* $RCSfile: PTBooleanLiteralImpl.java,v $
* $Revision: 1.2 $ $Date: 2005/02/15 22:36:09 $
*/
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jem.internal.instantiation.*;
import org.eclipse.jem.internal.instantiation.PTBooleanLiteral;
import org.eclipse.jem.internal.instantiation.InstantiationPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Boolean Literal</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.jem.internal.instantiation.impl.PTBooleanLiteralImpl#isBooleanValue <em>Boolean Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PTBooleanLiteralImpl extends PTExpressionImpl implements PTBooleanLiteral {
/**
* The default value of the '{@link #isBooleanValue() <em>Boolean Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isBooleanValue()
* @generated
* @ordered
*/
protected static final boolean BOOLEAN_VALUE_EDEFAULT = false;
/**
* The cached value of the '{@link #isBooleanValue() <em>Boolean Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isBooleanValue()
* @generated
* @ordered
*/
protected boolean booleanValue = BOOLEAN_VALUE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PTBooleanLiteralImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return InstantiationPackage.eINSTANCE.getPTBooleanLiteral();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isBooleanValue() {
return booleanValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBooleanValue(boolean newBooleanValue) {
boolean oldBooleanValue = booleanValue;
booleanValue = newBooleanValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InstantiationPackage.PT_BOOLEAN_LITERAL__BOOLEAN_VALUE, oldBooleanValue, booleanValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_BOOLEAN_LITERAL__BOOLEAN_VALUE:
return isBooleanValue() ? Boolean.TRUE : Boolean.FALSE;
}
return eDynamicGet(eFeature, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_BOOLEAN_LITERAL__BOOLEAN_VALUE:
setBooleanValue(((Boolean)newValue).booleanValue());
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_BOOLEAN_LITERAL__BOOLEAN_VALUE:
setBooleanValue(BOOLEAN_VALUE_EDEFAULT);
return;
}
eDynamicUnset(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case InstantiationPackage.PT_BOOLEAN_LITERAL__BOOLEAN_VALUE:
return booleanValue != BOOLEAN_VALUE_EDEFAULT;
}
return eDynamicIsSet(eFeature);
}
public String toString() {
return super.toString(); // Really want toString to be final at PTExpression, but EMF doesn't allow it.
}
/*
* (non-Javadoc)
* @see org.eclipse.jem.internal.instantiation.impl.ExpressionImpl#accept0(org.eclipse.jem.internal.instantiation.ParseVisitor)
*/
protected void accept0(ParseVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
} //BooleanLiteralImpl