001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: DomainTypeImpl.java 7522 2007-09-12 22:00:10Z saul.farber $
006: */package net.opengis.ows.impl;
007:
008: import java.util.Collection;
009:
010: import net.opengis.ows.DomainType;
011: import net.opengis.ows.MetadataType;
012: import net.opengis.ows.OwsPackage;
013:
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.common.notify.NotificationChain;
016:
017: import org.eclipse.emf.common.util.EList;
018:
019: import org.eclipse.emf.ecore.EClass;
020: import org.eclipse.emf.ecore.InternalEObject;
021:
022: import org.eclipse.emf.ecore.impl.ENotificationImpl;
023: import org.eclipse.emf.ecore.impl.EObjectImpl;
024:
025: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
026: import org.eclipse.emf.ecore.util.InternalEList;
027:
028: /**
029: * <!-- begin-user-doc -->
030: * An implementation of the model object '<em><b>Domain Type</b></em>'.
031: * <!-- end-user-doc -->
032: * <p>
033: * The following features are implemented:
034: * <ul>
035: * <li>{@link net.opengis.ows.impl.DomainTypeImpl#getValue <em>Value</em>}</li>
036: * <li>{@link net.opengis.ows.impl.DomainTypeImpl#getMetadata <em>Metadata</em>}</li>
037: * <li>{@link net.opengis.ows.impl.DomainTypeImpl#getName <em>Name</em>}</li>
038: * </ul>
039: * </p>
040: *
041: * @generated
042: */
043: public class DomainTypeImpl extends EObjectImpl implements DomainType {
044: /**
045: * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
046: * <!-- begin-user-doc -->
047: * <!-- end-user-doc -->
048: * @see #getValue()
049: * @generated
050: * @ordered
051: */
052: protected static final String VALUE_EDEFAULT = null;
053:
054: /**
055: * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
056: * <!-- begin-user-doc -->
057: * <!-- end-user-doc -->
058: * @see #getValue()
059: * @generated
060: * @ordered
061: */
062: protected String value = VALUE_EDEFAULT;
063:
064: /**
065: * The cached value of the '{@link #getMetadata() <em>Metadata</em>}' containment reference list.
066: * <!-- begin-user-doc -->
067: * <!-- end-user-doc -->
068: * @see #getMetadata()
069: * @generated
070: * @ordered
071: */
072: protected EList metadata;
073:
074: /**
075: * The default value of the '{@link #getName() <em>Name</em>}' attribute.
076: * <!-- begin-user-doc -->
077: * <!-- end-user-doc -->
078: * @see #getName()
079: * @generated
080: * @ordered
081: */
082: protected static final String NAME_EDEFAULT = null;
083:
084: /**
085: * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
086: * <!-- begin-user-doc -->
087: * <!-- end-user-doc -->
088: * @see #getName()
089: * @generated
090: * @ordered
091: */
092: protected String name = NAME_EDEFAULT;
093:
094: /**
095: * <!-- begin-user-doc -->
096: * <!-- end-user-doc -->
097: * @generated
098: */
099: protected DomainTypeImpl() {
100: super ();
101: }
102:
103: /**
104: * <!-- begin-user-doc -->
105: * <!-- end-user-doc -->
106: * @generated
107: */
108: protected EClass eStaticClass() {
109: return OwsPackage.Literals.DOMAIN_TYPE;
110: }
111:
112: /**
113: * <!-- begin-user-doc -->
114: * <!-- end-user-doc -->
115: * @generated
116: */
117: public String getValue() {
118: return value;
119: }
120:
121: /**
122: * <!-- begin-user-doc -->
123: * <!-- end-user-doc -->
124: * @generated
125: */
126: public void setValue(String newValue) {
127: String oldValue = value;
128: value = newValue;
129: if (eNotificationRequired())
130: eNotify(new ENotificationImpl(this , Notification.SET,
131: OwsPackage.DOMAIN_TYPE__VALUE, oldValue, value));
132: }
133:
134: /**
135: * <!-- begin-user-doc -->
136: * <!-- end-user-doc -->
137: * @generated
138: */
139: public EList getMetadata() {
140: if (metadata == null) {
141: metadata = new EObjectContainmentEList(MetadataType.class,
142: this , OwsPackage.DOMAIN_TYPE__METADATA);
143: }
144: return metadata;
145: }
146:
147: /**
148: * <!-- begin-user-doc -->
149: * <!-- end-user-doc -->
150: * @generated
151: */
152: public String getName() {
153: return name;
154: }
155:
156: /**
157: * <!-- begin-user-doc -->
158: * <!-- end-user-doc -->
159: * @generated
160: */
161: public void setName(String newName) {
162: String oldName = name;
163: name = newName;
164: if (eNotificationRequired())
165: eNotify(new ENotificationImpl(this , Notification.SET,
166: OwsPackage.DOMAIN_TYPE__NAME, oldName, name));
167: }
168:
169: /**
170: * <!-- begin-user-doc -->
171: * <!-- end-user-doc -->
172: * @generated
173: */
174: public NotificationChain eInverseRemove(InternalEObject otherEnd,
175: int featureID, NotificationChain msgs) {
176: switch (featureID) {
177: case OwsPackage.DOMAIN_TYPE__METADATA:
178: return ((InternalEList) getMetadata()).basicRemove(
179: otherEnd, msgs);
180: }
181: return super .eInverseRemove(otherEnd, featureID, msgs);
182: }
183:
184: /**
185: * <!-- begin-user-doc -->
186: * <!-- end-user-doc -->
187: * @generated
188: */
189: public Object eGet(int featureID, boolean resolve, boolean coreType) {
190: switch (featureID) {
191: case OwsPackage.DOMAIN_TYPE__VALUE:
192: return getValue();
193: case OwsPackage.DOMAIN_TYPE__METADATA:
194: return getMetadata();
195: case OwsPackage.DOMAIN_TYPE__NAME:
196: return getName();
197: }
198: return super .eGet(featureID, resolve, coreType);
199: }
200:
201: /**
202: * <!-- begin-user-doc -->
203: * <!-- end-user-doc -->
204: * @generated
205: */
206: public void eSet(int featureID, Object newValue) {
207: switch (featureID) {
208: case OwsPackage.DOMAIN_TYPE__VALUE:
209: setValue((String) newValue);
210: return;
211: case OwsPackage.DOMAIN_TYPE__METADATA:
212: getMetadata().clear();
213: getMetadata().addAll((Collection) newValue);
214: return;
215: case OwsPackage.DOMAIN_TYPE__NAME:
216: setName((String) newValue);
217: return;
218: }
219: super .eSet(featureID, newValue);
220: }
221:
222: /**
223: * <!-- begin-user-doc -->
224: * <!-- end-user-doc -->
225: * @generated
226: */
227: public void eUnset(int featureID) {
228: switch (featureID) {
229: case OwsPackage.DOMAIN_TYPE__VALUE:
230: setValue(VALUE_EDEFAULT);
231: return;
232: case OwsPackage.DOMAIN_TYPE__METADATA:
233: getMetadata().clear();
234: return;
235: case OwsPackage.DOMAIN_TYPE__NAME:
236: setName(NAME_EDEFAULT);
237: return;
238: }
239: super .eUnset(featureID);
240: }
241:
242: /**
243: * <!-- begin-user-doc -->
244: * <!-- end-user-doc -->
245: * @generated
246: */
247: public boolean eIsSet(int featureID) {
248: switch (featureID) {
249: case OwsPackage.DOMAIN_TYPE__VALUE:
250: return VALUE_EDEFAULT == null ? value != null
251: : !VALUE_EDEFAULT.equals(value);
252: case OwsPackage.DOMAIN_TYPE__METADATA:
253: return metadata != null && !metadata.isEmpty();
254: case OwsPackage.DOMAIN_TYPE__NAME:
255: return NAME_EDEFAULT == null ? name != null
256: : !NAME_EDEFAULT.equals(name);
257: }
258: return super .eIsSet(featureID);
259: }
260:
261: /**
262: * <!-- begin-user-doc -->
263: * <!-- end-user-doc -->
264: * @generated
265: */
266: public String toString() {
267: if (eIsProxy())
268: return super .toString();
269:
270: StringBuffer result = new StringBuffer(super .toString());
271: result.append(" (value: ");
272: result.append(value);
273: result.append(", name: ");
274: result.append(name);
275: result.append(')');
276: return result.toString();
277: }
278:
279: } //DomainTypeImpl
|