public static class ResolvingFeatureEIterator<E> extends FeatureEIterator<E> { public ResolvingFeatureEIterator(EStructuralFeature eStructuralFeature, FeatureMap.Internal featureMap) { super(eStructuralFeature, featureMap); } @Override protected boolean resolve() { return true; } } /** * Temporary for testing purposes only. */ public static class FeatureMapEObjectImpl extends org.eclipse.emf.ecore.impl.EObjectImpl { protected BasicFeatureMap featureMap = new BasicFeatureMap(this, -1); public FeatureMapEObjectImpl() { super(); } @Override public Object eDynamicGet(EStructuralFeature eFeature, boolean resolve) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { return eSettingDelegate(eFeature).dynamicGet(this, null, -1, true, true); } else { return featureMap.setting(eFeature).get(resolve); } } @Override public void eDynamicSet(EStructuralFeature eFeature, Object newValue) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue); } else { if (!eFeature.isUnsettable()) { Object defaultValue = eFeature.getDefaultValue(); if (defaultValue == null ? newValue == null : defaultValue.equals(newValue)) { featureMap.setting(eFeature).unset(); return; } } featureMap.setting(eFeature).set(newValue); } } @Override public void eDynamicUnset(EStructuralFeature eFeature) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicUnset(this, null, -1); } else { featureMap.setting(eFeature).unset(); } } @Override public boolean eDynamicIsSet(EStructuralFeature eFeature) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { return eSettingDelegate(eFeature).dynamicIsSet(this, null, -1); } else { return featureMap.setting(eFeature).isSet(); } } @Override public NotificationChain eDynamicInverseAdd(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications) { EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID); if (feature.isMany()) { return featureMap.basicAdd(feature, otherEnd, notifications); } else if (feature instanceof EReference && ((EReference)feature).isContainer()) { return eSettingDelegate(feature).dynamicInverseAdd(this, null, -1, otherEnd, notifications); } else { InternalEObject oldValue = (InternalEObject)eDynamicGet(feature, false); if (oldValue != null) { notifications = oldValue.eInverseRemove (this, oldValue.eClass().getFeatureID(((EReference)feature).getEOpposite()), null, notifications); notifications = featureMap.basicRemove(feature, oldValue, notifications); } return featureMap.basicAdd(feature, otherEnd, notifications); } } @Override public NotificationChain eDynamicInverseRemove(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications) { EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID); if (feature instanceof EReference && ((EReference)feature).isContainer()) { return eSettingDelegate(feature).dynamicInverseRemove(this, null, -1, otherEnd, notifications); } else { return featureMap.basicRemove(feature, otherEnd, notifications); } } public FeatureMap featureMap() { return featureMap; } @Override public void eNotify(Notification notification) { if (notification.getFeatureID(null) != -1) { super.eNotify(notification); } } @Override public String toString() { String result = super.toString(); result = "org.eclipse.emf.ecore.impl.EObjectImpl" + result.substring(result.indexOf("@")); return result; } } @Override public void set(Object newValue) { super.set(newValue instanceof FeatureMap ? newValue : ((FeatureMap.Internal.Wrapper)newValue).featureMap());
public static class ResolvingFeatureEIterator<E> extends FeatureEIterator<E> { public ResolvingFeatureEIterator(EStructuralFeature eStructuralFeature, FeatureMap.Internal featureMap) { super(eStructuralFeature, featureMap); } @Override protected boolean resolve() { return true; } } /** * Temporary for testing purposes only. */ public static class FeatureMapEObjectImpl extends org.eclipse.emf.ecore.impl.EObjectImpl { protected DelegatingFeatureMap featureMap = new DelegatingFeatureMap(this, -1) { private static final long serialVersionUID = 1L; protected List<Entry> theList = new java.util.ArrayList<Entry>(); @Override protected List<Entry> delegateList() { return theList; } }; public FeatureMapEObjectImpl() { super(); } @Override public Object eDynamicGet(EStructuralFeature eFeature, boolean resolve) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { return eSettingDelegate(eFeature).dynamicGet(this, null, -1, true, true); } else { return featureMap.setting(eFeature).get(resolve); } } @Override public void eDynamicSet(EStructuralFeature eFeature, Object newValue) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue); } else { if (!eFeature.isUnsettable()) { Object defaultValue = eFeature.getDefaultValue(); if (defaultValue == null ? newValue == null : defaultValue.equals(newValue)) { featureMap.setting(eFeature).unset(); return; } } featureMap.setting(eFeature).set(newValue); } } @Override public void eDynamicUnset(EStructuralFeature eFeature) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicUnset(this, null, -1); } else { featureMap.setting(eFeature).unset(); } } @Override public boolean eDynamicIsSet(EStructuralFeature eFeature) { if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { return eSettingDelegate(eFeature).dynamicIsSet(this, null, -1); } else { return featureMap.setting(eFeature).isSet(); } } @Override public NotificationChain eDynamicInverseAdd(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications) { EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID); if (feature.isMany()) { return featureMap.basicAdd(feature, otherEnd, notifications); } else if (feature instanceof EReference && ((EReference)feature).isContainer()) { return eSettingDelegate(feature).dynamicInverseAdd(this, null, -1, otherEnd, notifications); } else { InternalEObject oldValue = (InternalEObject)eDynamicGet(feature, false); if (oldValue != null) { notifications = oldValue.eInverseRemove (this, oldValue.eClass().getFeatureID(((EReference)feature).getEOpposite()), null, notifications); notifications = featureMap.basicRemove(feature, oldValue, notifications); } return featureMap.basicAdd(feature, otherEnd, notifications); } } @Override public NotificationChain eDynamicInverseRemove(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications) { EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID); if (feature instanceof EReference && ((EReference)feature).isContainer()) { return eSettingDelegate(feature).dynamicInverseRemove(this, null, -1, otherEnd, notifications); } else { return featureMap.basicRemove(feature, otherEnd, notifications); } } public FeatureMap featureMap() { return featureMap; } @Override public void eNotify(Notification notification) { if (notification.getFeatureID(null) != -1) { super.eNotify(notification); } } @Override public String toString() { String result = super.toString(); result = "org.eclipse.emf.ecore.impl.EObjectImpl" + result.substring(result.indexOf("@")); return result; } } @Override public void set(Object newValue) { super.set(newValue instanceof FeatureMap ? newValue : ((FeatureMap.Internal.Wrapper)newValue).featureMap());
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public static class ResolvingFeatureEIterator<E> extends FeatureEIterator<E>
1
public static class ResolvingFeatureEIterator<E> extends FeatureEIterator<E>
2
  {
2
  {
3
    public ResolvingFeatureEIterator(EStructuralFeature eStructuralFeature, FeatureMap.Internal featureMap)
3
    public ResolvingFeatureEIterator(EStructuralFeature eStructuralFeature, FeatureMap.Internal featureMap)
4
    {
4
    {
5
      super(eStructuralFeature, featureMap);
5
      super(eStructuralFeature, featureMap);
6
    }
6
    }
7
    @Override
7
    @Override
8
    protected boolean resolve()
8
    protected boolean resolve()
9
    {
9
    {
10
      return true;
10
      return true;
11
    }
11
    }
12
  }
12
  }
13
  /**
13
  /**
14
   * Temporary for testing purposes only.
14
   * Temporary for testing purposes only.
15
   */
15
   */
16
  public static class FeatureMapEObjectImpl extends org.eclipse.emf.ecore.impl.EObjectImpl
16
  public static class FeatureMapEObjectImpl extends org.eclipse.emf.ecore.impl.EObjectImpl
17
  {
17
  {
18
    protected BasicFeatureMap featureMap = new BasicFeatureMap(this, -1);
18
    protected DelegatingFeatureMap featureMap = 
19
      new DelegatingFeatureMap(this, -1)
20
      {
21
        private static final long serialVersionUID = 1L;
22
        protected List<Entry> theList = new java.util.ArrayList<Entry>();
23
        @Override
24
        protected List<Entry> delegateList()
25
        {
26
          return theList;
27
        }
28
      };
19
    public FeatureMapEObjectImpl()
29
    public FeatureMapEObjectImpl()
20
    {
30
    {
21
      super();
31
      super();
22
    }
32
    }
23
    @Override
33
    @Override
24
    public Object eDynamicGet(EStructuralFeature eFeature, boolean resolve)
34
    public Object eDynamicGet(EStructuralFeature eFeature, boolean resolve)
25
    {
35
    {
26
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
36
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
27
      {
37
      {
28
        return eSettingDelegate(eFeature).dynamicGet(this, null, -1, true, true);
38
        return eSettingDelegate(eFeature).dynamicGet(this, null, -1, true, true);
29
      }
39
      }
30
      else
40
      else
31
      {
41
      {
32
        return featureMap.setting(eFeature).get(resolve);
42
        return featureMap.setting(eFeature).get(resolve);
33
      }
43
      }
34
    }
44
    }
35
    @Override
45
    @Override
36
    public void eDynamicSet(EStructuralFeature eFeature, Object newValue)
46
    public void eDynamicSet(EStructuralFeature eFeature, Object newValue)
37
    {
47
    {
38
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
48
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
39
      {
49
      {
40
        eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);
50
        eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);
41
      }
51
      }
42
      else
52
      else
43
      {
53
      {
44
        if (!eFeature.isUnsettable())
54
        if (!eFeature.isUnsettable())
45
        {
55
        {
46
          Object defaultValue = eFeature.getDefaultValue();
56
          Object defaultValue = eFeature.getDefaultValue();
47
          if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))
57
          if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))
48
          {
58
          {
49
            featureMap.setting(eFeature).unset();
59
            featureMap.setting(eFeature).unset();
50
            return;
60
            return;
51
          }
61
          }
52
        }
62
        }
53
        featureMap.setting(eFeature).set(newValue);
63
        featureMap.setting(eFeature).set(newValue);
54
      }
