001/**
002 * ******************************************************************************
003 * Copyright (c) 2018 Red Hat Inc
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *  *
009 * Contributors:
010 *     Jens Reimann - initial API and implementation
011 *  ******************************************************************************
012 */
013package de.dentrassi.varlink.idl.varlinkIdl.impl;
014
015import de.dentrassi.varlink.idl.varlinkIdl.Arguments;
016import de.dentrassi.varlink.idl.varlinkIdl.Method;
017import de.dentrassi.varlink.idl.varlinkIdl.Result;
018import de.dentrassi.varlink.idl.varlinkIdl.VarlinkIdlPackage;
019
020import org.eclipse.emf.common.notify.Notification;
021import org.eclipse.emf.common.notify.NotificationChain;
022
023import org.eclipse.emf.ecore.EClass;
024import org.eclipse.emf.ecore.InternalEObject;
025
026import org.eclipse.emf.ecore.impl.ENotificationImpl;
027
028/**
029 * <!-- begin-user-doc -->
030 * An implementation of the model object '<em><b>Method</b></em>'.
031 * <!-- end-user-doc -->
032 * <p>
033 * The following features are implemented:
034 * </p>
035 * <ul>
036 *   <li>{@link de.dentrassi.varlink.idl.varlinkIdl.impl.MethodImpl#getArguments <em>Arguments</em>}</li>
037 *   <li>{@link de.dentrassi.varlink.idl.varlinkIdl.impl.MethodImpl#getResult <em>Result</em>}</li>
038 * </ul>
039 *
040 * @generated
041 */
042public class MethodImpl extends MemberImpl implements Method
043{
044  /**
045   * The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference.
046   * <!-- begin-user-doc -->
047   * <!-- end-user-doc -->
048   * @see #getArguments()
049   * @generated
050   * @ordered
051   */
052  protected Arguments arguments;
053
054  /**
055   * The cached value of the '{@link #getResult() <em>Result</em>}' containment reference.
056   * <!-- begin-user-doc -->
057   * <!-- end-user-doc -->
058   * @see #getResult()
059   * @generated
060   * @ordered
061   */
062  protected Result result;
063
064  /**
065   * <!-- begin-user-doc -->
066   * <!-- end-user-doc -->
067   * @generated
068   */
069  protected MethodImpl()
070  {
071    super();
072  }
073
074  /**
075   * <!-- begin-user-doc -->
076   * <!-- end-user-doc -->
077   * @generated
078   */
079  @Override
080  protected EClass eStaticClass()
081  {
082    return VarlinkIdlPackage.Literals.METHOD;
083  }
084
085  /**
086   * <!-- begin-user-doc -->
087   * <!-- end-user-doc -->
088   * @generated
089   */
090  public Arguments getArguments()
091  {
092    return arguments;
093  }
094
095  /**
096   * <!-- begin-user-doc -->
097   * <!-- end-user-doc -->
098   * @generated
099   */
100  public NotificationChain basicSetArguments(Arguments newArguments, NotificationChain msgs)
101  {
102    Arguments oldArguments = arguments;
103    arguments = newArguments;
104    if (eNotificationRequired())
105    {
106      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.METHOD__ARGUMENTS, oldArguments, newArguments);
107      if (msgs == null) msgs = notification; else msgs.add(notification);
108    }
109    return msgs;
110  }
111
112  /**
113   * <!-- begin-user-doc -->
114   * <!-- end-user-doc -->
115   * @generated
116   */
117  public void setArguments(Arguments newArguments)
118  {
119    if (newArguments != arguments)
120    {
121      NotificationChain msgs = null;
122      if (arguments != null)
123        msgs = ((InternalEObject)arguments).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.METHOD__ARGUMENTS, null, msgs);
124      if (newArguments != null)
125        msgs = ((InternalEObject)newArguments).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.METHOD__ARGUMENTS, null, msgs);
126      msgs = basicSetArguments(newArguments, msgs);
127      if (msgs != null) msgs.dispatch();
128    }
129    else if (eNotificationRequired())
130      eNotify(new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.METHOD__ARGUMENTS, newArguments, newArguments));
131  }
132
133  /**
134   * <!-- begin-user-doc -->
135   * <!-- end-user-doc -->
136   * @generated
137   */
138  public Result getResult()
139  {
140    return result;
141  }
142
143  /**
144   * <!-- begin-user-doc -->
145   * <!-- end-user-doc -->
146   * @generated
147   */
148  public NotificationChain basicSetResult(Result newResult, NotificationChain msgs)
149  {
150    Result oldResult = result;
151    result = newResult;
152    if (eNotificationRequired())
153    {
154      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.METHOD__RESULT, oldResult, newResult);
155      if (msgs == null) msgs = notification; else msgs.add(notification);
156    }
157    return msgs;
158  }
159
160  /**
161   * <!-- begin-user-doc -->
162   * <!-- end-user-doc -->
163   * @generated
164   */
165  public void setResult(Result newResult)
166  {
167    if (newResult != result)
168    {
169      NotificationChain msgs = null;
170      if (result != null)
171        msgs = ((InternalEObject)result).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.METHOD__RESULT, null, msgs);
172      if (newResult != null)
173        msgs = ((InternalEObject)newResult).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VarlinkIdlPackage.METHOD__RESULT, null, msgs);
174      msgs = basicSetResult(newResult, msgs);
175      if (msgs != null) msgs.dispatch();
176    }
177    else if (eNotificationRequired())
178      eNotify(new ENotificationImpl(this, Notification.SET, VarlinkIdlPackage.METHOD__RESULT, newResult, newResult));
179  }
180
181  /**
182   * <!-- begin-user-doc -->
183   * <!-- end-user-doc -->
184   * @generated
185   */
186  @Override
187  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
188  {
189    switch (featureID)
190    {
191      case VarlinkIdlPackage.METHOD__ARGUMENTS:
192        return basicSetArguments(null, msgs);
193      case VarlinkIdlPackage.METHOD__RESULT:
194        return basicSetResult(null, msgs);
195    }
196    return super.eInverseRemove(otherEnd, featureID, msgs);
197  }
198
199  /**
200   * <!-- begin-user-doc -->
201   * <!-- end-user-doc -->
202   * @generated
203   */
204  @Override
205  public Object eGet(int featureID, boolean resolve, boolean coreType)
206  {
207    switch (featureID)
208    {
209      case VarlinkIdlPackage.METHOD__ARGUMENTS:
210        return getArguments();
211      case VarlinkIdlPackage.METHOD__RESULT:
212        return getResult();
213    }
214    return super.eGet(featureID, resolve, coreType);
215  }
216
217  /**
218   * <!-- begin-user-doc -->
219   * <!-- end-user-doc -->
220   * @generated
221   */
222  @Override
223  public void eSet(int featureID, Object newValue)
224  {
225    switch (featureID)
226    {
227      case VarlinkIdlPackage.METHOD__ARGUMENTS:
228        setArguments((Arguments)newValue);
229        return;
230      case VarlinkIdlPackage.METHOD__RESULT:
231        setResult((Result)newValue);
232        return;
233    }
234    super.eSet(featureID, newValue);
235  }
236
237  /**
238   * <!-- begin-user-doc -->
239   * <!-- end-user-doc -->
240   * @generated
241   */
242  @Override
243  public void eUnset(int featureID)
244  {
245    switch (featureID)
246    {
247      case VarlinkIdlPackage.METHOD__ARGUMENTS:
248        setArguments((Arguments)null);
249        return;
250      case VarlinkIdlPackage.METHOD__RESULT:
251        setResult((Result)null);
252        return;
253    }
254    super.eUnset(featureID);
255  }
256
257  /**
258   * <!-- begin-user-doc -->
259   * <!-- end-user-doc -->
260   * @generated
261   */
262  @Override
263  public boolean eIsSet(int featureID)
264  {
265    switch (featureID)
266    {
267      case VarlinkIdlPackage.METHOD__ARGUMENTS:
268        return arguments != null;
269      case VarlinkIdlPackage.METHOD__RESULT:
270        return result != null;
271    }
272    return super.eIsSet(featureID);
273  }
274
275} //MethodImpl