blob: 5b0f8e71540c95ba6e4d3d93817eb6a027707c90 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2011 - 2014 University of Padova, Intecs
*
*
* 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
*
*
*****************************************************************************/
package org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.impl;
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.emf.ecore.impl.EObjectImpl;
import org.eclipse.uml2.uml.State;
import org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.ThreatState;
import org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.ThreatsPropagationPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Threat State</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.impl.ThreatStateImpl#getBase_State <em>Base State</em>}</li>
* <li>{@link org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.impl.ThreatStateImpl#getProbability <em>Probability</em>}</li>
* <li>{@link org.polarsys.chess.chessmlprofile.Dependability.ThreatsPropagation.impl.ThreatStateImpl#getUnit <em>Unit</em>}</li>
* </ul>
*
* @generated
*/
public class ThreatStateImpl extends EObjectImpl implements ThreatState {
/**
* The cached value of the '{@link #getBase_State() <em>Base State</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_State()
* @generated
* @ordered
*/
protected State base_State;
/**
* The default value of the '{@link #getProbability() <em>Probability</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProbability()
* @generated
* @ordered
*/
protected static final String PROBABILITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getProbability() <em>Probability</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProbability()
* @generated
* @ordered
*/
protected String probability = PROBABILITY_EDEFAULT;
/**
* The default value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected static final String UNIT_EDEFAULT = null;
/**
* The cached value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected String unit = UNIT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ThreatStateImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ThreatsPropagationPackage.Literals.THREAT_STATE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public State getBase_State() {
if (base_State != null && base_State.eIsProxy()) {
InternalEObject oldBase_State = (InternalEObject)base_State;
base_State = (State)eResolveProxy(oldBase_State);
if (base_State != oldBase_State) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ThreatsPropagationPackage.THREAT_STATE__BASE_STATE, oldBase_State, base_State));
}
}
return base_State;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public State basicGetBase_State() {
return base_State;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_State(State newBase_State) {
State oldBase_State = base_State;
base_State = newBase_State;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThreatsPropagationPackage.THREAT_STATE__BASE_STATE, oldBase_State, base_State));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getProbability() {
return probability;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProbability(String newProbability) {
String oldProbability = probability;
probability = newProbability;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThreatsPropagationPackage.THREAT_STATE__PROBABILITY, oldProbability, probability));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getUnit() {
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUnit(String newUnit) {
String oldUnit = unit;
unit = newUnit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThreatsPropagationPackage.THREAT_STATE__UNIT, oldUnit, unit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ThreatsPropagationPackage.THREAT_STATE__BASE_STATE:
if (resolve) return getBase_State();
return basicGetBase_State();
case ThreatsPropagationPackage.THREAT_STATE__PROBABILITY:
return getProbability();
case ThreatsPropagationPackage.THREAT_STATE__UNIT:
return getUnit();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ThreatsPropagationPackage.THREAT_STATE__BASE_STATE:
setBase_State((State)newValue);
return;
case ThreatsPropagationPackage.THREAT_STATE__PROBABILITY:
setProbability((String)newValue);
return;
case ThreatsPropagationPackage.THREAT_STATE__UNIT:
setUnit((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ThreatsPropagationPackage.THREAT_STATE__BASE_STATE:
setBase_State((State)null);
return;
case ThreatsPropagationPackage.THREAT_STATE__PROBABILITY:
setProbability(PROBABILITY_EDEFAULT);
return;
case ThreatsPropagationPackage.THREAT_STATE__UNIT:
setUnit(UNIT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ThreatsPropagationPackage.THREAT_STATE__BASE_STATE:
return base_State != null;
case ThreatsPropagationPackage.THREAT_STATE__PROBABILITY:
return PROBABILITY_EDEFAULT == null ? probability != null : !PROBABILITY_EDEFAULT.equals(probability);
case ThreatsPropagationPackage.THREAT_STATE__UNIT:
return UNIT_EDEFAULT == null ? unit != null : !UNIT_EDEFAULT.equals(unit);
}
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(" (probability: ");
result.append(probability);
result.append(", unit: ");
result.append(unit);
result.append(')');
return result.toString();
}
} //ThreatStateImpl