64
      }
55
    }
65
    }
56
    @Override
66
    @Override
57
    public void eDynamicUnset(EStructuralFeature eFeature)
67
    public void eDynamicUnset(EStructuralFeature eFeature)
58
    {
68
    {
59
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
69
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
60
      {
70
      {
61
        eSettingDelegate(eFeature).dynamicUnset(this, null, -1);
71
        eSettingDelegate(eFeature).dynamicUnset(this, null, -1);
62
      }
72
      }
63
      else
73
      else
64
      {
74
      {
65
        featureMap.setting(eFeature).unset();
75
        featureMap.setting(eFeature).unset();
66
      }
76
      }
67
    }
77
    }
68
    @Override
78
    @Override
69
    public boolean eDynamicIsSet(EStructuralFeature eFeature)
79
    public boolean eDynamicIsSet(EStructuralFeature eFeature)
70
    {
80
    {
71
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
81
      if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())
72
      {
82
      {
73
        return eSettingDelegate(eFeature).dynamicIsSet(this, null, -1);
83
        return eSettingDelegate(eFeature).dynamicIsSet(this, null, -1);
74
      }
84
      }
75
      else
85
      else
76
      {
86
      {
77
        return featureMap.setting(eFeature).isSet();
87
        return featureMap.setting(eFeature).isSet();
78
      }
88
      }
79
    }
