Package net.sf.saxon.value

Examples of net.sf.saxon.value.Value


    public TailCall processLeavingTail(XPathContext context) throws XPathException {
        if (binding==null) {
            throw new IllegalStateException("saxon:assign binding has not been fixed up");
        }
        Value value = getSelectValue(context);
        if (value instanceof Closure) {
            value = new SequenceExtent(value.iterate(null));
        }
        if (binding.isGlobal()) {
            context.getController().getBindery().assignGlobalVariable((GlobalVariable)binding, value);
        } else {
            context.setLocalVariable(binding.getSlotNumber(), value);
View Full Code Here


    public boolean useGlobalParameter(int fingerprint, GlobalParam binding) throws XPathException {
        if (globalParameters==null) {
            return false;
        }
        Value val = globalParameters.get(fingerprint);
        if (val==null) {
            return false;
        }
        ItemType reqItemType = binding.getRequiredType().getPrimaryType();
        if (val instanceof AtomicValue && reqItemType instanceof AtomicType) {
            // If the parameter is an atomic value, typically a string supplied on
            // the command line, we attempt to convert it to the required type. This
            // will not always succeed.
            val = ((AtomicValue)val).convert((AtomicType)reqItemType, null);
        } else {
            // For any other parameter value, we verify that if conforms to the
            // required type. This must be precise conformance, we don't attempt to
            // do atomization or to convert untypedAtomic values

            if (!Type.isSubType(val.getItemType(), reqItemType)) {
                DynamicError err = new DynamicError (
                        "Global parameter requires type " + reqItemType +
                        "; supplied value has type " + val.getItemType());
                err.setIsTypeError(true);
                throw err;
            }
            int reqCardinality = binding.getRequiredType().getCardinality();
            if (!Cardinality.subsumes(reqCardinality, val.getCardinality())) {
                DynamicError err = new DynamicError (
                        "Supplied value of external parameter does not match the required cardinality");
                err.setIsTypeError(true);
                throw err;
            }
View Full Code Here

            throws XPathException {

        // If this is a memo function, see if the result is already known
        Controller controller = context.getController();
        if (memoFunction) {
            Value value = getCachedValue(controller, actualArgs);
            if (value != null) return value;
        }

        // Otherwise evaluate the function

        context.setStackFrame(getStackFrameMap(), actualArgs);
        Value result;
        try {
            result = ExpressionTool.eagerEvaluate(getBody(), context);
            //TODO: lazy evaluation currently doesn't work here. (E.g. tour.xq). Find out why not.
            // -- what happens is that evaluation of an operand to an arithmetic expression finds itself
            // handed a UserFunctionCall.FunctionCallPackage, which it doesn't know what to do with.
View Full Code Here

    private static String getCombinedKey(Value[] params) throws XPathException {
        StringBuffer sb = new StringBuffer(120);

        for (int i = 0; i < params.length; i++) {
            Value val = params[i];
            SequenceIterator iter = val.iterate(null);
            while (true) {
                Item item = iter.next();
                if (item == null) {
                    break;
                }
View Full Code Here

            return o;
        }
        if (o instanceof Item) {
            return o;
        }
        Value value = (Value)tuple.getObject();
        return value.iterate(context);
    }
View Full Code Here

                                     LocalParam binding,
                                     boolean isTunnel) throws XPathException {

        ParameterSet params = (isTunnel ? tunnelParameters : localParameters);
      if (params==null) return false;
      Value val = params.get(fingerprint);
        stackFrame.slots[binding.getSlotNumber()] = val;
        return (val != null);
    }
View Full Code Here

    /**
    * Iterate over the sequence of values
    */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        Value val = eval(context);
        context.setLocalVariable(slotNumber, val);
        return action.iterate(context);
    }
View Full Code Here

    /**
    * Evaluate the expression as a singleton
    */

    public Item evaluateItem(XPathContext context) throws XPathException {
        Value val = eval(context);
        if (val==null) {
            // this shouldn't happen but is inserted as a trap for the unresolved
            // problem reported by Gunther Schadow, see
            // https://sourceforge.net/forum/forum.php?thread_id=897476&forum_id=94027
            System.err.println("Invalid null value from lazyEvaluate() in LetExpression");
View Full Code Here

     * Process this expression as an instruction, writing results to the current
     * outputter
     */

    public void process(XPathContext context) throws XPathException {
        Value val = eval(context);
        context.setLocalVariable(slotNumber, val);
        action.process(context);
    }
View Full Code Here

    public Value evaluateVariable(XPathContext context) throws XPathException {
        Controller controller = context.getController();
        Bindery b = controller.getBindery();

        Value v = b.getGlobalVariableValue(this);

        if (v != null) {
            return v;
        } else {

            // This is the first reference to a global variable; try to evaluate it now.
            // But first set a flag to stop looping. This flag is set in the Bindery because
            // the VariableReference itself can be used by multiple threads simultaneously

            try {
                b.setExecuting(this, true);
                //XPathContext c2 = controller.setGlobalContext();
                Value value = getSelectValue(context);
                b.defineGlobalVariable(this, value);
                b.setExecuting(this, false);
                return value;

            } catch (XPathException err) {
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.Value

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.