1 17 package org.eclipse.emf.ecore.xml.type.impl; 18 19 import java.util.Collection ; 20 21 import org.eclipse.emf.common.notify.NotificationChain; 22 import org.eclipse.emf.ecore.EClass; 23 import org.eclipse.emf.ecore.EStructuralFeature; 24 import org.eclipse.emf.ecore.InternalEObject; 25 import org.eclipse.emf.ecore.impl.EObjectImpl; 26 import org.eclipse.emf.ecore.util.BasicFeatureMap; 27 import org.eclipse.emf.ecore.util.FeatureMap; 28 import org.eclipse.emf.ecore.util.InternalEList; 29 import org.eclipse.emf.ecore.xml.type.AnyType; 30 import org.eclipse.emf.ecore.xml.type.XMLTypePackage; 31 32 47 public class AnyTypeImpl extends EObjectImpl implements AnyType 48 { 49 57 protected FeatureMap mixed = null; 58 59 67 protected FeatureMap anyAttribute = null; 68 69 74 protected AnyTypeImpl() 75 { 76 super(); 77 } 78 79 84 protected EClass eStaticClass() 85 { 86 return XMLTypePackage.eINSTANCE.getAnyType(); 87 } 88 89 94 public FeatureMap getMixed() 95 { 96 if (mixed == null) 97 { 98 mixed = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__MIXED); 99 } 100 return mixed; 101 } 102 103 108 public FeatureMap getAny() 109 { 110 return (FeatureMap)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any()); 111 } 112 113 118 public FeatureMap getAnyAttribute() 119 { 120 if (anyAttribute == null) 121 { 122 anyAttribute = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE); 123 } 124 return anyAttribute; 125 } 126 127 132 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 133 { 134 if (featureID >= 0) 135 { 136 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 137 { 138 case XMLTypePackage.ANY_TYPE__MIXED: 139 return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs); 140 case XMLTypePackage.ANY_TYPE__ANY: 141 return ((InternalEList)getAny()).basicRemove(otherEnd, msgs); 142 case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: 143 return ((InternalEList)getAnyAttribute()).basicRemove(otherEnd, msgs); 144 default: 145 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 146 } 147 } 148 return eBasicSetContainer(null, featureID, msgs); 149 } 150 151 156 public Object eGet(EStructuralFeature eFeature, boolean resolve) 157 { 158 switch (eDerivedStructuralFeatureID(eFeature)) 159 { 160 case XMLTypePackage.ANY_TYPE__MIXED: 161 return getMixed(); 162 case XMLTypePackage.ANY_TYPE__ANY: 163 return getAny(); 164 case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: 165 return getAnyAttribute(); 166 } 167 return eDynamicGet(eFeature, resolve); 168 } 169 170 175 public void eSet(EStructuralFeature eFeature, Object newValue) 176 { 177 switch (eDerivedStructuralFeatureID(eFeature)) 178 { 179 case XMLTypePackage.ANY_TYPE__MIXED: 180 getMixed().clear(); 181 getMixed().addAll((Collection )newValue); 182 return; 183 case XMLTypePackage.ANY_TYPE__ANY: 184 getAny().clear(); 185 getAny().addAll((Collection )newValue); 186 return; 187 case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: 188 getAnyAttribute().clear(); 189 getAnyAttribute().addAll((Collection )newValue); 190 return; 191 } 192 eDynamicSet(eFeature, newValue); 193 } 194 195 200 public void eUnset(EStructuralFeature eFeature) 201 { 202 switch (eDerivedStructuralFeatureID(eFeature)) 203 { 204 case XMLTypePackage.ANY_TYPE__MIXED: 205 getMixed().clear(); 206 return; 207 case XMLTypePackage.ANY_TYPE__ANY: 208 getAny().clear(); 209 return; 210 case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: 211 getAnyAttribute().clear(); 212 return; 213 } 214 eDynamicUnset(eFeature); 215 } 216 217 222 public boolean eIsSet(EStructuralFeature eFeature) 223 { 224 switch (eDerivedStructuralFeatureID(eFeature)) 225 { 226 case XMLTypePackage.ANY_TYPE__MIXED: 227 return mixed != null && !mixed.isEmpty(); 228 case XMLTypePackage.ANY_TYPE__ANY: 229 return !getAny().isEmpty(); 230 case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: 231 return anyAttribute != null && !anyAttribute.isEmpty(); 232 } 233 return eDynamicIsSet(eFeature); 234 } 235 236 241 public String toString() 242 { 243 if (eIsProxy()) return super.toString(); 244 245 StringBuffer result = new StringBuffer (super.toString()); 246 result.append(" (mixed: "); 247 result.append(mixed); 248 result.append(", anyAttribute: "); 249 result.append(anyAttribute); 250 result.append(')'); 251 return result.toString(); 252 } 253 254 } | Popular Tags |