class ElementStack extends java.lang.Object implements ElementPath
ElementStack
is used internally inside the SAXContentHandler
to maintain a stack of Element
instances. 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()
ElementPath
size
in interface ElementPath
public Element getElement(int depth)
ElementPath
getElement
in interface ElementPath
depth
- DOCUMENT ME!public java.lang.String getPath()
ElementPath
getPath
in interface ElementPath
public Element getCurrent()
ElementPath
getCurrent
in interface ElementPath
public void addHandler(java.lang.String path, ElementHandler elementHandler)
ElementPath
ElementHandler
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 ElementPath
path
- is the path to be handledelementHandler
- is the ElementHandler
to be called by the event
based processor.public void removeHandler(java.lang.String path)
ElementPath
ElementHandler
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 ElementPath
path
- 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)