コード例 #1
0
  @Override
  public E remove(int index) {
    Property property = new Property(this, String.valueOf(index));

    E oldContent = get(index);

    internal.remove(index);

    if (oldContent instanceof IObject) {
      ((IObject) oldContent).getParentsLinksToThis().remove(property);
    }

    for (; index < size(); index++) {
      E content = get(index);
      if (content instanceof IObject) {
        Property oldProperty = new Property(this, String.valueOf(index + 1));
        Property newProperty = new Property(this, String.valueOf(index));
        int linkIndex = ((IObject) content).getParentsLinksToThis().indexOf(oldProperty);
        ((IObject) content).getParentsLinksToThis().set(linkIndex, newProperty);
      }
    }

    if (propagate) propagateChange(new Property(this, ""));

    return oldContent;
  }