Package org.htmlunit.xpath.xml.utils
Class NodeVector
- java.lang.Object
-
- org.htmlunit.xpath.xml.utils.NodeVector
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
NodeSetDTM
public class NodeVector extends java.lang.Object implements java.lang.Cloneable
A very simple table that stores a list of Nodes.
-
-
Field Summary
Fields Modifier and Type Field Description private int
m_blocksize
Size of blocks to allocate.protected int
m_firstFree
Number of nodes in this NodeVector.private int[]
m_map
Array of nodes this points to.private int
m_mapSize
Size of the array this points to.
-
Constructor Summary
Constructors Constructor Description NodeVector()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElement(int value)
Append a Node onto the vector.java.lang.Object
clone()
boolean
contains(int s)
Tell if the table contains the given node.int
elementAt(int i)
Get the nth element.int
indexOf(int elem)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.int
indexOf(int elem, int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.void
insertElementAt(int value, int at)
Inserts the specified node in this vector at the specified index.int
size()
Get the length of the list.
-
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
size
public int size()
Get the length of the list.- Returns:
- Number of nodes in this NodeVector
-
addElement
public void addElement(int value)
Append a Node onto the vector.- Parameters:
value
- Node to add to the vector
-
insertElementAt
public void insertElementAt(int value, int at)
Inserts the specified node in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.- Parameters:
value
- Node to insertat
- Position where to insert
-
elementAt
public int elementAt(int i)
Get the nth element.- Parameters:
i
- Index of node to get- Returns:
- Node at specified index
-
contains
public boolean contains(int s)
Tell if the table contains the given node.- Parameters:
s
- Node to look for- Returns:
- True if the given node was found.
-
indexOf
public int indexOf(int elem, int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.- Parameters:
elem
- Node to look forindex
- Index of where to start the search- Returns:
- the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.
-
indexOf
public int indexOf(int elem)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.- Parameters:
elem
- Node to look for- Returns:
- the index of the first occurrence of the object argument in this vector at position index or later in the vector; returns -1 if the object is not found.
-
-