当前位置: 首页>>代码示例>>Java>>正文


Java IntegerValue类代码示例

本文整理汇总了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));
}
 
开发者ID:dita-semia,项目名称:XsltGui,代码行数:22,代码来源:GuiHtmlDialog.java

示例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();
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:11,代码来源:SetCacheValueCall.java

示例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();
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:11,代码来源:SaxonAttribute.java

示例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();
      }
    }
  };
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:57,代码来源:PagerStatusFunction.java

示例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();              
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:7,代码来源:SetStatus.java


注:本文中的net.sf.saxon.value.IntegerValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。