Package org.exist.xquery.value

Examples of org.exist.xquery.value.Sequence.itemAt()


                    propertyName = "IS_VALID";
                } else {
                    logger.error("Unknown spatial property: " + mySignature.getName().getLocalName());
                    throw new XPathException("Unknown spatial property: " + mySignature.getName().getLocalName());
                }
                NodeValue geometryNode = (NodeValue)nodes.itemAt(0);
                if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                    //The node should be indexed : get its property
                    result = indexWorker.getGeometricPropertyForNode(context, (NodeProxy)geometryNode, propertyName);
                    hasUsedIndex = true;
                } else {
View Full Code Here


        ValueSequence result = new ValueSequence();
        AbstractDateTimeValue d1 = (AbstractDateTimeValue)item;
        DurationValue diff = (DurationValue)args[1].itemAt(0);
        Sequence seq = args[2].convertTo(Type.INTEGER);
        int count = ((NumericValue)seq.itemAt(0).convertTo(Type.INTEGER)).getInt();
        if (count < 0)
            count = 0;

        // loop through dates/times
        while(count-- > 0)
View Full Code Here

        return result;
    }

    protected Item getKey(Sequence contextSequence, Item contextItem) throws XPathException {
        Sequence keySeq = getArgument(1).eval(contextSequence, contextItem);
        Item key = keySeq.itemAt(0);
        if (!(Type.subTypeOf(key.getType(), Type.STRING) || Type.subTypeOf(key.getType(), Type.NODE)))
            throw new XPathException(this, "Second argument to ft:query should either be a query string or " +
                    "an XML element describing the query. Found: " + Type.getTypeName(key.getType()));
        return key;
    }
View Full Code Here

    protected Properties parseOptions(Sequence contextSequence, Item contextItem) throws XPathException {
        if (getArgumentCount() < 3)
            return null;
        Properties options = new Properties();
        Sequence optSeq = getArgument(2).eval(contextSequence, contextItem);
        NodeValue optRoot = (NodeValue) optSeq.itemAt(0);
        try {
            XMLStreamReader reader = context.getXMLStreamReader(optRoot);
            reader.next();
             reader.next();
            while (reader.hasNext()) {
View Full Code Here

//              qnameSeq = super.eval(contextSequence, contextItem);
           
            if (qnameSeq != null) {
              if(!qnameSeq.hasOne())
                throw new XPathException(this, "Type error: the node name should evaluate to a single item");
              Item qnitem = qnameSeq.itemAt(0);
              if (qnitem instanceof QNameValue) {
                qn = ((QNameValue)qnitem).getQName();
              } else {
                tagName = qnitem.getStringValue();
              }
View Full Code Here

            }
        }
       
        Sequence result;
        Sequence seq = args[0].convertTo(Type.DOUBLE);
        NumericValue value = (NumericValue)seq.itemAt(0).convertTo(Type.DOUBLE);

        if(seq.isEmpty())
            result = Sequence.EMPTY_SEQUENCE;
        else {         
            double calcValue=0;
View Full Code Here

        Sequence result;
        double calcValue=0;
        String functionName = getSignature().getName().getLocalName();
       
        Sequence seqA = args[0].convertTo(Type.DOUBLE);
        NumericValue valueA = (NumericValue)seqA.itemAt(0).convertTo(Type.DOUBLE);
       
        Sequence seqB = args[1].convertTo(Type.DOUBLE);
        NumericValue valueB = (NumericValue)seqB.itemAt(0).convertTo(Type.DOUBLE);
       
        if("atan2".equals(functionName)) {
View Full Code Here

       
        Sequence seqA = args[0].convertTo(Type.DOUBLE);
        NumericValue valueA = (NumericValue)seqA.itemAt(0).convertTo(Type.DOUBLE);
       
        Sequence seqB = args[1].convertTo(Type.DOUBLE);
        NumericValue valueB = (NumericValue)seqB.itemAt(0).convertTo(Type.DOUBLE);
       
        if("atan2".equals(functionName)) {
            calcValue = Math.atan2(valueA.getDouble(), valueB.getDouble());
           
        } else if("power".equals(functionName)) {
View Full Code Here

            compiled = xquery.compile(context, GET_CURRENT_REV_SOURCE);
        try {
            Sequence s = xquery.execute(compiled, Sequence.EMPTY_SEQUENCE);
            if (s.isEmpty())
                return 0;
            IntegerValue iv = (IntegerValue) s.itemAt(0);
            return iv.getLong();
        } finally {
            pool.returnCompiledXQuery(GET_CURRENT_REV_SOURCE, compiled);
        }
    }
View Full Code Here

        try {
            Sequence s = xquery.execute(compiled, Sequence.EMPTY_SEQUENCE);
            if (s.isEmpty())
                return 0;

            IntegerValue iv = (IntegerValue) s.itemAt(0);
            return iv.getLong();
        } finally {
            pool.returnCompiledXQuery(GET_BASE_REV_FOR_KEY_SOURCE, compiled);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.