001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.impl;
007:
008: import newprocess.ConditionTerm;
009: import newprocess.Expression;
010: import newprocess.NewprocessPackage;
011: import newprocess.Root;
012: import newprocess.Term;
013:
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.ecore.EClass;
016: import org.eclipse.emf.ecore.InternalEObject;
017: import org.eclipse.emf.ecore.impl.ENotificationImpl;
018: import org.eclipse.emf.ecore.impl.EObjectImpl;
019:
020: /**
021: * <!-- begin-user-doc -->
022: * An implementation of the model object '<em><b>Root</b></em>'.
023: * <!-- end-user-doc -->
024: * <p>
025: * The following features are implemented:
026: * <ul>
027: * <li>{@link newprocess.impl.RootImpl#getTerm <em>Term</em>}</li>
028: * </ul>
029: * </p>
030: *
031: * @generated
032: */
033: public class RootImpl extends EObjectImpl implements Root {
034: /**
035: * The cached value of the '{@link #getTerm() <em>Term</em>}' reference.
036: * <!-- begin-user-doc -->
037: * <!-- end-user-doc -->
038: * @see #getTerm()
039: * @generated
040: * @ordered
041: */
042: protected Term term = null;
043:
044: /**
045: * <!-- begin-user-doc -->
046: * <!-- end-user-doc -->
047: * @generated
048: */
049: protected RootImpl() {
050: super ();
051: }
052:
053: /**
054: * <!-- begin-user-doc -->
055: * <!-- end-user-doc -->
056: * @generated
057: */
058: @Override
059: protected EClass eStaticClass() {
060: return NewprocessPackage.Literals.ROOT;
061: }
062:
063: /**
064: * <!-- begin-user-doc -->
065: * <!-- end-user-doc -->
066: * @generated
067: */
068: public Term getTerm() {
069: if (term != null && term.eIsProxy()) {
070: InternalEObject oldTerm = (InternalEObject) term;
071: term = (Term) eResolveProxy(oldTerm);
072: if (term != oldTerm) {
073: if (eNotificationRequired())
074: eNotify(new ENotificationImpl(this ,
075: Notification.RESOLVE,
076: NewprocessPackage.ROOT__TERM, oldTerm, term));
077: }
078: }
079: return term;
080: }
081:
082: /**
083: * <!-- begin-user-doc -->
084: * <!-- end-user-doc -->
085: * @generated
086: */
087: public Term basicGetTerm() {
088: return term;
089: }
090:
091: /**
092: * <!-- begin-user-doc -->
093: * <!-- end-user-doc -->
094: * @generated
095: */
096: public void setTerm(Term newTerm) {
097: Term oldTerm = term;
098: term = newTerm;
099: if (eNotificationRequired())
100: eNotify(new ENotificationImpl(this , Notification.SET,
101: NewprocessPackage.ROOT__TERM, oldTerm, term));
102: }
103:
104: /**
105: * <!-- begin-user-doc -->
106: * a Link to a ConditionPort accepted if there are no AbstractTerm
107: * a Link to a AbstractOperation is accepted if not set.
108: * <!-- end-user-doc -->
109: * @generated NOT
110: * @author sh
111: */
112: public boolean acceptOutgoingLink(int type) {
113: if (getTerm() != null)
114: return false; // allready set
115:
116: if (type == PORT) {
117: Expression con = (Expression) eContainer();
118: return con.getHasTerms().isEmpty();
119: }
120: return true;
121: }
122:
123: /**
124: * <!-- begin-user-doc -->
125: * get the expression form linked term
126: * <!-- end-user-doc -->
127: * @generated NOT
128: * @author sh
129: */
130: public String getExpression() {
131: if (getTerm() == null)
132: return null;
133: else
134: return getTerm().getExpression();
135: }
136:
137: /**
138: * <!-- begin-user-doc -->
139: * true if the RootPort is not connected to a ConditionPort
140: * <!-- end-user-doc -->
141: * @generated NOT
142: * @author sh
143: */
144: public boolean acceptOperator() {
145: return (getTerm() == null || !(getTerm() instanceof ConditionTerm));
146: }
147:
148: /**
149: * <!-- begin-user-doc -->
150: * <!-- end-user-doc -->
151: * @generated
152: */
153: @Override
154: public Object eGet(int featureID, boolean resolve, boolean coreType) {
155: switch (featureID) {
156: case NewprocessPackage.ROOT__TERM:
157: if (resolve)
158: return getTerm();
159: return basicGetTerm();
160: }
161: return super .eGet(featureID, resolve, coreType);
162: }
163:
164: /**
165: * <!-- begin-user-doc -->
166: * <!-- end-user-doc -->
167: * @generated
168: */
169: @Override
170: public void eSet(int featureID, Object newValue) {
171: switch (featureID) {
172: case NewprocessPackage.ROOT__TERM:
173: setTerm((Term) newValue);
174: return;
175: }
176: super .eSet(featureID, newValue);
177: }
178:
179: /**
180: * <!-- begin-user-doc -->
181: * <!-- end-user-doc -->
182: * @generated
183: */
184: @Override
185: public void eUnset(int featureID) {
186: switch (featureID) {
187: case NewprocessPackage.ROOT__TERM:
188: setTerm((Term) null);
189: return;
190: }
191: super .eUnset(featureID);
192: }
193:
194: /**
195: * <!-- begin-user-doc -->
196: * <!-- end-user-doc -->
197: * @generated
198: */
199: @Override
200: public boolean eIsSet(int featureID) {
201: switch (featureID) {
202: case NewprocessPackage.ROOT__TERM:
203: return term != null;
204: }
205: return super .eIsSet(featureID);
206: }
207:
208: } //RootImpl
|