1 17 package org.eclipse.emf.ecore.util; 18 19 20 import org.eclipse.emf.common.notify.Notification; 21 import org.eclipse.emf.ecore.InternalEObject; 22 23 24 public class EObjectWithInverseEList extends EObjectEList 25 { 26 public static class Unsettable extends EObjectWithInverseEList 27 { 28 public static class ManyInverse extends Unsettable 29 { 30 public ManyInverse(Class dataClass, InternalEObject owner, int featureID, int inverseFeatureID) 31 { 32 super(dataClass, owner, featureID, inverseFeatureID); 33 } 34 35 protected boolean hasManyInverse() 36 { 37 return true; 38 } 39 } 40 41 protected boolean isSet; 42 43 public Unsettable(Class dataClass, InternalEObject owner, int featureID, int inverseFeatureID) 44 { 45 super(dataClass, owner, featureID, inverseFeatureID); 46 } 47 48 protected void didChange() 49 { 50 isSet = true; 51 } 52 53 public boolean isSet() 54 { 55 return isSet; 56 } 57 58 public void unset() 59 { 60 super.unset(); 61 if (isNotificationRequired()) 62 { 63 boolean oldIsSet = isSet; 64 isSet = false; 65 owner.eNotify(createNotification(Notification.UNSET, oldIsSet, false)); 66 } 67 else 68 { 69 isSet = false; 70 } 71 } 72 } 73 74 public static class ManyInverse extends EObjectWithInverseEList 75 { 76 public ManyInverse(Class dataClass, InternalEObject owner, int featureID, int inverseFeatureID) 77 { 78 super(dataClass, owner, featureID, inverseFeatureID); 79 } 80 81 protected boolean hasManyInverse() 82 { 83 return true; 84 } 85 } 86 87 protected final int inverseFeatureID; 88 89 public EObjectWithInverseEList 90 (Class dataClass, InternalEObject owner, int featureID, int inverseFeatureID) 91 { 92 super(dataClass, owner, featureID); 93 this.inverseFeatureID = inverseFeatureID; 94 } 95 96 protected boolean hasInverse() 97 { 98 return true; 99 } 100 101 protected boolean hasNavigableInverse() 102 { 103 return true; 104 } 105 106 public int getInverseFeatureID() 107 { 108 return inverseFeatureID; 109 } 110 111 public Class getInverseFeatureClass() 112 { 113 return dataClass; 114 } 115 } 116 | Popular Tags |