blob: b043eb05fa6efbb0a21de13db41bfeeec39b625c [file] [log] [blame]
/*******************************************************************************
* 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.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.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.cgmodel.CGInvalid;
import org.eclipse.ocl.examples.codegen.cgmodel.CGIsEqualExp;
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 Is Equal Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGIsEqualExpImpl#getArgument <em>Argument</em>}</li>
* <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGIsEqualExpImpl#isNotEquals <em>Not Equals</em>}</li>
* </ul>
*
* @generated
*/
public class CGIsEqualExpImpl extends CGCallExpImpl implements CGIsEqualExp {
/**
* The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArgument()
* @generated
* @ordered
*/
protected CGValuedElement argument;
/**
* The default value of the '{@link #isNotEquals() <em>Not Equals</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNotEquals()
* @generated
* @ordered
*/
protected static final boolean NOT_EQUALS_EDEFAULT = false;
/**
* The cached value of the '{@link #isNotEquals() <em>Not Equals</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNotEquals()
* @generated
* @ordered
*/
protected boolean notEquals = NOT_EQUALS_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CGIsEqualExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CGModelPackage.Literals.CG_IS_EQUAL_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public CGValuedElement getArgument() {
return argument;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetArgument(CGValuedElement newArgument, NotificationChain msgs) {
CGValuedElement oldArgument = argument;
argument = newArgument;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT, oldArgument, newArgument);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setArgument(CGValuedElement newArgument) {
if (newArgument != argument) {
NotificationChain msgs = null;
if (argument != null)
msgs = ((InternalEObject)argument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT, null, msgs);
if (newArgument != null)
msgs = ((InternalEObject)newArgument).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT, null, msgs);
msgs = basicSetArgument(newArgument, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT, newArgument, newArgument));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isNotEquals() {
return notEquals;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setNotEquals(boolean newNotEquals) {
boolean oldNotEquals = notEquals;
notEquals = newNotEquals;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_IS_EQUAL_EXP__NOT_EQUALS, oldNotEquals, notEquals));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT:
return basicSetArgument(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 CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT:
return getArgument();
case CGModelPackage.CG_IS_EQUAL_EXP__NOT_EQUALS:
return isNotEquals();
}
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_IS_EQUAL_EXP__ARGUMENT:
setArgument((CGValuedElement)newValue);
return;
case CGModelPackage.CG_IS_EQUAL_EXP__NOT_EQUALS:
setNotEquals((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_IS_EQUAL_EXP__ARGUMENT:
setArgument((CGValuedElement)null);
return;
case CGModelPackage.CG_IS_EQUAL_EXP__NOT_EQUALS:
setNotEquals(NOT_EQUALS_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CGModelPackage.CG_IS_EQUAL_EXP__ARGUMENT:
return argument != null;
case CGModelPackage.CG_IS_EQUAL_EXP__NOT_EQUALS:
return notEquals != NOT_EQUALS_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable <R> R accept(@NonNull CGModelVisitor<R> visitor) {
return visitor.visitCGIsEqualExp(this);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable CGInvalid getInvalidValue() {
CGInvalid invalidValue = source.getInvalidValue();
if (invalidValue == null) {
invalidValue = argument.getInvalidValue();
}
return invalidValue;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isBoxed() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isConstant() {
return source.isConstant() && argument.isConstant();
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isEcore() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isFalse() {
return (source != null) && (argument != null) && (source.isEquivalentTo(argument) == Boolean.valueOf(notEquals));
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isInlined() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isNonInvalid() {
return source.isNonInvalid() && argument.isNonInvalid();
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isNonNull() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isNull() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isTrue() {
return (source != null) && (argument != null) && (source.isEquivalentTo(argument) == Boolean.valueOf(!notEquals));
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isUnboxed() {
return true;
}
} //CGIsEqualExpImpl