本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.END属性的典型用法代码示例。如果您正苦于以下问题:Java DTMAxisIterator.END属性的具体用法?Java DTMAxisIterator.END怎么用?Java DTMAxisIterator.END使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xml.internal.dtm.DTMAxisIterator
的用法示例。
在下文中一共展示了DTMAxisIterator.END属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNodeByPosition
/**
* Return the node at the given position.
*
* @param position The position
* @return The node at the given position.
*/
public int getNodeByPosition(int position) {
int node = DTMAxisIterator.END;
// If nodes are stored in _nodes, take advantage of the fact that
// there are no duplicates and they are stored in document order.
// Otherwise, fall back to the base heap implementation to do a
// good job with this.
if (_nodes != null) {
if (position > 0) {
if (position <= _nodes.cardinality()) {
_position = position;
node = _nodes.at(position-1);
} else {
_position = _nodes.cardinality();
}
}
} else {
node = super.getNodeByPosition(position);
}
return node;
}
示例2: next
/**
* Get the next node in the iteration.
*
* @return The next node handle in the iteration, or END.
*/
public int next() {
int nodeHandle;
// If at most one key value or at most one string argument to id
// resulted in nodes being returned, use the IntegerArray
// stored at _nodes directly. This relies on the fact that the
// IntegerArray never includes duplicate nodes and is always stored
// in document order.
if (_nodes != null) {
if (_position < _nodes.cardinality()) {
nodeHandle = returnNode(_nodes.at(_position));
} else {
nodeHandle = DTMAxisIterator.END;
}
} else {
nodeHandle = super.next();
}
return nodeHandle;
}
示例3: next
public int next() {
if (_ready) {
_ready = false;
return _source.getNodeByPosition(_position);
}
return DTMAxisIterator.END;
/*
if (_ready && _position > 0) {
final int pos = _source.isReverse()
? _source.getLast() - _position + 1
: _position;
_ready = false;
int node;
while ((node = _source.next()) != DTMAxisIterator.END) {
if (pos == _source.getPosition()) {
return node;
}
}
}
return DTMAxisIterator.END;
*/
}
示例4: item
/**
* Returns the <code>index</code>th item in the collection. If
* <code>index</code> is greater than or equal to the number of nodes in
* the list, this returns <code>null</code>.
* @param index Index into the collection.
* @return The node at the <code>index</code>th position in the
* <code>NodeList</code>, or <code>null</code> if that is not a valid
* index.
*/
public Node item(int index) {
if (m_iter != null) {
int node = 0;
int count = m_cachedNodes.size();
if (count > index) {
node = m_cachedNodes.elementAt(index);
return m_dtm.getNode(node);
} else if (m_last == -1) {
while (count <= index
&& ((node = m_iter.next()) != DTMAxisIterator.END)) {
m_cachedNodes.addElement(node);
count++;
}
if (node == DTMAxisIterator.END) {
m_last = count;
} else {
return m_dtm.getNode(node);
}
}
}
return null;
}
示例5: getNextBit
/**
* Returns the next set bit from a given position
*/
public final int getNextBit(int startBit) {
for (int i = (startBit >>> 5) ; i<=_intSize; i++) {
int bits = _bits[i];
if (bits != 0) {
for (int b = (startBit % 32); b<32; b++) {
if ((bits & _masks[b]) != 0) {
return((i << 5) + b);
}
}
}
startBit = 0;
}
return(DTMAxisIterator.END);
}
示例6: compare
/**
* Utility function: node-set/node-set compare.
*/
public static boolean compare(DTMAxisIterator left, DTMAxisIterator right,
int op, DOM dom) {
int lnode;
left.reset();
while ((lnode = left.next()) != DTMAxisIterator.END) {
final String lvalue = dom.getStringValueX(lnode);
int rnode;
right.reset();
while ((rnode = right.next()) != DTMAxisIterator.END) {
// String value must be the same if both nodes are the same
if (lnode == rnode) {
if (op == Operators.EQ) {
return true;
} else if (op == Operators.NE) {
continue;
}
}
if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
dom)) {
return true;
}
}
}
return false;
}
示例7: sumF
/**
* XSLT Standard function sum(node-set).
* stringToDouble is inlined
*/
public static double sumF(DTMAxisIterator iterator, DOM dom) {
try {
double result = 0.0;
int node;
while ((node = iterator.next()) != DTMAxisIterator.END) {
result += Double.parseDouble(dom.getStringValueX(node));
}
return result;
}
catch (NumberFormatException e) {
return Double.NaN;
}
}
示例8: documentF
/**
* Interprets the arguments passed from the document() function (see
* com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
* iterator containing the requested nodes. Builds a union-iterator if
* several documents are requested.
* 2 arguments arg1 and arg2. document(Obj, node-set) call
*/
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
String baseURI = null;
final int arg2FirstNode = arg2.next();
if (arg2FirstNode == DTMAxisIterator.END) {
// the second argument node-set is empty
return EmptyIterator.getInstance();
} else {
//System.err.println("arg2FirstNode name: "
// + dom.getNodeName(arg2FirstNode )+"["
// +Integer.toHexString(arg2FirstNode )+"]");
baseURI = dom.getDocumentURI(arg2FirstNode);
if (!SystemIDResolver.isAbsoluteURI(baseURI))
baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
}
try {
if (arg1 instanceof String) {
if (((String)arg1).length() == 0) {
return document(xslURI, "", translet, dom);
} else {
return document((String)arg1, baseURI, translet, dom);
}
} else if (arg1 instanceof DTMAxisIterator) {
return document((DTMAxisIterator)arg1, baseURI, translet, dom);
} else {
final String err = "document("+arg1.toString()+")";
throw new IllegalArgumentException(err);
}
} catch (Exception e) {
throw new TransletException(e);
}
}
示例9: getNodeByPosition
/**
* Return the node at the given position.
*
* @param position The position
* @return The node at the given position.
*/
public int getNodeByPosition(int position)
{
if (position > 0) {
final int pos = isReverse() ? getLast() - position + 1
: position;
int node;
while ((node = next()) != DTMAxisIterator.END) {
if (pos == getPosition()) {
return node;
}
}
}
return END;
}
示例10: getLength
/**
* The number of nodes in the list. The range of valid child node indices
* is 0 to <code>length-1</code> inclusive.
*/
public int getLength() {
if (m_last == -1) {
int node;
while ((node = m_iter.next()) != DTMAxisIterator.END) {
m_cachedNodes.addElement(node);
}
m_last = m_cachedNodes.size();
}
return m_last;
}
示例11: setStartNode
/**
* <p>Set start to END should 'close' the iterator,
* i.e. subsequent call to next() should return END.</p>
* <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public DTMAxisIterator setStartNode(int start) {
if (start == DTMAxisIterator.END) {
_nodes = null;
}
else if (_nodes != null) {
_position = 0;
}
return (DTMAxisIterator) this;
}
示例12: init
/**
* Evaluate the reference to the <code>key</code> or <code>id</code>
* function with the context specified by {@link #setStartNode(int)}
* and set up this iterator to iterate over the DTM nodes that are
* to be returned.
*/
protected void init() {
super.init();
_position = 0;
// All nodes retrieved are in the same document
int rootHandle = _dom.getAxisIterator(Axis.ROOT)
.setStartNode(_startNode).next();
// Is the argument not a node set?
if (_keyValueIterator == null) {
// Look up nodes returned for the single string argument
_nodes = lookupNodes(rootHandle, _keyValue);
if (_nodes == null) {
_nodes = EMPTY_NODES;
}
} else {
DTMAxisIterator keyValues = _keyValueIterator.reset();
int retrievedKeyValueIdx = 0;
boolean foundNodes = false;
_nodes = null;
// For each node in the node set argument, get the string value
// and look up the nodes returned by key or id for that string
// value. If at most one string value has nodes associated,
// the nodes will be stored in _nodes; otherwise, the nodes
// will be placed in a heap.
for (int keyValueNode = keyValues.next();
keyValueNode != DTMAxisIterator.END;
keyValueNode = keyValues.next()) {
String keyValue = BasisLibrary.stringF(keyValueNode, _dom);
IntegerArray nodes = lookupNodes(rootHandle, keyValue);
if (nodes != null) {
if (!foundNodes) {
_nodes = nodes;
foundNodes = true;
} else {
if (_nodes != null) {
addHeapNode(new KeyIndexHeapNode(_nodes));
_nodes = null;
}
addHeapNode(new KeyIndexHeapNode(nodes));
}
}
}
if (!foundNodes) {
_nodes = EMPTY_NODES;
}
}
}