89
    }
80
    @Override
90
    @Override
81
    public NotificationChain eDynamicInverseAdd(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications)
91
    public NotificationChain eDynamicInverseAdd(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications)
82
    {
92
    {
83
      EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID);
93
      EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID);
84
      if (feature.isMany())
94
      if (feature.isMany())
85
      {
95
      {
86
        return featureMap.basicAdd(feature, otherEnd, notifications);
96
        return featureMap.basicAdd(feature, otherEnd, notifications);
87
      }
97
      }
88
      else if (feature instanceof EReference && ((EReference)feature).isContainer())
98
      else if (feature instanceof EReference && ((EReference)feature).isContainer())
89
      {
99
      {
90
        return eSettingDelegate(feature).dynamicInverseAdd(this, null, -1, otherEnd, notifications);
100
        return eSettingDelegate(feature).dynamicInverseAdd(this, null, -1, otherEnd, notifications);
91
      }
101
      }
92
      else
102
      else
93
      {
103
      {
94
        InternalEObject oldValue = (InternalEObject)eDynamicGet(feature, false);
104
        InternalEObject oldValue = (InternalEObject)eDynamicGet(feature, false);
95
        if (oldValue != null)
105
        if (oldValue != null)
96
        {
106
        {
97
          notifications = oldValue.eInverseRemove
107
          notifications = oldValue.eInverseRemove
98
            (this, oldValue.eClass().getFeatureID(((EReference)feature).getEOpposite()), null, notifications);
108
            (this, oldValue.eClass().getFeatureID(((EReference)feature).getEOpposite()), null, notifications);
99
          notifications = featureMap.basicRemove(feature, oldValue, notifications);
109
          notifications = featureMap.basicRemove(feature, oldValue, notifications);
100
        }
110
        }
101
        return featureMap.basicAdd(feature, otherEnd, notifications);
111
        return featureMap.basicAdd(feature, otherEnd, notifications);
102
      }
112
      }
