本文整理汇总了Java中net.sf.saxon.value.IntegerValue类的典型用法代码示例。如果您正苦于以下问题:Java IntegerValue类的具体用法?Java IntegerValue怎么用?Java IntegerValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntegerValue类属于net.sf.saxon.value包,在下文中一共展示了IntegerValue类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSize
import net.sf.saxon.value.IntegerValue; //导入依赖的package包/类
private Dimension getSize(Sequence[] arguments) throws XPathException {
//logger.info("getSize: " + arguments[SIZE].toString());
if (arguments[SIZE].head().getStringValue().isEmpty()) {
return null;
}
SequenceIterator iterator = arguments[SIZE].iterate();
ArrayList<Integer> sizeList = new ArrayList<Integer>();
Item item = iterator.next();
while (item != null) {
if (!(item instanceof IntegerValue)) {
throw new XPathException("The size attribute must contain only integer values ('" + item.getStringValue() + "').");
}
sizeList.add((int)(((IntegerValue)item).longValue()));
item = iterator.next();
}
if (sizeList.size() != 2) {
throw new XPathException("The size attribute must be empty or contain a sequence of 2 items.");
}
return new Dimension(sizeList.get(0), sizeList.get(1));
}
示例2: call
import net.sf.saxon.value.IntegerValue; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
String cacheName = ((StringValue) arguments[0].head()).getStringValue();
String keyName = ((StringValue) arguments[1].head()).getStringValue();
int tti = (int) ((IntegerValue) arguments[3].head()).longValue();
int ttl = (int) ((IntegerValue) arguments[4].head()).longValue();
Collection<Attribute> attrs = sequenceToAttributeCollection(arguments[2]);
setAttributes(cacheName, keyName, attrs, tti, ttl, context);
return EmptySequence.getInstance();
}
示例3: getInteger
import net.sf.saxon.value.IntegerValue; //导入依赖的package包/类
@Override
public int getInteger() throws HttpClientException {
String str = myNode.getStringValue();
NumericValue val = NumericValue.parseNumber(str);
if (!NumericValue.isInteger(val)) {
throw new HttpClientException("@" + getLocalName() + " is not an integer");
}
IntegerValue i = (IntegerValue) val;
return i.asBigInteger().intValue();
}
示例4: makeCallExpression
import net.sf.saxon.value.IntegerValue; //导入依赖的package包/类
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
@Override
public Sequence call(XPathContext pXPathContext, Sequence[] pArguments)
throws XPathException {
ActionRequestContext lRequestContext = SaxonEnvironment.getThreadLocalRequestContext();
//First argument is status type (mandatory string)
String lStatusType = FunctionUtils.getStringValueOrNull(pArguments, 0, FUNCTION_NAME);
if(XFUtil.isNull(lStatusType)) {
throw new ExInternal("First parameter to fox:pager-status function must be a non-empty string.");
}
//Second argument is invoke name (mandatory string)
String lInvokeName = FunctionUtils.getStringValueOrNull(pArguments, 1, FUNCTION_NAME);
if(XFUtil.isNull(lInvokeName)) {
throw new ExInternal("Second parameter to fox:pager-status function must be a non-empty string.");
}
//Optional 3rd argument for getting match id
DOM lMatchDOM = FunctionUtils.getDOMNodeOrNull(pArguments, 2, FUNCTION_NAME);
String lMatchFoxId = null;
if(lMatchDOM != null) {
lMatchFoxId = lMatchDOM.getFoxId();
}
Pager lPager = lRequestContext.getModuleFacetProvider(PagerProvider.class).getPagerOrNull(lInvokeName, lMatchFoxId);
if(lPager != null) {
Item lResult;
switch(lStatusType) {
case "current-page":
lResult = IntegerValue.makeIntegerValue((double) lPager.getCurrentPage()).asAtomic();
break;
case "page-count":
lResult = IntegerValue.makeIntegerValue((double) lPager.getPageCount()).asAtomic();
break;
case "page-size":
lResult = IntegerValue.makeIntegerValue((double) lPager.getPageSize()).asAtomic();
break;
case "row-count":
lResult = IntegerValue.makeIntegerValue((double) lPager.getRowCount()).asAtomic();
break;
default:
throw new ExInternal("Unrecognised value for status type parameter: " + lStatusType);
}
return lResult;
}
else {
return EmptySequence.getInstance();
}
}
};
}
示例5: call
import net.sf.saxon.value.IntegerValue; //导入依赖的package包/类
@Override
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
long status = ((IntegerValue) arguments[0].head()).longValue();
getResponse(context).setStatus((int) status);
return EmptySequence.getInstance();
}