1 21 22 package nu.xom; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 48 public final class Nodes { 49 50 private List nodes; 51 52 53 58 public Nodes() { 59 nodes = new ArrayList (); 60 } 61 62 63 70 public Nodes(Node node) { 71 nodes = new ArrayList (1); 72 nodes.add(node); 73 } 74 75 76 84 public int size() { 85 return nodes.size(); 86 } 87 88 89 103 public Node get(int index) { 104 return (Node) nodes.get(index); 105 } 106 107 108 121 public Node remove(int index) { 122 return (Node) nodes.remove(index); 123 } 124 125 126 138 public void insert(Node node, int index) { 139 nodes.add(index, node); 140 } 141 142 143 150 public void append(Node node) { 151 nodes.add(node); 152 } 153 154 155 } | Popular Tags |