class ElementStack extends 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(String path,
ElementHandler handler)
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.
|
Element |
getCurrent() |
Element |
getElement(int depth) |
private String |
getHandlerPath(String path) |
String |
getPath() |
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(String path)
Removes the
ElementHandler from the event based
processor, for the specified path. |
void |
setDispatchHandler(DispatchHandler handler) |
int |
size() |
protected int lastElementIndex
private DispatchHandler handler
public ElementStack()
public ElementStack(int defaultCapacity)
public void setDispatchHandler(DispatchHandler handler)
public void clear()
public Element peekElement()
public Element popElement()
public void pushElement(Element element)
protected void reallocate(int size)
public int size()
size
in interface ElementPath
public Element getElement(int depth)
getElement
in interface ElementPath
public String getPath()
getPath
in interface ElementPath
public Element getCurrent()
getCurrent
in interface ElementPath
public void addHandler(String path, ElementHandler handler)
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 handledhandler
- is the ElementHandler
to be called
by the event based processor.public void removeHandler(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.private String getHandlerPath(String path)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses