Package org.exist.xquery.value

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


    }
   
    if (result.getItemCount() != 1)
      throw new XPathException("only one value for param posible.");//TODO: error?
   
    return result.convertTo(Type.UNTYPED_ATOMIC);
  }

  /* (non-Javadoc)
     * @see org.exist.xquery.Expression#dump(org.exist.xquery.util.ExpressionDumper)
     */
 
View Full Code Here


      Variable var = getXSLContext().resolveVariable(name);
     
      Sequence result = var.getValue();
     
      if (as != null)
        return result.convertTo(Type.getType(as));
     
      return result;
     
    } else if (select != null) {
      Sequence result = select.eval(contextSequence, contextItem);
View Full Code Here

     
    } else if (select != null) {
      Sequence result = select.eval(contextSequence, contextItem);
     
      if (as != null)
        result = result.convertTo(Type.getType(as));
     
      context.declareVariable(getName(), result);
      return result;
    }
    throw new XPathException("param can't calculated");//TODO: error?
View Full Code Here

           
            if(arg.isEmpty()) {
                result = DoubleValue.NaN;
            } else {
                try {
                    result = arg.convertTo(Type.DOUBLE);
                } catch(final XPathException e) {
                    result = DoubleValue.NaN;
                }
            }
        } else {
View Full Code Here

           
            if(arg.isEmpty()) {
                result = Sequence.EMPTY_SEQUENCE;
            } else {
                try {
                    result = arg.convertTo(Type.DOUBLE);
                } catch(final XPathException e) {
                    result = DoubleValue.NaN;
                }
            }
        }
View Full Code Here

        }
        Sequence result = new DateTimeValue(context.getCalendar());
        if (isCalledAs("current-dateTime")) {
            // do nothing, result already in right form
        } else if (isCalledAs("current-date")) {
            result = result.convertTo(Type.DATE);
        } else if (isCalledAs("current-time")) {
            result = result.convertTo(Type.TIME);
        } else {
            throw new Error("Can't handle function " + mySignature.getName().getLocalName());
        }
View Full Code Here

        if (isCalledAs("current-dateTime")) {
            // do nothing, result already in right form
        } else if (isCalledAs("current-date")) {
            result = result.convertTo(Type.DATE);
        } else if (isCalledAs("current-time")) {
            result = result.convertTo(Type.TIME);
        } else {
            throw new Error("Can't handle function " + mySignature.getName().getLocalName());
        }
        if (context.getProfiler().isEnabled()) {context.getProfiler().end(this, "", result);}
        return result;
View Full Code Here

      final Sequence thresOpt = getArgument(2).eval(nodes);
      //TODO : get rid of getLength()
      if(!thresOpt.hasOne())
        {throw new XPathException(this, "third argument to " + getName() +
            "should be a single double value");}
      threshold = ((DoubleValue) thresOpt.convertTo(Type.DOUBLE)).getDouble();
    }
    final NodeSet hits[] = new NodeSet[terms.size()];
    String term;
    TermMatcher matcher;
    for (int k = 0; k < terms.size(); k++) {
View Full Code Here

    Sequence result = new DateTimeValue( new Date() );
   
    if( isCalledAs("system-dateTime" ) ) {
      // do nothing, result already in right form
    } else if( isCalledAs("system-date" ) ) {
      result = result.convertTo( Type.DATE );
    } else if( isCalledAs("system-time" ) ) {
      result = result.convertTo( Type.TIME );
    } else {
      throw( new Error( "can't handle function " + mySignature.getName().getLocalName() ) );
    }
View Full Code Here

    if( isCalledAs("system-dateTime" ) ) {
      // do nothing, result already in right form
    } else if( isCalledAs("system-date" ) ) {
      result = result.convertTo( Type.DATE );
    } else if( isCalledAs("system-time" ) ) {
      result = result.convertTo( Type.TIME );
    } else {
      throw( new Error( "can't handle function " + mySignature.getName().getLocalName() ) );
    }

    if( context.getProfiler().isEnabled() ) {
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.