Skip to content

Commit 434fffe

Browse files
committed
cleanup
1 parent aa8c783 commit 434fffe

58 files changed

Lines changed: 146 additions & 4043 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/net/sourceforge/htmlunit/xpath/Expression.java

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919

2020
import javax.xml.transform.ErrorListener;
2121
import javax.xml.transform.TransformerException;
22-
import net.sourceforge.htmlunit.xpath.objects.XNodeSet;
22+
2323
import net.sourceforge.htmlunit.xpath.objects.XObject;
24-
import net.sourceforge.htmlunit.xpath.objects.XString;
2524
import net.sourceforge.htmlunit.xpath.res.XPATHErrorResources;
2625
import net.sourceforge.htmlunit.xpath.res.XSLMessages;
2726
import net.sourceforge.htmlunit.xpath.xml.dtm.DTM;
@@ -132,17 +131,6 @@ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerEx
132131
return execute(xctxt).bool();
133132
}
134133

135-
/**
136-
* Cast result object to a string.
137-
*
138-
* @param xctxt The XPath runtime context.
139-
* @return The string this wraps or the empty string if null
140-
* @throws javax.xml.transform.TransformerException
141-
*/
142-
public XString xstr(XPathContext xctxt) throws javax.xml.transform.TransformerException {
143-
return execute(xctxt).xstr();
144-
}
145-
146134
/**
147135
* Tell if the expression is a nodeset expression. In other words, tell if you can execute {@link
148136
* #asNode(XPathContext) asNode} without an exception.
@@ -187,30 +175,6 @@ public DTMIterator asIterator(XPathContext xctxt, int contextNode)
187175
}
188176
}
189177

190-
/**
191-
* Given an select expression and a context, evaluate the XPath and return the resulting iterator,
192-
* but do not clone.
193-
*
194-
* @param xctxt The execution context.
195-
* @param contextNode The node that "." expresses.
196-
* @return A valid DTMIterator.
197-
* @throws TransformerException thrown if the active ProblemListener decides the error condition
198-
* is severe enough to halt processing.
199-
* @throws javax.xml.transform.TransformerException
200-
*/
201-
public DTMIterator asIteratorRaw(XPathContext xctxt, int contextNode)
202-
throws javax.xml.transform.TransformerException {
203-
204-
try {
205-
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
206-
207-
XNodeSet nodeset = (XNodeSet) execute(xctxt);
208-
return nodeset.iterRaw();
209-
} finally {
210-
xctxt.popCurrentNodeAndExpression();
211-
}
212-
}
213-
214178
/**
215179
* Tell if this expression returns a stable number that will not change during iterations within
216180
* the expression. This is used to determine if a proximity position predicate can indicate that

src/main/java/net/sourceforge/htmlunit/xpath/NodeSet.java

Lines changed: 0 additions & 254 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@
4545
*/
4646
public class NodeSet implements NodeList, NodeIterator, Cloneable, ContextNodeList {
4747

48-
/** Create an empty nodelist. */
49-
public NodeSet() {
50-
m_blocksize = 32;
51-
m_mapSize = 0;
52-
}
53-
5448
/**
5549
* Create an empty, using the given block size.
5650
*
@@ -61,54 +55,6 @@ public NodeSet(int blocksize) {
6155
m_mapSize = 0;
6256
}
6357

64-
/**
65-
* Create a NodeSet, and copy the members of the given nodelist into it.
66-
*
67-
* @param nodelist List of Nodes to be made members of the new set.
68-
*/
69-
public NodeSet(NodeList nodelist) {
70-
71-
this(32);
72-
73-
addNodes(nodelist);
74-
}
75-
76-
/**
77-
* Create a NodeSet, and copy the members of the given NodeSet into it.
78-
*
79-
* @param nodelist Set of Nodes to be made members of the new set.
80-
*/
81-
public NodeSet(NodeSet nodelist) {
82-
83-
this(32);
84-
85-
addNodes((NodeIterator) nodelist);
86-
}
87-
88-
/**
89-
* Create a NodeSet, and copy the members of the given NodeIterator into it.
90-
*
91-
* @param ni Iterator which yields Nodes to be made members of the new set.
92-
*/
93-
public NodeSet(NodeIterator ni) {
94-
95-
this(32);
96-
97-
addNodes(ni);
98-
}
99-
100-
/**
101-
* Create a NodeSet which contains the given Node.
102-
*
103-
* @param node Single node to be added to the new set.
104-
*/
105-
public NodeSet(Node node) {
106-
107-
this(32);
108-
109-
addNode(node);
110-
}
111-
11258
/**
11359
* @return The root node of the Iterator, as specified when it was created. For non-Iterator
11460
* NodeSets, this will be null.
@@ -535,15 +481,6 @@ public Node getCurrentNode() {
535481
*/
536482
protected transient boolean m_cacheNodes = true;
537483

538-
/**
539-
* Get whether or not this is a cached node set.
540-
*
541-
* @return True if this list is cached.
542-
*/
543-
public boolean getShouldCacheNodes() {
544-
return m_cacheNodes;
545-
}
546-
547484
/**
548485
* If setShouldCacheNodes(true) is called, then nodes will be cached. They are not cached by
549486
* default. This switch must be set before the first call to nextNode is made, to ensure that all
@@ -707,134 +644,6 @@ public final void push(Node value) {
707644
m_firstFree = ff;
708645
}
709646

710-
/**
711-
* Pop a node from the tail of the vector and return the result.
712-
*
713-
* @return the node at the tail of the vector
714-
*/
715-
public final Node pop() {
716-
717-
m_firstFree--;
718-
719-
Node n = m_map[m_firstFree];
720-
721-
m_map[m_firstFree] = null;
722-
723-
return n;
724-
}
725-
726-
/**
727-
* Pop a node from the tail of the vector and return the top of the stack after the pop.
728-
*
729-
* @return The top of the stack after it's been popped
730-
*/
731-
public final Node popAndTop() {
732-
733-
m_firstFree--;
734-
735-
m_map[m_firstFree] = null;
736-
737-
return (m_firstFree == 0) ? null : m_map[m_firstFree - 1];
738-
}
739-
740-
/** Pop a node from the tail of the vector. */
741-
public final void popQuick() {
742-
743-
m_firstFree--;
744-
745-
m_map[m_firstFree] = null;
746-
}
747-
748-
/**
749-
* Return the node at the top of the stack without popping the stack. Special purpose method for
750-
* TransformerImpl, pushElemTemplateElement. Performance critical.
751-
*
752-
* @return Node at the top of the stack or null if stack is empty.
753-
*/
754-
public final Node peepOrNull() {
755-
return ((null != m_map) && (m_firstFree > 0)) ? m_map[m_firstFree - 1] : null;
756-
}
757-
758-
/**
759-
* Push a pair of nodes into the stack. Special purpose method for TransformerImpl,
760-
* pushElemTemplateElement. Performance critical.
761-
*
762-
* @param v1 First node to add to vector
763-
* @param v2 Second node to add to vector
764-
*/
765-
public final void pushPair(Node v1, Node v2) {
766-
767-
if (null == m_map) {
768-
m_map = new Node[m_blocksize];
769-
m_mapSize = m_blocksize;
770-
} else {
771-
if ((m_firstFree + 2) >= m_mapSize) {
772-
m_mapSize += m_blocksize;
773-
774-
Node newMap[] = new Node[m_mapSize];
775-
776-
System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
777-
778-
m_map = newMap;
779-
}
780-
}
781-
782-
m_map[m_firstFree] = v1;
783-
m_map[m_firstFree + 1] = v2;
784-
m_firstFree += 2;
785-
}
786-
787-
/**
788-
* Pop a pair of nodes from the tail of the stack. Special purpose method for TransformerImpl,
789-
* pushElemTemplateElement. Performance critical.
790-
*/
791-
public final void popPair() {
792-
793-
m_firstFree -= 2;
794-
m_map[m_firstFree] = null;
795-
m_map[m_firstFree + 1] = null;
796-
}
797-
798-
/**
799-
* Set the tail of the stack to the given node. Special purpose method for TransformerImpl,
800-
* pushElemTemplateElement. Performance critical.
801-
*
802-
* @param n Node to set at the tail of vector
803-
*/
804-
public final void setTail(Node n) {
805-
m_map[m_firstFree - 1] = n;
806-
}
807-
808-
/**
809-
* Set the given node one position from the tail. Special purpose method for TransformerImpl,
810-
* pushElemTemplateElement. Performance critical.
811-
*
812-
* @param n Node to set
813-
*/
814-
public final void setTailSub1(Node n) {
815-
m_map[m_firstFree - 2] = n;
816-
}
817-
818-
/**
819-
* Return the node at the tail of the vector without popping Special purpose method for
820-
* TransformerImpl, pushElemTemplateElement. Performance critical.
821-
*
822-
* @return Node at the tail of the vector
823-
*/
824-
public final Node peepTail() {
825-
return m_map[m_firstFree - 1];
826-
}
827-
828-
/**
829-
* Return the node one position from the tail without popping. Special purpose method for
830-
* TransformerImpl, pushElemTemplateElement. Performance critical.
831-
*
832-
* @return Node one away from the tail
833-
*/
834-
public final Node peepTailSub1() {
835-
return m_map[m_firstFree - 2];
836-
}
837-
838647
/**
839648
* Inserts the specified node in this vector at the specified index. Each component in this vector
840649
* with an index greater or equal to the specified index is shifted upward to have an index one
@@ -873,49 +682,6 @@ public void insertElementAt(Node value, int at) {
873682
m_firstFree++;
874683
}
875684

876-
/**
877-
* Append the nodes to the list.
878-
*
879-
* @param nodes NodeVector to append to this list
880-
*/
881-
public void appendNodes(NodeSet nodes) {
882-
883-
int nNodes = nodes.size();
884-
885-
if (null == m_map) {
886-
m_mapSize = nNodes + m_blocksize;
887-
m_map = new Node[m_mapSize];
888-
} else if ((m_firstFree + nNodes) >= m_mapSize) {
889-
m_mapSize += nNodes + m_blocksize;
890-
891-
Node newMap[] = new Node[m_mapSize];
892-
893-
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes);
894-
895-
m_map = newMap;
896-
}
897-
898-
System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes);
899-
900-
m_firstFree += nNodes;
901-
}
902-
903-
/**
904-
* Inserts the specified node in this vector at the specified index. Each component in this vector
905-
* with an index greater or equal to the specified index is shifted upward to have an index one
906-
* greater than the value it had previously.
907-
*/
908-
public void removeAllElements() {
909-
910-
if (null == m_map) return;
911-
912-
for (int i = 0; i < m_firstFree; i++) {
913-
m_map[i] = null;
914-
}
915-
916-
m_firstFree = 0;
917-
}
918-
919685
/**
920686
* Removes the first occurrence of the argument from this vector. If the object is found in this
921687
* vector, each component in the vector with an index greater or equal to the object's index is
@@ -950,26 +716,6 @@ public boolean removeElement(Node s) {
950716
return false;
951717
}
952718

953-
/**
954-
* Deletes the component at the specified index. Each component in this vector with an index
955-
* greater or equal to the specified index is shifted downward to have an index one smaller than
956-
* the value it had previously.
957-
*
958-
* @param i Index of node to remove
959-
*/
960-
public void removeElementAt(int i) {
961-
962-
if (null == m_map) return;
963-
964-
if (i >= m_firstFree) throw new ArrayIndexOutOfBoundsException(i + " >= " + m_firstFree);
965-
else if (i < 0) throw new ArrayIndexOutOfBoundsException(i);
966-
967-
if (i < m_firstFree - 1) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i - 1);
968-
969-
m_firstFree--;
970-
m_map[m_firstFree] = null;
971-
}
972-
973719
/**
974720
* Sets the component at the specified index of this vector to be the specified object. The
975721
* previous component at that position is discarded.

0 commit comments

Comments
 (0)