001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.impl;
007:
008: import newprocess.Direction;
009: import newprocess.Message;
010: import newprocess.NewprocessPackage;
011: import newprocess.validation.MessageValidator;
012: import newprocess.validation.MessageValidatorImpl;
013:
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.ecore.EClass;
016: import org.eclipse.emf.ecore.EObject;
017: import org.eclipse.emf.ecore.impl.ENotificationImpl;
018:
019: /**
020: * <!-- begin-user-doc -->
021: * An implementation of the model object '<em><b>Message</b></em>'.
022: * <!-- end-user-doc -->
023: * <p>
024: * The following features are implemented:
025: * <ul>
026: * <li>{@link newprocess.impl.MessageImpl#getDirection <em>Direction</em>}</li>
027: * </ul>
028: * </p>
029: *
030: * @generated NOT
031: * @author sh
032: */
033: public class MessageImpl extends ElementImpl implements Message,
034: MessageValidator {
035:
036: /**
037: * The default value of the '{@link #getDirection() <em>Direction</em>}' attribute.
038: * <!-- begin-user-doc -->
039: * <!-- end-user-doc -->
040: * @see #getDirection()
041: * @generated
042: * @ordered
043: */
044: protected static final Direction DIRECTION_EDEFAULT = Direction.INCOMING;
045:
046: /**
047: * The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
048: * <!-- begin-user-doc -->
049: * <!-- end-user-doc -->
050: * @see #getDirection()
051: * @generated
052: * @ordered
053: */
054: protected Direction direction = DIRECTION_EDEFAULT;
055:
056: /**
057: * <!-- begin-user-doc -->
058: * <!-- end-user-doc -->
059: * @generated
060: */
061: protected MessageImpl() {
062: super ();
063: }
064:
065: /**
066: * <!-- begin-user-doc -->
067: * <!-- end-user-doc -->
068: * @generated
069: */
070: @Override
071: protected EClass eStaticClass() {
072: return NewprocessPackage.Literals.MESSAGE;
073: }
074:
075: /**
076: * <!-- begin-user-doc -->
077: * <!-- end-user-doc -->
078: * @generated
079: */
080: public Direction getDirection() {
081: return direction;
082: }
083:
084: /**
085: * <!-- begin-user-doc -->
086: * <!-- end-user-doc -->
087: * @generated
088: */
089: public void setDirection(Direction newDirection) {
090: Direction oldDirection = direction;
091: direction = newDirection == null ? DIRECTION_EDEFAULT
092: : newDirection;
093: if (eNotificationRequired())
094: eNotify(new ENotificationImpl(this , Notification.SET,
095: NewprocessPackage.MESSAGE__DIRECTION, oldDirection,
096: direction));
097: }
098:
099: /**
100: * <!-- begin-user-doc -->
101: * <!-- end-user-doc -->
102: * @generated
103: */
104: @Override
105: public Object eGet(int featureID, boolean resolve, boolean coreType) {
106: switch (featureID) {
107: case NewprocessPackage.MESSAGE__DIRECTION:
108: return getDirection();
109: }
110: return super .eGet(featureID, resolve, coreType);
111: }
112:
113: /**
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @generated
117: */
118: @Override
119: public void eSet(int featureID, Object newValue) {
120: switch (featureID) {
121: case NewprocessPackage.MESSAGE__DIRECTION:
122: setDirection((Direction) newValue);
123: return;
124: }
125: super .eSet(featureID, newValue);
126: }
127:
128: /**
129: * <!-- begin-user-doc -->
130: * <!-- end-user-doc -->
131: * @generated
132: */
133: @Override
134: public void eUnset(int featureID) {
135: switch (featureID) {
136: case NewprocessPackage.MESSAGE__DIRECTION:
137: setDirection(DIRECTION_EDEFAULT);
138: return;
139: }
140: super .eUnset(featureID);
141: }
142:
143: /**
144: * <!-- begin-user-doc -->
145: * <!-- end-user-doc -->
146: * @generated
147: */
148: @Override
149: public boolean eIsSet(int featureID) {
150: switch (featureID) {
151: case NewprocessPackage.MESSAGE__DIRECTION:
152: return direction != DIRECTION_EDEFAULT;
153: }
154: return super .eIsSet(featureID);
155: }
156:
157: /**
158: * <!-- begin-user-doc -->
159: * <!-- end-user-doc -->
160: * @generated
161: */
162: @Override
163: public String toString() {
164: if (eIsProxy())
165: return super .toString();
166:
167: StringBuffer result = new StringBuffer(super .toString());
168: result.append(" (direction: ");
169: result.append(direction);
170: result.append(')');
171: return result.toString();
172: }
173:
174: /**
175: * Validates the object an the name of the Message
176: * @author sh
177: */
178: public boolean validate(EObject obj) {
179: return MessageValidatorImpl.INSTANCE.validate(obj);
180: }
181:
182: /**
183: * Validates the name of the Message
184: * @author sh
185: */
186: public boolean validateName(Message msg) {
187: return MessageValidatorImpl.INSTANCE.validateName(msg);
188: }
189: } //MessageImpl
|