Class OutputStack
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<OutputNode>, Collection<OutputNode>, List<OutputNode>, RandomAccess, SequencedCollection<OutputNode>
The
OutputStack is used to keep track of the nodes
that have been written to the document. This ensures that when
nodes are written to the XML document that the writer can tell
whether a child node for a given OutputNode can be
created. Each created node is pushed, and popped when ended.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThe is used to order theOutputNodeobjects from the top down. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SetRepresents the set of nodes that have not been committed.Fields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbottom()This is used to acquire theOutputNodefrom the bottom of the output stack.iterator()This is returns anIteratorthat is used to loop through the ouptut nodes from the top down.pop()This is used to remove theOutputNodefrom the top of the output stack.purge(int index) Thepurgemethod is used to purge a match from the provided position.push(OutputNode value) This method is used to add anOutputNodeto the top of the stack.top()This is used to acquire theOutputNodefrom the top of the output stack.Methods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Field Details
-
active
Represents the set of nodes that have not been committed.
-
-
Constructor Details
-
OutputStack
Constructor for theOutputStackobject. This is used to create a stack that can be used to keep track of the elements that have been written to the XML document.
-
-
Method Details
-
pop
This is used to remove theOutputNodefrom the top of the output stack. This is used when an element has been ended and the output writer wants to block child creation.- Returns:
- this returns the node from the top of the stack
-
top
This is used to acquire theOutputNodefrom the top of the output stack. This is used when the writer wants to determine the current element written to the XML document.- Returns:
- this returns the node from the top of the stack
-
bottom
This is used to acquire theOutputNodefrom the bottom of the output stack. This is used when the writer wants to determine the root element for the written XML document.- Returns:
- this returns the node from the bottom of the stack
-
push
This method is used to add anOutputNodeto the top of the stack. This is used when an element is written to the XML document, and allows the writer to determine if a child node can be created from a given output node.- Parameters:
value- this is the output node to add to the stack
-
purge
Thepurgemethod is used to purge a match from the provided position. This also ensures that the active set has the node removed so that it is no longer relevant.- Parameters:
index- the index of the node that is to be removed- Returns:
- returns the node removed from the specified index
-
iterator
This is returns anIteratorthat is used to loop through the ouptut nodes from the top down. This allows the node writer to determine whatModeshould be used by an output node. This reverses the iteration of the list.- Specified by:
iteratorin interfaceCollection<OutputNode>- Specified by:
iteratorin interfaceIterable<OutputNode>- Specified by:
iteratorin interfaceList<OutputNode>- Overrides:
iteratorin classArrayList<OutputNode>- Returns:
- returns an iterator to iterate from the top down
-