/*******************************************************************************
* Copyright (c) 2013, 2015 CEA LIST 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:
* E.D.Willink(CEA LIST) - Initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.examples.codegen.cgmodel.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.cgmodel.CGGuardExp;
import org.eclipse.ocl.examples.codegen.cgmodel.CGModelPackage;
import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.cgmodel.util.CGModelVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>CG Guard Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGGuardExpImpl#getMessage <em>Message</em>}</li>
* <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGGuardExpImpl#isSafe <em>Safe</em>}</li>
* </ul>
*
* @generated
*/
public class CGGuardExpImpl extends CGCallExpImpl implements CGGuardExp {
/**
* The default value of the '{@link #getMessage() <em>Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMessage()
* @generated
* @ordered
*/
protected static final String MESSAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getMessage() <em>Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMessage()
* @generated
* @ordered
*/
protected String message = MESSAGE_EDEFAULT;
/**
* The default value of the '{@link #isSafe() <em>Safe</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSafe()
* @generated
* @ordered
*/
protected static final boolean SAFE_EDEFAULT = false;
/**
* The cached value of the '{@link #isSafe() <em>Safe</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSafe()
* @generated
* @ordered
*/
protected boolean safe = SAFE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CGGuardExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CGModelPackage.Literals.CG_GUARD_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getMessage() {
return message;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setMessage(String newMessage) {
String oldMessage = message;
message = newMessage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_GUARD_EXP__MESSAGE, oldMessage, message));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isSafe() {
return safe;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setSafe(boolean newSafe) {
boolean oldSafe = safe;
safe = newSafe;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_GUARD_EXP__SAFE, oldSafe, safe));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CGModelPackage.CG_GUARD_EXP__MESSAGE:
return getMessage();
case CGModelPackage.CG_GUARD_EXP__SAFE:
return isSafe();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CGModelPackage.CG_GUARD_EXP__MESSAGE:
setMessage((String)newValue);
return;
case CGModelPackage.CG_GUARD_EXP__SAFE:
setSafe((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CGModelPackage.CG_GUARD_EXP__MESSAGE:
setMessage(MESSAGE_EDEFAULT);
return;
case CGModelPackage.CG_GUARD_EXP__SAFE:
setSafe(SAFE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CGModelPackage.CG_GUARD_EXP__MESSAGE:
return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message);
case CGModelPackage.CG_GUARD_EXP__SAFE:
return safe != SAFE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull CGModelVisitor<R> visitor) {
return visitor.visitCGGuardExp(this);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable EClassifier getEcoreClassifier() {
return source != null ? source.getEcoreClassifier() : null;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getSourceValue() {
return source != null ? source.getSourceValue() : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getTypedValue() {
return this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getNamedValue() {
return source != null ? source.getNamedValue() : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getReferredValue() {
return source != null ? source : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable String getValueName() {
return source != null ? source.getValueName() : null;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isBoxed() {
return (source != null) && source.isBoxed();
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isEcore() {
return (source != null) && source.isEcore();
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isNonNull() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isNull() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isUnboxed() {
return (source != null) && source.isUnboxed();
}
} //CGGuardExpImpl