An ordered list of Node, used to represent the body of an element, or a jsp page of jsp document.
| 2728 | * An ordered list of Node, used to represent the body of an element, or a jsp page of jsp document. |
| 2729 | */ |
| 2730 | public static class Nodes { |
| 2731 | |
| 2732 | private final List<Node> list; |
| 2733 | |
| 2734 | private Node.Root root; // null if this is not a page |
| 2735 | |
| 2736 | private boolean generatedInBuffer; |
| 2737 | |
| 2738 | Nodes() { |
| 2739 | list = new ArrayList<>(); |
| 2740 | } |
| 2741 | |
| 2742 | Nodes(Node.Root root) { |
| 2743 | this.root = root; |
| 2744 | list = new ArrayList<>(); |
| 2745 | list.add(root); |
| 2746 | } |
| 2747 | |
| 2748 | /** |
| 2749 | * Appends a node to the list |
| 2750 | * |
| 2751 | * @param n The node to add |
| 2752 | */ |
| 2753 | public void add(Node n) { |
| 2754 | list.add(n); |
| 2755 | root = null; |
| 2756 | } |
| 2757 | |
| 2758 | /** |
| 2759 | * Removes the given node from the list. |
| 2760 | * |
| 2761 | * @param n The node to be removed |
| 2762 | */ |
| 2763 | public void remove(Node n) { |
| 2764 | list.remove(n); |
| 2765 | } |
| 2766 | |
| 2767 | /** |
| 2768 | * Visit the nodes in the list with the supplied visitor |
| 2769 | * |
| 2770 | * @param v The visitor used |
| 2771 | * |
| 2772 | * @throws JasperException if an error occurs while visiting a node |
| 2773 | */ |
| 2774 | public void visit(Visitor v) throws JasperException { |
| 2775 | for (Node n : list) { |
| 2776 | n.accept(v); |
| 2777 | } |
| 2778 | } |
| 2779 | |
| 2780 | /** |
| 2781 | * Returns the number of nodes in this collection. |
| 2782 | * |
| 2783 | * @return The number of nodes |
| 2784 | */ |
| 2785 | public int size() { |
| 2786 | return list.size(); |
| 2787 | } |
nothing calls this directly
no outgoing calls
no test coverage detected