Package org.exist.xquery.value

Examples of org.exist.xquery.value.IntegerValue


            //no, log the error
            logger.error("Unable to read image data!");
            return Sequence.EMPTY_SEQUENCE;
        } else {
            //return the width of the image
            return new IntegerValue(iWidth);
        }
    }
View Full Code Here


            //no, log the error
            logger.error("Unable to read image data!");
            return Sequence.EMPTY_SEQUENCE;
        } else {
            //return the Height of the image
            return new IntegerValue(iHeight);
        }
    }
View Full Code Here

  }

  public Item itemAt(int pos) {
    if (pos <= getItemCount())
      try {
        return new IntegerValue(start.getLong() + pos);
      } catch (final XPathException e) {
        LOG.warn("Unexpected exception when processing result of range expression: " + e.getMessage(), e);
      }
    return null;
  }
View Full Code Here

    }

    public Item nextItem() {
      try {
        if (current <= end.getLong())
          {return new IntegerValue(current++);}
      } catch (final XPathException e) {
        LOG.warn("Unexpected exception when processing result of range expression: " + e.getMessage(), e);
      }
      return null;
    }
View Full Code Here

        try {
            for (int i = 0; i < count; i++) {
                File nextFile = new File(directory, prefix + i + ".xml");
               
                service.declareVariable("filename", nextFile.getName());
                service.declareVariable("count", new IntegerValue(i));
                ResourceSet results = service.execute(compiled);

                Writer out = new OutputStreamWriter(new FileOutputStream(nextFile), "UTF-8");
                for (ResourceIterator iter = results.getIterator(); iter.hasMoreResources(); ) {
                    Resource r = iter.nextResource();
View Full Code Here

            if (!Type.subTypeOf(endSeq.itemAt(0).atomize().getType(), Type.INTEGER) &&
              !Type.subTypeOf(endSeq.itemAt(0).atomize().getType(), Type.UNTYPED_ATOMIC))
          {throw new XPathException(this, ErrorCodes.FORG0006, "Required type is " +
              Type.getTypeName(Type.INTEGER) + " but got '" + Type.getTypeName(endSeq.itemAt(0).getType()) + "(" +
              endSeq.itemAt(0).getStringValue() + ")'", endSeq);}
            final IntegerValue valueStart = (IntegerValue)startSeq.itemAt(0).convertTo(Type.INTEGER);
            final IntegerValue valueEnd = (IntegerValue)endSeq.itemAt(0).convertTo(Type.INTEGER);
//             result = new ValueSequence();
//        for (long i = valueStart.getLong();  i <= valueEnd.getLong(); i++) {
//          result.add(new IntegerValue(i));
//        }
            result = new RangeSequence(valueStart, valueEnd);
View Full Code Here

    if (inSequence == null)
      {throw new XPathException(this, ErrorCodes.XPDY0002, "undefined context item");}
        else if (inSequence.isEmpty())
          {result = Sequence.EMPTY_SEQUENCE;}
        else
          {result = new IntegerValue(inSequence.getItemCount());}
       
        if (context.getProfiler().isEnabled())
            {context.getProfiler().end(this, "", result);}
       
        return result;          
View Full Code Here

                    sum = sum.plus((ComputableValue) value);
                } catch(final XPathException e) {
                    throw new XPathException(this, ErrorCodes.FORG0006, e.getMessage());
                }
            }
            result = sum.div(new IntegerValue(inner.getItemCount()));
        }
        if (!gotInfinity) {
            if (Type.subTypeOf(result.getItemType(), Type.NUMBER) &&
                ((NumericValue)result).isInfinite()) {
                //Throw an overflow exception here since we get an infinity
View Full Code Here

     * @return a <code>ValueSequence</code> value
     */
    public static ValueSequence getCodePoints(final String s) {
        final ValueSequence codepoints = new ValueSequence();
        char ch;
        IntegerValue next;
        for (int i = 0; i < s.length(); i++) {
            ch = s.charAt(i);
            if (XMLChar.isSurrogate(ch)) {
                final int supp = XMLChar.supplemental(ch, s.charAt(++i));
                next = new IntegerValue(supp);
            } else {
                next = new IntegerValue((int) ch);
            }
            codepoints.add(next);
        }
        return codepoints;
    }
View Full Code Here

     */
    public static String subSequence(final ValueSequence seq, final int start, final int end)
        throws XPathException {
        final StringBuilder substring = new StringBuilder(seq.getItemCount());
        int ch;
        final @SuppressWarnings("unused")
    IntegerValue next;
        if (seq.getItemCount() < end) {
            return subSequence(seq, start);
        }
        try {
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.IntegerValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.