@Override protected Vital doSet(int index, Vital element) { Vital removed = vitals.set(index, element); removed.removeListener(this); elementObserver.detachListener(removed); elementObserver.attachListener(element); removed.addListener(this); numericList.forEach((fx) -> addNumeric(fx)); return removed; }
@Override protected void doAdd(int index, Vital element) { element.addListener(this); elementObserver.attachListener(element); vitals.add(index, element); numericList.forEach((fx) -> addNumeric(fx)); }
@Override protected Vital doRemove(int index) { Vital v = vitals.remove(index); elementObserver.detachListener(v); v.removeListener(this); if (null != v) { v.destroy(); } return v; }
@Override public void clear() { if (elementObserver != null) { final int sz = size(); for (int i = 0; i < sz; ++i) { get(i).removeListener(this); elementObserver.detachListener(get(i)); } } if (hasListeners()) { beginChange(); nextRemove(0, this); } vitals.clear(); ++modCount; if (hasListeners()) { endChange(); } }