class ElementStack extends java.lang.Object implements ElementPath
ElementStack is used internally inside the SAXContentHandler to maintain a stack of Elementinstances. It opens
an integration possibility allowing derivations to prune the tree when a node
is complete.
| Modifier and Type | Field and Description |
|---|---|
private DispatchHandler |
handler |
protected int |
lastElementIndex
index of the item at the top of the stack or -1 if the stack is empty
|
protected Element[] |
stack
stack of
Element objects |
| Constructor and Description |
|---|
ElementStack() |
ElementStack(int defaultCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(java.lang.String path,
ElementHandler elementHandler)
Adds the
ElementHandler to be called when the specified
path is encounted. |
void |
clear()
Peeks at the top element on the stack without changing the contents of
the stack.
|
boolean |
containsHandler(java.lang.String path)
DOCUMENT ME!
|
Element |
getCurrent()
DOCUMENT ME!
|
DispatchHandler |
getDispatchHandler() |
Element |
getElement(int depth)
DOCUMENT ME!
|
private java.lang.String |
getHandlerPath(java.lang.String path) |
java.lang.String |
getPath()
DOCUMENT ME!
|
Element |
peekElement()
Peeks at the top element on the stack without changing the contents of
the stack.
|
Element |
popElement()
Pops the element off the stack
|
void |
pushElement(Element element)
Pushes a new element onto the stack
|
protected void |
reallocate(int size)
Reallocates the stack to the given size
|
void |
removeHandler(java.lang.String path)
Removes the
ElementHandler from the event based processor,
for the specified path. |
void |
setDispatchHandler(DispatchHandler dispatchHandler) |
int |
size()
DOCUMENT ME!
|
protected Element[] stack
Element objectsprotected int lastElementIndex
private DispatchHandler handler
public ElementStack()
public ElementStack(int defaultCapacity)
public void setDispatchHandler(DispatchHandler dispatchHandler)
public DispatchHandler getDispatchHandler()
public void clear()
public Element peekElement()
public Element popElement()
public void pushElement(Element element)
element - DOCUMENT ME!protected void reallocate(int size)
size - DOCUMENT ME!public int size()
ElementPathsize in interface ElementPathpublic Element getElement(int depth)
ElementPathgetElement in interface ElementPathdepth - DOCUMENT ME!public java.lang.String getPath()
ElementPathgetPath in interface ElementPathpublic Element getCurrent()
ElementPathgetCurrent in interface ElementPathpublic void addHandler(java.lang.String path,
ElementHandler elementHandler)
ElementPathElementHandler to be called when the specified
path is encounted. The path can be either an absolute path (i.e. prefixed
with "/") or a relative path (i.e. assummed to be a child of the current
path as retrieved by getPath .addHandler in interface ElementPathpath - is the path to be handledelementHandler - is the ElementHandler to be called by the event
based processor.public void removeHandler(java.lang.String path)
ElementPathElementHandler from the event based processor,
for the specified path. The path can be either an absolute path (i.e.
prefixed with "/") or a relative path (i.e. assummed to be a child of the
current path as retrieved by getPath .removeHandler in interface ElementPathpath - is the path to remove the ElementHandler for.public boolean containsHandler(java.lang.String path)
path - DOCUMENT ME!ElementHandler is registered for the
specified path.private java.lang.String getHandlerPath(java.lang.String path)