Path as a stream is moved through.
Can be linked to a com. or
com. by wrapping them with a
PathTrackingWriter or PathTrackingReader.
PathTracker tracker = new PathTracker();
tracker.pushElement("table");
tracker.pushElement("tr");
tracker.pushElement("td");
tracker.pushElement("form");
tracker.popElement("form");
tracker.popElement("td");
tracker.pushElement("td");
tracker.pushElement("div");
Path path = tracker.getPath(); // returns "/table/tr/td[2]/div"
Path, PathTrackingReader, PathTrackingWriter
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private Path | |
| private Map | |
| private String[] | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PathTracker(int
Size of the initial stack of nodes (one level per depth in the tree). Note that this is
only for optimizations - the stack will resize itself if it exceeds its capacity. If in doubt,
use the other constructor. initialCapacity)
|
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public Path | |
| public String | |
| public String | |
| public void | |
| public void | pushElement(String
Name of the element name)Notify the tracker that the stream has moved into a new element. |
| private void |
| capacity | back to summary |
|---|---|
| private int capacity | |
| currentPath | back to summary |
|---|---|
| private Path currentPath | |
| indexMapStack | back to summary |
|---|---|
| private Map<K, V>[] indexMapStack | |
| pathStack | back to summary |
|---|---|
| private String[] pathStack | |
| pointer | back to summary |
|---|---|
| private int pointer | |
| PathTracker | back to summary |
|---|---|
| public PathTracker() | |
| PathTracker | back to summary |
|---|---|
public PathTracker(int initialCapacity)
| |
| depth | back to summary |
|---|---|
| public int depth() Get the depth of the stack.
| |
| getPath | back to summary |
|---|---|
| public Path getPath() Current Path in stream. | |
| peekElement | back to summary |
|---|---|
| public String peekElement() Get the last path element from the stack.
| |
| peekElement | back to summary |
|---|---|
| public String peekElement(int i) Get a path element from the stack.
| |
| popElement | back to summary |
|---|---|
| public void popElement() Notify the tracker that the stream has moved out of an element. | |
| pushElement | back to summary |
|---|---|
| public void pushElement(String name) Notify the tracker that the stream has moved into a new element.
| |
| resizeStacks | back to summary |
|---|---|
| private void resizeStacks(int newCapacity) | |