public SlideModel set(int location, SlideModel object) { SlideModel slide = mSlides.get(location); if (null != object) { int removeSize = 0; int addSize = object.getSlideSize(); if (null != slide) { removeSize = slide.getSlideSize(); } if (addSize > removeSize) { checkMessageSize(addSize - removeSize); increaseMessageSize(addSize - removeSize); } else { decreaseMessageSize(removeSize - addSize); } } slide = mSlides.set(location, object); if (slide != null) { slide.unregisterAllModelChangedObservers(); } if (object != null) { object.registerModelChangedObserver(this); for (IModelChangedObserver observer : mModelChangedObservers) { object.registerModelChangedObserver(observer); } } notifyModelChanged(true); return slide; }
public SlideModel remove(int location) { SlideModel slide = mSlides.remove(location); if (slide != null) { decreaseMessageSize(slide.getSlideSize()); slide.unregisterAllModelChangedObservers(); notifyModelChanged(true); } return slide; }
public boolean remove(Object object) { if ((object != null) && mSlides.remove(object)) { SlideModel slide = (SlideModel) object; decreaseMessageSize(slide.getSlideSize()); slide.unregisterAllModelChangedObservers(); notifyModelChanged(true); return true; } return false; }