View Javadoc

1   /**
2    * (c) Mod4j and contributors
3    *
4    * $Id$
5    */
6   package org.mod4j.crossx.mm.crossx.impl;
7   
8   import java.util.Collection;
9   
10  import org.eclipse.emf.common.notify.Notification;
11  import org.eclipse.emf.common.notify.NotificationChain;
12  
13  import org.eclipse.emf.common.util.EList;
14  
15  import org.eclipse.emf.ecore.EClass;
16  import org.eclipse.emf.ecore.InternalEObject;
17  
18  import org.eclipse.emf.ecore.impl.ENotificationImpl;
19  import org.eclipse.emf.ecore.impl.EObjectImpl;
20  
21  import org.eclipse.emf.ecore.util.EObjectContainmentEList;
22  import org.eclipse.emf.ecore.util.InternalEList;
23  
24  import org.mod4j.crossx.mm.crossx.CrossxPackage;
25  import org.mod4j.crossx.mm.crossx.SymbolProperty;
26  
27  /**
28   * <!-- begin-user-doc -->
29   * An implementation of the model object '<em><b>Symbol Property</b></em>'.
30   * <!-- end-user-doc -->
31   * <p>
32   * The following features are implemented:
33   * <ul>
34   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.SymbolPropertyImpl#getName <em>Name</em>}</li>
35   *   <li>{@link org.mod4j.crossx.mm.crossx.impl.SymbolPropertyImpl#getSubProperties <em>Sub Properties</em>}</li>
36   * </ul>
37   * </p>
38   *
39   * @generated
40   */
41  public class SymbolPropertyImpl extends EObjectImpl implements SymbolProperty {
42      /**
43       * The default value of the '{@link #getName() <em>Name</em>}' attribute.
44       * <!-- begin-user-doc -->
45       * <!-- end-user-doc -->
46       * @see #getName()
47       * @generated
48       * @ordered
49       */
50      protected static final String NAME_EDEFAULT = null;
51  
52      /**
53       * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
54       * <!-- begin-user-doc -->
55       * <!-- end-user-doc -->
56       * @see #getName()
57       * @generated
58       * @ordered
59       */
60      protected String name = NAME_EDEFAULT;
61  
62      /**
63       * The cached value of the '{@link #getSubProperties() <em>Sub Properties</em>}' containment reference list.
64       * <!-- begin-user-doc -->
65       * <!-- end-user-doc -->
66       * @see #getSubProperties()
67       * @generated
68       * @ordered
69       */
70      protected EList<SymbolProperty> subProperties;
71  
72      /**
73       * <!-- begin-user-doc -->
74       * <!-- end-user-doc -->
75       * @generated
76       */
77      protected SymbolPropertyImpl() {
78          super();
79      }
80  
81      /**
82       * <!-- begin-user-doc -->
83       * <!-- end-user-doc -->
84       * @generated
85       */
86      @Override
87      protected EClass eStaticClass() {
88          return CrossxPackage.Literals.SYMBOL_PROPERTY;
89      }
90  
91      /**
92       * <!-- begin-user-doc -->
93       * <!-- end-user-doc -->
94       * @generated
95       */
96      public String getName() {
97          return name;
98      }
99  
100     /**
101      * <!-- begin-user-doc -->
102      * <!-- end-user-doc -->
103      * @generated
104      */
105     public void setName(String newName) {
106         String oldName = name;
107         name = newName;
108         if (eNotificationRequired())
109             eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.SYMBOL_PROPERTY__NAME, oldName, name));
110     }
111 
112     /**
113      * <!-- begin-user-doc -->
114      * <!-- end-user-doc -->
115      * @generated
116      */
117     public EList<SymbolProperty> getSubProperties() {
118         if (subProperties == null) {
119             subProperties = new EObjectContainmentEList<SymbolProperty>(SymbolProperty.class, this, CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES);
120         }
121         return subProperties;
122     }
123 
124     /**
125      * <!-- begin-user-doc -->
126      * <!-- end-user-doc -->
127      * @generated
128      */
129     @Override
130     public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
131         switch (featureID) {
132             case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
133                 return ((InternalEList<?>)getSubProperties()).basicRemove(otherEnd, msgs);
134         }
135         return super.eInverseRemove(otherEnd, featureID, msgs);
136     }
137 
138     /**
139      * <!-- begin-user-doc -->
140      * <!-- end-user-doc -->
141      * @generated
142      */
143     @Override
144     public Object eGet(int featureID, boolean resolve, boolean coreType) {
145         switch (featureID) {
146             case CrossxPackage.SYMBOL_PROPERTY__NAME:
147                 return getName();
148             case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
149                 return getSubProperties();
150         }
151         return super.eGet(featureID, resolve, coreType);
152     }
153 
154     /**
155      * <!-- begin-user-doc -->
156      * <!-- end-user-doc -->
157      * @generated
158      */
159     @SuppressWarnings("unchecked")
160     @Override
161     public void eSet(int featureID, Object newValue) {
162         switch (featureID) {
163             case CrossxPackage.SYMBOL_PROPERTY__NAME:
164                 setName((String)newValue);
165                 return;
166             case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
167                 getSubProperties().clear();
168                 getSubProperties().addAll((Collection<? extends SymbolProperty>)newValue);
169                 return;
170         }
171         super.eSet(featureID, newValue);
172     }
173 
174     /**
175      * <!-- begin-user-doc -->
176      * <!-- end-user-doc -->
177      * @generated
178      */
179     @Override
180     public void eUnset(int featureID) {
181         switch (featureID) {
182             case CrossxPackage.SYMBOL_PROPERTY__NAME:
183                 setName(NAME_EDEFAULT);
184                 return;
185             case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
186                 getSubProperties().clear();
187                 return;
188         }
189         super.eUnset(featureID);
190     }
191 
192     /**
193      * <!-- begin-user-doc -->
194      * <!-- end-user-doc -->
195      * @generated
196      */
197     @Override
198     public boolean eIsSet(int featureID) {
199         switch (featureID) {
200             case CrossxPackage.SYMBOL_PROPERTY__NAME:
201                 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
202             case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
203                 return subProperties != null && !subProperties.isEmpty();
204         }
205         return super.eIsSet(featureID);
206     }
207 
208     /**
209      * <!-- begin-user-doc -->
210      * <!-- end-user-doc -->
211      * @generated
212      */
213     @Override
214     public String toString() {
215         if (eIsProxy()) return super.toString();
216 
217         StringBuffer result = new StringBuffer(super.toString());
218         result.append(" (name: ");
219         result.append(name);
220         result.append(')');
221         return result.toString();
222     }
223 
224 } //SymbolPropertyImpl