/*******************************************************************************
* Copyright (c) 2008 xored software, Inc.
*
* 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:
* xored software, Inc. - initial API and Implementation (Andrei Sobolev)
*******************************************************************************/
package org.eclipse.dltk.tcl.definitions.impl;
import org.eclipse.dltk.tcl.definitions.Constant;
import org.eclipse.dltk.tcl.definitions.DefinitionsPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Constant</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.dltk.tcl.definitions.impl.ConstantImpl#getLowerBound <em>Lower Bound</em>}</li>
* <li>{@link org.eclipse.dltk.tcl.definitions.impl.ConstantImpl#getUpperBound <em>Upper Bound</em>}</li>
* <li>{@link org.eclipse.dltk.tcl.definitions.impl.ConstantImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.dltk.tcl.definitions.impl.ConstantImpl#isStrictMatch <em>Strict Match</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConstantImpl extends EObjectImpl implements Constant {
/**
* The default value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLowerBound()
* @generated
* @ordered
*/
protected static final int LOWER_BOUND_EDEFAULT = 1;
/**
* The cached value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLowerBound()
* @generated
* @ordered
*/
protected int lowerBound = LOWER_BOUND_EDEFAULT;
/**
* The default value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpperBound()
* @generated
* @ordered
*/
protected static final int UPPER_BOUND_EDEFAULT = 1;
/**
* The cached value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpperBound()
* @generated
* @ordered
*/
protected int upperBound = UPPER_BOUND_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #isStrictMatch() <em>Strict Match</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isStrictMatch()
* @generated
* @ordered
*/
protected static final boolean STRICT_MATCH_EDEFAULT = false;
/**
* The cached value of the '{@link #isStrictMatch() <em>Strict Match</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isStrictMatch()
* @generated
* @ordered
*/
protected boolean strictMatch = STRICT_MATCH_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConstantImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DefinitionsPackage.Literals.CONSTANT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getLowerBound() {
return lowerBound;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLowerBound(int newLowerBound) {
int oldLowerBound = lowerBound;
lowerBound = newLowerBound;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.CONSTANT__LOWER_BOUND, oldLowerBound, lowerBound));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getUpperBound() {
return upperBound;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUpperBound(int newUpperBound) {
int oldUpperBound = upperBound;
upperBound = newUpperBound;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.CONSTANT__UPPER_BOUND, oldUpperBound, upperBound));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.CONSTANT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isStrictMatch() {
return strictMatch;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStrictMatch(boolean newStrictMatch) {
boolean oldStrictMatch = strictMatch;
strictMatch = newStrictMatch;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.CONSTANT__STRICT_MATCH, oldStrictMatch, strictMatch));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DefinitionsPackage.CONSTANT__LOWER_BOUND:
return new Integer(getLowerBound());
case DefinitionsPackage.CONSTANT__UPPER_BOUND:
return new Integer(getUpperBound());
case DefinitionsPackage.CONSTANT__NAME:
return getName();
case DefinitionsPackage.CONSTANT__STRICT_MATCH:
return isStrictMatch() ? Boolean.TRUE : Boolean.FALSE;
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DefinitionsPackage.CONSTANT__LOWER_BOUND:
setLowerBound(((Integer)newValue).intValue());
return;
case DefinitionsPackage.CONSTANT__UPPER_BOUND:
setUpperBound(((Integer)newValue).intValue());
return;
case DefinitionsPackage.CONSTANT__NAME:
setName((String)newValue);
return;
case DefinitionsPackage.CONSTANT__STRICT_MATCH:
setStrictMatch(((Boolean)newValue).booleanValue());
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DefinitionsPackage.CONSTANT__LOWER_BOUND:
setLowerBound(LOWER_BOUND_EDEFAULT);
return;
case DefinitionsPackage.CONSTANT__UPPER_BOUND:
setUpperBound(UPPER_BOUND_EDEFAULT);
return;
case DefinitionsPackage.CONSTANT__NAME:
setName(NAME_EDEFAULT);
return;
case DefinitionsPackage.CONSTANT__STRICT_MATCH:
setStrictMatch(STRICT_MATCH_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DefinitionsPackage.CONSTANT__LOWER_BOUND:
return lowerBound != LOWER_BOUND_EDEFAULT;
case DefinitionsPackage.CONSTANT__UPPER_BOUND:
return upperBound != UPPER_BOUND_EDEFAULT;
case DefinitionsPackage.CONSTANT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case DefinitionsPackage.CONSTANT__STRICT_MATCH:
return strictMatch != STRICT_MATCH_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (lowerBound: ");
result.append(lowerBound);
result.append(", upperBound: ");
result.append(upperBound);
result.append(", name: ");
result.append(name);
result.append(", strictMatch: ");
result.append(strictMatch);
result.append(')');
return result.toString();
}
} //ConstantImpl