blob: d90e67dca9ec8054abdbf6ef5fa161b985d255c6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2015 Xored Software Inc 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:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.tesla.ecl.model.impl;
import org.eclipse.rcptt.tesla.ecl.model.ControlHandler;
import org.eclipse.rcptt.tesla.ecl.model.KeyType;
import org.eclipse.rcptt.tesla.ecl.model.TeslaPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.rcptt.ecl.core.impl.CommandImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Key Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.KeyTypeImpl#getControl <em>Control</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.KeyTypeImpl#getKey <em>Key</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.KeyTypeImpl#getChar <em>Char</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.KeyTypeImpl#isDisplay <em>Display</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.KeyTypeImpl#getTimes <em>Times</em>}</li>
* </ul>
*
* @generated
*/
public class KeyTypeImpl extends CommandImpl implements KeyType {
/**
* The cached value of the '{@link #getControl() <em>Control</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getControl()
* @generated
* @ordered
*/
protected ControlHandler control;
/**
* The default value of the '{@link #getKey() <em>Key</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKey()
* @generated
* @ordered
*/
protected static final String KEY_EDEFAULT = null;
/**
* The cached value of the '{@link #getKey() <em>Key</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKey()
* @generated
* @ordered
*/
protected String key = KEY_EDEFAULT;
/**
* The default value of the '{@link #getChar() <em>Char</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChar()
* @generated
* @ordered
*/
protected static final String CHAR_EDEFAULT = null;
/**
* The cached value of the '{@link #getChar() <em>Char</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChar()
* @generated
* @ordered
*/
protected String char_ = CHAR_EDEFAULT;
/**
* The default value of the '{@link #isDisplay() <em>Display</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDisplay()
* @generated
* @ordered
*/
protected static final boolean DISPLAY_EDEFAULT = false;
/**
* The cached value of the '{@link #isDisplay() <em>Display</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDisplay()
* @generated
* @ordered
*/
protected boolean display = DISPLAY_EDEFAULT;
/**
* The default value of the '{@link #getTimes() <em>Times</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTimes()
* @generated
* @ordered
*/
protected static final Integer TIMES_EDEFAULT = new Integer(1);
/**
* The cached value of the '{@link #getTimes() <em>Times</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTimes()
* @generated
* @ordered
*/
protected Integer times = TIMES_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected KeyTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TeslaPackage.Literals.KEY_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ControlHandler getControl() {
if (control != null && control.eIsProxy()) {
InternalEObject oldControl = (InternalEObject)control;
control = (ControlHandler)eResolveProxy(oldControl);
if (control != oldControl) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TeslaPackage.KEY_TYPE__CONTROL, oldControl, control));
}
}
return control;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ControlHandler basicGetControl() {
return control;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setControl(ControlHandler newControl) {
ControlHandler oldControl = control;
control = newControl;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.KEY_TYPE__CONTROL, oldControl, control));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getKey() {
return key;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKey(String newKey) {
String oldKey = key;
key = newKey;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.KEY_TYPE__KEY, oldKey, key));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getChar() {
return char_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setChar(String newChar) {
String oldChar = char_;
char_ = newChar;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.KEY_TYPE__CHAR, oldChar, char_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isDisplay() {
return display;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDisplay(boolean newDisplay) {
boolean oldDisplay = display;
display = newDisplay;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.KEY_TYPE__DISPLAY, oldDisplay, display));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getTimes() {
return times;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTimes(Integer newTimes) {
Integer oldTimes = times;
times = newTimes;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.KEY_TYPE__TIMES, oldTimes, times));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TeslaPackage.KEY_TYPE__CONTROL:
if (resolve) return getControl();
return basicGetControl();
case TeslaPackage.KEY_TYPE__KEY:
return getKey();
case TeslaPackage.KEY_TYPE__CHAR:
return getChar();
case TeslaPackage.KEY_TYPE__DISPLAY:
return isDisplay();
case TeslaPackage.KEY_TYPE__TIMES:
return getTimes();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TeslaPackage.KEY_TYPE__CONTROL:
setControl((ControlHandler)newValue);
return;
case TeslaPackage.KEY_TYPE__KEY:
setKey((String)newValue);
return;
case TeslaPackage.KEY_TYPE__CHAR:
setChar((String)newValue);
return;
case TeslaPackage.KEY_TYPE__DISPLAY:
setDisplay((Boolean)newValue);
return;
case TeslaPackage.KEY_TYPE__TIMES:
setTimes((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TeslaPackage.KEY_TYPE__CONTROL:
setControl((ControlHandler)null);
return;
case TeslaPackage.KEY_TYPE__KEY:
setKey(KEY_EDEFAULT);
return;
case TeslaPackage.KEY_TYPE__CHAR:
setChar(CHAR_EDEFAULT);
return;
case TeslaPackage.KEY_TYPE__DISPLAY:
setDisplay(DISPLAY_EDEFAULT);
return;
case TeslaPackage.KEY_TYPE__TIMES:
setTimes(TIMES_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TeslaPackage.KEY_TYPE__CONTROL:
return control != null;
case TeslaPackage.KEY_TYPE__KEY:
return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key);
case TeslaPackage.KEY_TYPE__CHAR:
return CHAR_EDEFAULT == null ? char_ != null : !CHAR_EDEFAULT.equals(char_);
case TeslaPackage.KEY_TYPE__DISPLAY:
return display != DISPLAY_EDEFAULT;
case TeslaPackage.KEY_TYPE__TIMES:
return TIMES_EDEFAULT == null ? times != null : !TIMES_EDEFAULT.equals(times);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (key: ");
result.append(key);
result.append(", char: ");
result.append(char_);
result.append(", display: ");
result.append(display);
result.append(", times: ");
result.append(times);
result.append(')');
return result.toString();
}
} //KeyTypeImpl