/** {@inheritDoc} */ public ElementType remove(int index) { ElementType element = elements.remove(index); if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } modCount++; return element; }
/** {@inheritDoc} */ public ElementType remove(int index) { ElementType element = elements.remove(index); if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } modCount++; return element; }
/** * Removes the element from the list. * * @param element the element to be removed * * @return true if the element was in the list and removed, false if not */ public boolean remove(ElementType element) { boolean elementRemoved = false; elementRemoved = elements.remove(element); if (elementRemoved) { if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } } return elementRemoved; }
/** * Removes the element from the list. * * @param element the element to be removed * * @return true if the element was in the list and removed, false if not */ public boolean remove(ElementType element) { boolean elementRemoved = false; elementRemoved = elements.remove(element); if (elementRemoved) { if (element != null) { element.releaseParentDOM(true); element.setParent(null); parent.getIDIndex().deregisterIDMappings(element.getIDIndex()); } } return elementRemoved; }
/** * Deregister multiple ID-to-XMLObject mappings for this object's owner's children. * * @param idIndex the ID-to-XMLObject mappings to deregister */ public void deregisterIDMappings(IDIndex idIndex) { if (idIndex == null || idIndex.isEmpty()) { return; } for (String id : idIndex.getIDs()) { idMappings.remove(id); } if (owner.hasParent()) { owner.getParent().getIDIndex().deregisterIDMappings(idIndex); } }
/** * Deregister multiple ID-to-XMLObject mappings for this object's owner's children. * * @param idIndex the ID-to-XMLObject mappings to deregister */ public void deregisterIDMappings(IDIndex idIndex) { if (idIndex == null || idIndex.isEmpty()) { return; } for (String id : idIndex.getIDs()) { idMappings.remove(id); } if (owner.hasParent()) { owner.getParent().getIDIndex().deregisterIDMappings(idIndex); } }
oldValue.setParent(null); releaseThisandParentDOM(); idIndex.deregisterIDMappings(oldValue.getIDIndex()); if (newValue != null) { newValue.setParent(this);
/** * Replaces the XMLObject at the specified index with the given element. * * @param index index of the XMLObject to be replaced * @param element element to be stored at the given index * * @return the replaced XMLObject * * @throws IllegalArgumentException thrown if the given XMLObject already has a parent that is different from the * XMLObject given at list construction time */ public ElementType set(int index, ElementType element) throws IllegalArgumentException { if (element == null) { return null; } setParent(element); ElementType removedElement = elements.set(index, element); if (removedElement != null) { removedElement.setParent(null); parent.getIDIndex().deregisterIDMappings(removedElement.getIDIndex()); } // Note: to avoid ordering problems, this needs to be called after // the deregistration, in case the added element has a same ID string // value as the removed one, else you will lose it. parent.getIDIndex().registerIDMappings(element.getIDIndex()); modCount++; return removedElement; }
/** * Replaces the XMLObject at the specified index with the given element. * * @param index index of the XMLObject to be replaced * @param element element to be stored at the given index * * @return the replaced XMLObject * * @throws IllegalArgumentException thrown if the given XMLObject already has a parent that is different from the * XMLObject given at list construction time */ public ElementType set(int index, ElementType element) throws IllegalArgumentException { if (element == null) { return null; } setParent(element); ElementType removedElement = elements.set(index, element); if (removedElement != null) { removedElement.setParent(null); parent.getIDIndex().deregisterIDMappings(removedElement.getIDIndex()); } // Note: to avoid ordering problems, this needs to be called after // the deregistration, in case the added element has a same ID string // value as the removed one, else you will lose it. parent.getIDIndex().registerIDMappings(element.getIDIndex()); modCount++; return removedElement; }
oldValue.setParent(null); releaseThisandParentDOM(); idIndex.deregisterIDMappings(oldValue.getIDIndex()); if (newValue != null) { newValue.setParent(this);