1 17 package org.eclipse.emf.ecore.impl; 18 19 20 import org.eclipse.emf.common.util.BasicEList; 21 import org.eclipse.emf.common.util.EList; 22 import org.eclipse.emf.common.util.URI; 23 import org.eclipse.emf.ecore.EClass; 24 import org.eclipse.emf.ecore.EObject; 25 import org.eclipse.emf.ecore.EcorePackage; 26 import org.eclipse.emf.ecore.InternalEObject; 27 28 29 38 public class EObjectImpl extends BasicEObjectImpl implements EObject 39 { 40 43 protected static final int EDELIVER = 0x0001; 44 45 48 protected static final int EDYNAMIC_CLASS = 0x0002; 49 50 53 protected static final int EPROXY = 0x004; 54 55 58 protected static final int ELAST_NOTIFIER_FLAG = EPROXY; 59 60 63 public static final int ELAST_EOBJECT_FLAG = ELAST_NOTIFIER_FLAG; 64 65 70 protected int eFlags = EDELIVER; 71 72 75 protected BasicEList eAdapters; 76 77 80 protected InternalEObject eContainer; 81 82 86 protected int eContainerFeatureID; 87 88 91 protected EPropertiesHolder eProperties; 92 93 99 protected EObjectImpl() 100 { 101 super(); 102 } 103 104 109 protected EClass eStaticClass() 110 { 111 return EcorePackage.eINSTANCE.getEObject(); 112 } 113 114 117 public EList eAdapters() 118 { 119 if (eAdapters == null) 120 { 121 eAdapters = new EAdapterList(this); 122 } 123 return eAdapters; 124 } 125 126 protected BasicEList eBasicAdapters() 127 { 128 return eAdapters; 129 } 130 131 134 public boolean eDeliver() 135 { 136 return (eFlags & EDELIVER) != 0; 137 } 138 139 142 public void eSetDeliver(boolean deliver) 143 { 144 if (deliver) 145 { 146 eFlags |= EDELIVER; 147 } 148 else 149 { 150 eFlags &= ~EDELIVER; 151 } 152 } 153 154 157 public boolean eIsProxy() 158 { 159 return (eFlags & EPROXY) != 0; 160 } 161 162 165 public void eSetProxyURI(URI uri) 166 { 167 super.eSetProxyURI(uri); 168 if (uri != null) 169 { 170 eFlags |= EPROXY; 171 } 172 else 173 { 174 eFlags &= ~EPROXY; 175 } 176 } 177 178 protected EPropertiesHolder eProperties() 179 { 180 if (eProperties == null) 181 { 182 eProperties = new EPropertiesHolderImpl(); 183 } 184 return eProperties; 185 } 186 187 protected EPropertiesHolder eBasicProperties() 188 { 189 return eProperties; 190 } 191 192 protected InternalEObject eInternalContainer() 193 { 194 return eContainer; 195 } 196 197 public int eContainerFeatureID() 198 { 199 return eContainerFeatureID; 200 } 201 202 protected void eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID) 203 { 204 eContainer = newContainer; 205 eContainerFeatureID = newContainerFeatureID; 206 } 207 208 public EClass eClass() 209 { 210 return (eFlags & EDYNAMIC_CLASS) == 0 ? eStaticClass() : eProperties().getEClass(); 211 } 212 213 public void eSetClass(EClass eClass) 214 { 215 super.eSetClass(eClass); 216 if (eClass != null) 217 { 218 eFlags |= EDYNAMIC_CLASS; 219 } 220 else 221 { 222 eFlags &= ~EDYNAMIC_CLASS; 223 } 224 } 225 } 226 | Popular Tags |