| |
|
| java.lang.Object gnu.lists.SeqPosition gnu.lists.TreePosition
All known Subclasses: gnu.kawa.xml.Focus,
TreePosition | public class TreePosition extends SeqPosition implements Cloneable(Code) | | A position that can also go down and up in a tree.
A TreePosition is a stack of positions. The "current" position
(i.e. the one you get if you tree the TreePosition as a SeqPosition)
is that in the innermost containing sequence.
Normally, the "current" element is (the one following) a position in a
sequence. As a special (initial case), we may want to treat the
entire sequence is the "current element". This is represented by depth==-1
and xpos set to the root element (which need not actually be a sequence).
|
Field Summary | |
int | depth Depth of the above stacks.
Note that getDepth returns depth+1; this should perhaps match. | int[] | istack Stack of pushed values for iposition. | AbstractSequence[] | sstack Stack of pushed values for sequence. | int | start Start of stacks - anything below 'start' is ignored.
This is useful for pushing/pop positions without object allocation. |
depth | int depth(Code) | | Depth of the above stacks.
Note that getDepth returns depth+1; this should perhaps match.
|
istack | int[] istack(Code) | | Stack of pushed values for iposition.
|
start | int start(Code) | | Start of stacks - anything below 'start' is ignored.
This is useful for pushing/pop positions without object allocation.
|
TreePosition | public TreePosition()(Code) | | |
TreePosition | public TreePosition(Object root)(Code) | | Not a position *in* a sequence, but the current element is the entire sequence.
|
dump | public void dump()(Code) | | Copy this position into pos.
|
getAncestor | public Object getAncestor(int up)(Code) | | Get the value of an ancestor node.
Parameters: up - the number parents to go up. if up is 0, same getNext. Otherwise get parentapplied as specified. |
getDepth | public int getDepth()(Code) | | Number of ancestor sequences, including current sequence.
|
gotoAttributesStart | public boolean gotoAttributesStart()(Code) | | Set position before first attribute (of the element following position).
This is used to iterate through the sequence of attributes.
|
gotoChildrenStart | public boolean gotoChildrenStart()(Code) | | Set position before first child (of the element following position).
true if there is a child sequence (which might be empty);false if current position is end of sequence or following elementis atomic (cannot have children). |
gotoParent | final public boolean gotoParent()(Code) | | |
popNoRelease | public void popNoRelease()(Code) | | |
release | public void release()(Code) | | |
|
|
|