} catch (IOException e) { LOG.error("io-error while updating index for element " + elementName);
	public void remove() {		if (elementIds.size() == 0)			return;		Lock lock = dbElement.getLock();		Map.Entry entry;		String elementName;		List newList = new ArrayList(), idList;		NodeProxy p;		VariableByteOutputStream os;		VariableByteInputStream is;		int len, docId;		byte[] data;		Value ref;		Value val;		short sym;		short collectionId = doc.getCollection().getId();		long delta, last, gid, address;		int page, tid;		try {			// iterate through elements			for (Iterator i = elementIds.entrySet().iterator(); i.hasNext();) {				entry = (Map.Entry) i.next();				idList = (ArrayList) entry.getValue();				elementName = (String) entry.getKey();				sym = NativeBroker.getSymbols().getSymbol(elementName);				ref = new NativeBroker.ElementValue(collectionId, sym);				// try to retrieve old index entry for the element				try {					lock.acquire(this, Lock.READ_LOCK);					lock.enter(this);					val = dbElement.get(ref);				} catch (LockException e) {					LOG.error("could not acquire lock for index on " + elementName);					return;				} finally {					lock.release(this);				}				os = new VariableByteOutputStream();				newList.clear();				if (val != null) {					// add old entries to the new list 					data = val.getData();					is = new VariableByteInputStream(data);					try {						while (is.available() > 0) {							docId = is.readInt();							len = is.readInt();							if (docId != doc.getDocId()) {								// section belongs to another document:								// copy data to new buffer								os.writeInt(docId);								os.writeInt(len);								for (int j = 0; j < len * 3; j++) {									is.copyTo(os);//									delta = is.readLong();//									page = is.readInt();//									tid = is.readInt();//									os.writeLong(delta);//									os.writeInt(page);//									os.writeInt(tid);								}							} else {								// copy nodes to new list								last = 0;								for (int j = 0; j < len; j++) {									delta = is.readLong();									gid = last + delta;									last = gid;									page = is.readInt();									tid = is.readInt();									if(!containsNode(idList, gid)) {										address = DOMFile.createPointer(page, tid);										newList.add(new NodeProxy(doc, gid, address));									}								}							}						}					} catch (EOFException e) {						LOG.error("end-of-file while updating index for element " + elementName);					}				}				// write out the updated list				FastQSort.sort(newList, 0, newList.size() - 1);				len = newList.size();				os.writeInt(doc.getDocId());				os.writeInt(len);				last = 0;				for (int j = 0; j < len; j++) {					p = (NodeProxy) newList.get(j);					delta = p.gid - last;					last = p.gid;					os.writeLong(delta);					address = p.internalAddress;					os.writeInt(DOMFile.pageFromPointer(address));					os.writeInt(DOMFile.tidFromPointer(address));				}				data = os.toByteArray();				try {					lock.acquire(this, Lock.WRITE_LOCK);					lock.enter(this);					if (val == null)						dbElement.put(ref, data);					else						dbElement.update(val.getAddress(), ref, data);				} catch (LockException e) {					LOG.error("could not acquire lock on elements", e);				} finally {					lock.release(this);				}			}		} catch (ReadOnlyException e) {			LOG.warn("database is read only");		}		elementIds.clear();	}