1 7 package org.enhydra.dods.editor.Doml.impl; 8 9 import org.eclipse.emf.common.notify.Notification; 10 11 import org.eclipse.emf.ecore.EClass; 12 import org.eclipse.emf.ecore.EStructuralFeature; 13 14 import org.eclipse.emf.ecore.impl.ENotificationImpl; 15 import org.eclipse.emf.ecore.impl.EObjectImpl; 16 17 import org.enhydra.dods.editor.Doml.DomlPackage; 18 import org.enhydra.dods.editor.Doml.ReferenceObjectType; 19 import org.enhydra.dods.editor.Doml.TrueFalse; 20 21 35 public class ReferenceObjectTypeImpl extends EObjectImpl implements ReferenceObjectType { 36 44 protected static final TrueFalse CONSTRAINT_EDEFAULT = TrueFalse.FALSE_LITERAL; 45 46 54 protected TrueFalse constraint = CONSTRAINT_EDEFAULT; 55 56 63 protected boolean constraintESet = false; 64 65 73 protected static final String REFERENCE_EDEFAULT = null; 74 75 83 protected String reference = REFERENCE_EDEFAULT; 84 85 90 protected ReferenceObjectTypeImpl() { 91 super(); 92 } 93 94 99 protected EClass eStaticClass() { 100 return DomlPackage.eINSTANCE.getReferenceObjectType(); 101 } 102 103 108 public TrueFalse getConstraint() { 109 return constraint; 110 } 111 112 117 public void setConstraint(TrueFalse newConstraint) { 118 TrueFalse oldConstraint = constraint; 119 constraint = newConstraint == null ? CONSTRAINT_EDEFAULT : newConstraint; 120 boolean oldConstraintESet = constraintESet; 121 constraintESet = true; 122 if (eNotificationRequired()) 123 eNotify(new ENotificationImpl(this, Notification.SET, DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT, oldConstraint, constraint, !oldConstraintESet)); 124 } 125 126 131 public void unsetConstraint() { 132 TrueFalse oldConstraint = constraint; 133 boolean oldConstraintESet = constraintESet; 134 constraint = CONSTRAINT_EDEFAULT; 135 constraintESet = false; 136 if (eNotificationRequired()) 137 eNotify(new ENotificationImpl(this, Notification.UNSET, DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT, oldConstraint, CONSTRAINT_EDEFAULT, oldConstraintESet)); 138 } 139 140 145 public boolean isSetConstraint() { 146 return constraintESet; 147 } 148 149 154 public String getReference() { 155 return reference; 156 } 157 158 163 public void setReference(String newReference) { 164 String oldReference = reference; 165 reference = newReference; 166 if (eNotificationRequired()) 167 eNotify(new ENotificationImpl(this, Notification.SET, DomlPackage.REFERENCE_OBJECT_TYPE__REFERENCE, oldReference, reference)); 168 } 169 170 175 public Object eGet(EStructuralFeature eFeature, boolean resolve) { 176 switch (eDerivedStructuralFeatureID(eFeature)) { 177 case DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT: 178 return getConstraint(); 179 case DomlPackage.REFERENCE_OBJECT_TYPE__REFERENCE: 180 return getReference(); 181 } 182 return eDynamicGet(eFeature, resolve); 183 } 184 185 190 public void eSet(EStructuralFeature eFeature, Object newValue) { 191 switch (eDerivedStructuralFeatureID(eFeature)) { 192 case DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT: 193 setConstraint((TrueFalse)newValue); 194 return; 195 case DomlPackage.REFERENCE_OBJECT_TYPE__REFERENCE: 196 setReference((String )newValue); 197 return; 198 } 199 eDynamicSet(eFeature, newValue); 200 } 201 202 207 public void eUnset(EStructuralFeature eFeature) { 208 switch (eDerivedStructuralFeatureID(eFeature)) { 209 case DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT: 210 unsetConstraint(); 211 return; 212 case DomlPackage.REFERENCE_OBJECT_TYPE__REFERENCE: 213 setReference(REFERENCE_EDEFAULT); 214 return; 215 } 216 eDynamicUnset(eFeature); 217 } 218 219 224 public boolean eIsSet(EStructuralFeature eFeature) { 225 switch (eDerivedStructuralFeatureID(eFeature)) { 226 case DomlPackage.REFERENCE_OBJECT_TYPE__CONSTRAINT: 227 return isSetConstraint(); 228 case DomlPackage.REFERENCE_OBJECT_TYPE__REFERENCE: 229 return REFERENCE_EDEFAULT == null ? reference != null : !REFERENCE_EDEFAULT.equals(reference); 230 } 231 return eDynamicIsSet(eFeature); 232 } 233 234 239 public String toString() { 240 if (eIsProxy()) return super.toString(); 241 242 StringBuffer result = new StringBuffer (super.toString()); 243 result.append(" (constraint: "); 244 if (constraintESet) result.append(constraint); else result.append("<unset>"); 245 result.append(", reference: "); 246 result.append(reference); 247 result.append(')'); 248 return result.toString(); 249 } 250 251 } | Popular Tags |