103
    }
113
    }
104
    @Override
114
    @Override
105
    public NotificationChain eDynamicInverseRemove(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications)
115
    public NotificationChain eDynamicInverseRemove(InternalEObject otherEnd, int featureID, Class<?> inverseClass, NotificationChain notifications)
106
    {
116
    {
107
      EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID);
117
      EStructuralFeature.Internal feature = (EStructuralFeature.Internal)eClass().getEStructuralFeature(featureID);
108
      if (feature instanceof EReference && ((EReference)feature).isContainer())
118
      if (feature instanceof EReference && ((EReference)feature).isContainer())
109
      {
119
      {
110
        return eSettingDelegate(feature).dynamicInverseRemove(this, null, -1, otherEnd, notifications);
120
        return eSettingDelegate(feature).dynamicInverseRemove(this, null, -1, otherEnd, notifications);
111
      }
121
      }
112
      else
122
      else
113
      {
123
      {
114
        return featureMap.basicRemove(feature, otherEnd, notifications);
124
        return featureMap.basicRemove(feature, otherEnd, notifications);
115
      }
125
      }
116
    }
126
    }
117
    public FeatureMap featureMap()
127
    public FeatureMap featureMap()
118
    {
128
    {
119
      return featureMap;
129
      return featureMap;
120
    }
130
    }
121
    @Override
131
    @Override
122
    public void eNotify(Notification notification)
132
    public void eNotify(Notification notification)
123
    {
133
    {
124
      if (notification.getFeatureID(null) != -1)
134
      if (notification.getFeatureID(null) != -1)
125
      {
135
      {
126
        super.eNotify(notification);
136
        super.eNotify(notification);
127
      }
137
      }
128
    }
138
    }
129
    @Override
139
    @Override
130
    public String toString()
140
    public String toString()
131
    {
141
    {
132
      String result = super.toString();
142
      String result = super.toString();
133
      result = "org.eclipse.emf.ecore.impl.EObjectImpl" + result.substring(result.indexOf("@"));
143
      result = "org.eclipse.emf.ecore.impl.EObjectImpl" + result.substring(result.indexOf("@"));
134
      return result;
144
      return result;
135
    }
145
    }
136
  }
146
  }
137
  @Override
147
    @Override
138
  public void set(Object newValue)
148
   public void set(Object newValue)
139
  {
149
   {
140
    super.set(newValue instanceof FeatureMap ? newValue : ((FeatureMap.Internal.Wrapper)newValue).featureMap());
150
     super.set(newValue instanceof FeatureMap ? newValue : ((FeatureMap.Internal.Wrapper)newValue).featureMap());
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0