OLD | NEW |
1 | 1 |
2 /** | 2 /** |
3 * Instances of the class {@code NodeList} represent a list of AST nodes that ha
ve a common parent. | 3 * Instances of the class {@code NodeList} represent a list of AST nodes that ha
ve a common parent. |
4 */ | 4 */ |
5 class NodeList<E extends ASTNode> extends ListWrapper<E> { | 5 class NodeList<E extends ASTNode> extends ListWrapper<E> { |
6 /** | 6 /** |
7 * The node that is the parent of each of the elements in the list. | 7 * The node that is the parent of each of the elements in the list. |
8 */ | 8 */ |
9 ASTNode owner; | 9 ASTNode owner; |
10 /** | 10 /** |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 accept(ASTVisitor visitor) { | 23 accept(ASTVisitor visitor) { |
24 for (E element in elements) { | 24 for (E element in elements) { |
25 element.accept(visitor); | 25 element.accept(visitor); |
26 } | 26 } |
27 } | 27 } |
28 void add(E node) { | 28 void add(E node) { |
29 owner.becomeParentOf(node); | 29 owner.becomeParentOf(node); |
30 elements.add(node); | 30 elements.add(node); |
31 } | 31 } |
32 bool addAll(Collection<E> nodes) { | 32 bool addAll(Iterable<E> nodes) { |
33 if (nodes != null) { | 33 if (nodes != null) { |
34 for (E node in nodes) { | 34 for (E node in nodes) { |
35 add(node); | 35 add(node); |
36 } | 36 } |
37 return true; | 37 return true; |
38 } | 38 } |
39 return false; | 39 return false; |
40 } | 40 } |
41 /** | 41 /** |
42 * Return the first token included in this node's source range. | 42 * Return the first token included in this node's source range. |
(...skipping 15 matching lines...) Expand all Loading... |
58 } | 58 } |
59 return elements[elements.length - 1].endToken; | 59 return elements[elements.length - 1].endToken; |
60 } | 60 } |
61 /** | 61 /** |
62 * Return the node that is the parent of each of the elements in the list. | 62 * Return the node that is the parent of each of the elements in the list. |
63 * @return the node that is the parent of each of the elements in the list | 63 * @return the node that is the parent of each of the elements in the list |
64 */ | 64 */ |
65 ASTNode getOwner() { | 65 ASTNode getOwner() { |
66 return owner; | 66 return owner; |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |