/** * Gets all the chunks in this element. * * @return an <CODE>ArrayList</CODE> */ public ArrayList getChunks() { ArrayList tmp = new ArrayList(); Chunk chunk; Iterator i = iterator(); boolean localDestination = (reference != null && reference.startsWith("#")); boolean notGotoOK = true; while (i.hasNext()) { chunk = (Chunk) i.next(); if (name != null && notGotoOK && !chunk.isEmpty()) { chunk.setLocalDestination(name); notGotoOK = false; } if (localDestination) { chunk.setLocalGoto(reference.substring(1)); } else if (reference != null) chunk.setAnchor(reference); tmp.add(chunk); } return tmp; }
/** * Processes the element by adding it (or the different parts) to an <CODE>ElementListener</CODE>. * * @param listener an <CODE>ElementListener</CODE> * @return <CODE>true</CODE> if the element was processed successfully */ public boolean process(ElementListener listener) { try { Chunk chunk; Iterator i = getChunks().iterator(); boolean localDestination = (reference != null && reference.startsWith("#")); boolean notGotoOK = true; while (i.hasNext()) { chunk = (Chunk) i.next(); if (name != null && notGotoOK && !chunk.isEmpty()) { chunk.setLocalDestination(name); notGotoOK = false; } if (localDestination) { chunk.setLocalGoto(reference.substring(1)); } listener.add(chunk); } return true; } catch (DocumentException de) { return false; } }