本文整理汇总了Java中net.sf.saxon.tree.iter.SingletonIterator类的典型用法代码示例。如果您正苦于以下问题:Java SingletonIterator类的具体用法?Java SingletonIterator怎么用?Java SingletonIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingletonIterator类属于net.sf.saxon.tree.iter包,在下文中一共展示了SingletonIterator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterate
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
public SequenceIterator iterate(XPathContext context) throws XPathException {
final SequenceIterator iterator = myVariable.iterate(context);
if (iterator instanceof EmptyIterator) {
final ValueRepresentation value = myVariable.evaluateVariable(context);
if (value instanceof Item) {
return SingletonIterator.makeIterator((Item)value);
} else if (value instanceof net.sf.saxon.value.Value) {
return ((net.sf.saxon.value.Value)value).iterate();
} else {
return iterator;
}
} else {
return iterator;
}
}
示例2: makeCallExpression
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
private static final long serialVersionUID = 1L;
@Override
public Sequence call(XPathContext xPathContext, Sequence[] arguments) throws XPathException {
// 1st argument (mandatory, index 0)
StringValue arg1 = (StringValue) arguments[0].iterate().next();
String arg1Str = arg1.getStringValue();
// 2nd argument (optional, index 1)
String arg2Str = "";
if (arguments.length > 1) {
StringValue arg2 = (StringValue) arguments[1].iterate().next();
arg2Str = arg2.getStringValue();
}
// Functionality goes here
String resultStr = arg1Str + arg2Str;
Item result = new StringValue(resultStr);
return SequenceTool.toLazySequence(SingletonIterator.makeIterator(result));
}
};
}
示例3: makeCallExpression
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
private static final long serialVersionUID = 1L;
@Override
public Sequence call(XPathContext xPathContext, Sequence[] arguments) throws XPathException {
// 1st argument (mandatory, index 0)
Int64Value arg1 = (Int64Value) arguments[0].iterate().next();
int arg1Int = arg1.getDecimalValue().toBigInteger().intValue();
// 2nd argument (mandatory, index 1)
Int64Value arg2 = (Int64Value) arguments[1].iterate().next();
int arg2Int = arg2.getDecimalValue().toBigInteger().intValue();
// Functionality goes here
int resultInt = arg1Int + arg2Int;
Item result = new Int64Value(resultInt);
return SequenceTool.toLazySequence(SingletonIterator.makeIterator(result));
}
};
}
示例4: next
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
@Override
public Sequence next() throws HttpClientException {
Item item;
try {
item = myIt == null ? null : myIt.next();
} catch (XPathException ex) {
throw new HttpClientException("Error getting the next item in the sequence", ex);
}
SequenceIterator it = SingletonIterator.makeIterator(item);
return new SaxonSequence(it, myCtxt);
}
示例5: getTypedValue
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
/**
* Get the typed value of the item
*/
public SequenceIterator getTypedValue() {
return SingletonIterator.makeIterator((AtomicValue)atomize());
}
示例6: iterate
import net.sf.saxon.tree.iter.SingletonIterator; //导入依赖的package包/类
@Override
public SequenceIterator<? extends Item> iterate() throws XPathException {
return SingletonIterator.makeIterator((NodeInfo)this);
}