Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util
In directory sc8-pr-cvs1:/tmp/cvs-serv15024/src/org/htmlparser/util
Modified Files:
NodeList.java
Log Message:
added more support for string node factory, fixed an error in the NodeArray class
Index: NodeList.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/NodeList.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** NodeList.java 29 Jun 2003 12:29:33 -0000 1.33
--- NodeList.java 12 Jul 2003 00:33:59 -0000 1.34
***************
*** 32,36 ****
import java.util.NoSuchElementException;
- import org.htmlparser.AbstractNode;
import org.htmlparser.Node;
--- 32,35 ----
***************
*** 47,51 ****
size = 0;
capacity = INITIAL_CAPACITY;
! nodeData = new AbstractNode[capacity];
capacityIncrement = capacity*2;
numberOfAdjustments = 0;
--- 46,50 ----
size = 0;
capacity = INITIAL_CAPACITY;
! nodeData = newNodeArrayFor(capacity);
capacityIncrement = capacity*2;
numberOfAdjustments = 0;
***************
*** 75,82 ****
capacityIncrement *= 2;
Node oldData [] = nodeData;
! nodeData = new AbstractNode[capacity];
System.arraycopy(oldData, 0, nodeData, 0, size);
numberOfAdjustments++;
}
public int size() {
--- 74,85 ----
capacityIncrement *= 2;
Node oldData [] = nodeData;
! nodeData = newNodeArrayFor(capacity);
System.arraycopy(oldData, 0, nodeData, 0, size);
numberOfAdjustments++;
}
+
+ private Node[] newNodeArrayFor(int capacity) {
+ return new Node[capacity];
+ }
public int size() {
***************
*** 112,116 ****
public Node [] toNodeArray() {
! Node [] nodeArray = new AbstractNode[size];
System.arraycopy(nodeData, 0, nodeArray, 0, size);
return nodeArray;
--- 115,119 ----
public Node [] toNodeArray() {
! Node [] nodeArray = newNodeArrayFor(size);
System.arraycopy(nodeData, 0, nodeArray, 0, size);
return nodeArray;
***************
*** 139,143 ****
size = 0;
capacity = INITIAL_CAPACITY;
! nodeData = new AbstractNode[capacity];
capacityIncrement = capacity*2;
numberOfAdjustments = 0;
--- 142,146 ----
size = 0;
capacity = INITIAL_CAPACITY;
! nodeData = newNodeArrayFor(capacity);
capacityIncrement = capacity*2;
numberOfAdjustments = 0;
|