本文整理汇总了Java中net.sf.saxon.tree.iter.ArrayIterator类的典型用法代码示例。如果您正苦于以下问题:Java ArrayIterator类的具体用法?Java ArrayIterator怎么用?Java ArrayIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArrayIterator类属于net.sf.saxon.tree.iter包,在下文中一共展示了ArrayIterator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterateAxis
import net.sf.saxon.tree.iter.ArrayIterator; //导入依赖的package包/类
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
case AxisInfo.ATTRIBUTE:
case AxisInfo.PARENT:
result = EmptyIterator.OfNodes.THE_INSTANCE;
break;
case AxisInfo.ANCESTOR_OR_SELF:
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}
示例2: iterateAxis
import net.sf.saxon.tree.iter.ArrayIterator; //导入依赖的package包/类
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
*
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
result = new Navigator.AncestorEnumeration(this, false);
break;
case AxisInfo.ANCESTOR_OR_SELF:
result = new Navigator.AncestorEnumeration(this, true);
break;
case AxisInfo.ATTRIBUTE:
if (attributes == null) {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
else {
result = new ArrayIterator.OfNodes(attributes);
}
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
case AxisInfo.PARENT:
result = SingleNodeIterator.makeIterator(parent);
break;
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}
示例3: newIterator
import net.sf.saxon.tree.iter.ArrayIterator; //导入依赖的package包/类
public SequenceIterator newIterator() throws HttpClientException {
Item[] array = myItems.toArray(new Item[0]);
return new ArrayIterator(array);
}