blob: 84b95cbd3ba994d8a54fd6cba21d55f8b6de2619 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013, 2019 CEA LIST and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink(CEA LIST) - Initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.examples.codegen.cgmodel.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.cgmodel.CGModelPackage;
import org.eclipse.ocl.examples.codegen.cgmodel.CGUnlimited;
import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.cgmodel.util.CGModelVisitor;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>CG Infinity</b></em>'.
* <!-- end-user-doc -->
*
* @generated
*/
public class CGUnlimitedImpl extends CGConstantImpl implements CGUnlimited {
/**
* The number of structural features of the '<em>CG Unlimited</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int CG_UNLIMITED_FEATURE_COUNT = CGConstantImpl.CG_CONSTANT_FEATURE_COUNT + 0;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CGUnlimitedImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CGModelPackage.Literals.CG_UNLIMITED;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull CGModelVisitor<R> visitor) {
return visitor.visitCGUnlimited(this);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull Object getConstantValue() {
return ValueUtil.UNLIMITED_VALUE;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isEcore() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable Boolean isEquivalentToInternal(@NonNull CGValuedElement thatValue) {
if (!thatValue.isNonInvalid()) {
return null;
}
CGValuedElement value = thatValue.getNamedValue();
if (this == value) {
return Boolean.TRUE;
}
if (!value.isConstant()) {
return null;
}
else if (value instanceof CGUnlimited) {
return Boolean.TRUE;
}
else {
return Boolean.FALSE;
}
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isInlined() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isUnboxed() {
return false;
}
} //CGInfinityImpl