Program: 11808
Project: 11808
Buggy source:
/** 
 * Updates any cached children based on the given notification. If a   {@link ChildrenStore} exists for its notifier,then the children of the specified feature are updated. <p>Existing children in the store that correspond to any set, removed or unset values are  {@link #disposeWrapper disposed} before being removed from the store. When children are added to, removed from, or movedwithin a feature, the indices of any others affected are  {@link #adjustWrapperIndex adjusted}. Since this method is typically called from   {@link #notifyChanged notifyChanged}, which, in subclasses, is often invoked repeatedly up the inheritance chain, it can be safely called repeatedly for a single notification, and only the first such call will have an effect. Such repeated calls may not, however, safely be interleaved with calls for another notification.
 */
protected void updateChildren(Notification notification){
  EObject object=(EObject)notification.getNotifier();
  ChildrenStore childrenStore=getChildrenStore(object);
  if (childrenStore != null) {
    EStructuralFeature feature=(EStructuralFeature)notification.getFeature();
    EList<Object> children=childrenStore.getList(feature);
    if (children != null) {
      int index=notification.getPosition();
switch (notification.getEventType()) {
case Notification.UNSET:
{
          if (feature.isMany()) {
            break;
          }
        }
case Notification.SET:
{
        Object oldChild=childrenStore.get(feature,index);
        Object newValue=notification.getNewValue();
        if (unwrap(oldChild) != newValue) {
          if (feature.isMany() && index == Notification.NO_INDEX) {
            disposeWrappers((List<?>)oldChild);
          }
 else {
            disposeWrapper(oldChild);
          }
          Object newChild=newValue == null && index == Notification.NO_INDEX ? null : wrap(object,feature,newValue,index);
          childrenStore.set(feature,index,newChild);
        }
        break;
      }
case Notification.ADD:
{
      EList<?> values=(EList<?>)object.eGet(feature);
      if (children.size() != values.size()) {
        Object newValue=notification.getNewValue();
        adjustWrapperIndices(children,index,1);
        children.add(index,wrap(object,feature,newValue,index));
      }
      break;
    }
case Notification.REMOVE:
{
    EList<?> values=(EList<?>)object.eGet(feature);
    if (children.size() != values.size()) {
      disposeWrapper(children.remove(index));
      adjustWrapperIndices(children,index,-1);
    }
    break;
  }
case Notification.ADD_MANY:
{
  EList<?> values=(EList<?>)object.eGet(feature);
  if (children.size() != values.size()) {
    if (notification.getOldValue() != null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    List<?> newValues=(List<?>)notification.getNewValue();
    List<Object> newChildren=new ArrayList<Object>(newValues.size());
    int offset=0;
    for (    Object newValue : newValues) {
      newChildren.add(wrap(object,feature,newValue,index + offset++));
    }
    adjustWrapperIndices(children,index,offset);
    children.addAll(index,newChildren);
  }
  break;
}
case Notification.REMOVE_MANY:
{
if (index == Notification.NO_INDEX) index=0;
EList<?> values=(EList<?>)object.eGet(feature);
if (children.size() != values.size()) {
  if (notification.getNewValue() instanceof int[]) {
    int[] indices=(int[])notification.getNewValue();
    for (int i=indices.length - 1; i >= 0; i--) {
      disposeWrapper(children.remove(indices[i]));
      adjustWrapperIndices(children,indices[i],-1);
    }
  }
 else {
    int len=((List<?>)notification.getOldValue()).size();
    List<?> sl=children.subList(index,index + len);
    disposeWrappers(sl);
    sl.clear();
    adjustWrapperIndices(children,index,-len);
  }
}
break;
}
case Notification.MOVE:
{
int oldIndex=((Integer)notification.getOldValue()).intValue();
EList<?> values=(EList<?>)object.eGet(feature);
boolean didMove=true;
for (int i=Math.min(oldIndex,index), end=Math.max(oldIndex,index); didMove && i <= end; i++) {
didMove=unwrap(children.get(i)) == values.get(i);
}
if (!didMove) {
int delta=index - oldIndex;
if (delta < 0) {
  adjustWrapperIndices(children,index,oldIndex,1);
}
children.move(index,oldIndex);
adjustWrapperIndex(children.get(index),delta);
if (delta > 0) {
  adjustWrapperIndices(children,oldIndex,index,-1);
}
}
break;
}
}
}
}
}

Fixed version (ground truth):
/** 
 * Updates any cached children based on the given notification. If a   {@link ChildrenStore} exists for its notifier,then the children of the specified feature are updated. <p>Existing children in the store that correspond to any set, removed or unset values are  {@link #disposeWrapper disposed} before being removed from the store. When children are added to, removed from, or movedwithin a feature, the indices of any others affected are  {@link #adjustWrapperIndex adjusted}. Since this method is typically called from   {@link #notifyChanged(Notification) notifyChanged}, which, in subclasses, is often invoked repeatedly up the inheritance chain, it can be safely called repeatedly for a single notification, and only the first such call will have an effect. Such repeated calls may not, however, safely be interleaved with calls for another notification.
 */
protected void updateChildren(Notification notification){
  EObject object=(EObject)notification.getNotifier();
  ChildrenStore childrenStore=getChildrenStore(object);
  if (childrenStore != null) {
    EStructuralFeature feature=(EStructuralFeature)notification.getFeature();
    EList<Object> children=childrenStore.getList(feature);
    if (children != null) {
      int index=notification.getPosition();
switch (notification.getEventType()) {
case Notification.UNSET:
{
          if (feature.isMany()) {
            break;
          }
        }
case Notification.SET:
{
        Object oldChild=childrenStore.get(feature,index);
        Object newValue=notification.getNewValue();
        if (unwrap(oldChild) != newValue) {
          if (feature.isMany() && index == Notification.NO_INDEX) {
            disposeWrappers((List<?>)oldChild);
          }
 else {
            disposeWrapper(oldChild);
          }
          Object newChild=newValue == null && index == Notification.NO_INDEX ? null : wrap(object,feature,newValue,index);
          childrenStore.set(feature,index,newChild);
        }
        break;
      }
case Notification.ADD:
{
      EList<?> values=(EList<?>)object.eGet(feature);
      if (children.size() != values.size()) {
        Object newValue=notification.getNewValue();
        adjustWrapperIndices(children,index,1);
        children.add(index,wrap(object,feature,newValue,index));
      }
      break;
    }
case Notification.REMOVE:
{
    EList<?> values=(EList<?>)object.eGet(feature);
    if (children.size() != values.size()) {
      disposeWrapper(children.remove(index));
      adjustWrapperIndices(children,index,-1);
    }
    break;
  }
case Notification.ADD_MANY:
{
  EList<?> values=(EList<?>)object.eGet(feature);
  if (children.size() != values.size()) {
    if (notification.getOldValue() != null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    List<?> newValues=(List<?>)notification.getNewValue();
    List<Object> newChildren=new ArrayList<Object>(newValues.size());
    int offset=0;
    for (    Object newValue : newValues) {
      newChildren.add(wrap(object,feature,newValue,index + offset++));
    }
    adjustWrapperIndices(children,index,offset);
    children.addAll(index,newChildren);
  }
  break;
}
case Notification.REMOVE_MANY:
{
if (index == Notification.NO_INDEX) index=0;
EList<?> values=(EList<?>)object.eGet(feature);
if (children.size() != values.size()) {
  if (notification.getNewValue() instanceof int[]) {
    int[] indices=(int[])notification.getNewValue();
    for (int i=indices.length - 1; i >= 0; i--) {
      disposeWrapper(children.remove(indices[i]));
      adjustWrapperIndices(children,indices[i],-1);
    }
  }
 else {
    int len=((List<?>)notification.getOldValue()).size();
    List<?> sl=children.subList(index,index + len);
    disposeWrappers(sl);
    sl.clear();
    adjustWrapperIndices(children,index,-len);
  }
}
break;
}
case Notification.MOVE:
{
int oldIndex=((Integer)notification.getOldValue()).intValue();
EList<?> values=(EList<?>)object.eGet(feature);
boolean didMove=true;
for (int i=Math.min(oldIndex,index), end=Math.max(oldIndex,index); didMove && i <= end; i++) {
didMove=unwrap(children.get(i)) == values.get(i);
}
if (!didMove) {
int delta=index - oldIndex;
if (delta < 0) {
  adjustWrapperIndices(children,index,oldIndex,1);
}
children.move(index,oldIndex);
adjustWrapperIndex(children.get(index),delta);
if (delta > 0) {
  adjustWrapperIndices(children,oldIndex,index,-1);
}
}
break;
}
}
}
}
}