Package client.net.sf.saxon.ce.value

Examples of client.net.sf.saxon.ce.value.Value


     */

    private void preEvaluateCollation(StaticContext env) throws XPathException {
        if (getNumberOfArguments() == getDetails().maxArguments) {
            final Expression collationExp = argument[getNumberOfArguments() - 1];
            final Value collationVal = (collationExp instanceof Literal ? ((Literal)collationExp).getValue() : null);
            if (collationVal instanceof AtomicValue) {
                // Collation is supplied as a constant
                String collationName = collationVal.getStringValue();
                URI collationURI;
                try {
                    collationURI = new URI(collationName, true);
                    if (!collationURI.isAbsolute()) {
                        saveBaseURI(env, true);
View Full Code Here


        operand0 = visitor.typeCheck(operand0, contextItemType);
        operand1 = visitor.typeCheck(operand1, contextItemType);
        // if both operands are known, pre-evaluate the expression
        try {
            if ((operand0 instanceof Literal) && (operand1 instanceof Literal)) {
                Value v = Value.asValue(evaluateItem(visitor.getStaticContext().makeEarlyEvaluationContext()));
                return Literal.makeLiteral(v);
            }
        } catch (XPathException err) {
            // if early evaluation fails, suppress the error: the value might
            // not be needed at run-time
View Full Code Here

        operand0 = visitor.optimize(operand0, contextItemType);
        operand1 = visitor.optimize(operand1, contextItemType);
        // if both operands are known, pre-evaluate the expression
        try {
            if ((operand0 instanceof Literal) && (operand1 instanceof Literal)) {
                Value v = Value.asValue(evaluateItem(visitor.getStaticContext().makeEarlyEvaluationContext()));
                return Literal.makeLiteral(v);
            }
        } catch (XPathException err) {
            // if early evaluation fails, suppress the error: the value might
            // not be needed at run-time
View Full Code Here

     */

    public Expression simplify(ExpressionVisitor visitor) throws XPathException {
        operand = visitor.simplify(operand);
        if (operand instanceof Literal) {
            Value val = ((Literal)operand).getValue();
            if (val instanceof AtomicValue) {
                return operand;
            }
            SequenceIterator iter = val.iterate();
            while (true) {
                // if all items in the sequence are atomic (they generally will be, since this is
                // done at compile time), then return the sequence
                Item i = iter.next();
                if (i == null) {
View Full Code Here

    public void fixupReferences() throws XPathException {
        final SequenceType type = getRequiredType();
        final TypeHierarchy th = getConfiguration().getTypeHierarchy();
        final Iterator iter = references.iterator();
        while (iter.hasNext()) {
            Value constantValue = null;
            int properties = 0;
            if (this instanceof XSLVariable) {
                if (select instanceof Literal) {
                    // we can't rely on the constant value because it hasn't yet been type-checked,
                    // which could change it (eg by numeric promotion). Rather than attempt all the type-checking
View Full Code Here

    public Item evaluateItem(XPathContext context) throws XPathException {
        SequenceIterator forwards = operand.iterate(context);
        if ((forwards.getProperties() & SequenceIterator.GROUNDED) != 0) {
            ValueRepresentation repr = ((GroundedIterator)forwards).materialize();
            Value val = Value.asValue(repr);
            int length = val.getLength();
            return val.itemAt(length - 1);
        } else {
            Item current = null;
            while (true) {
                Item item = forwards.next();
                if (item == null) {
View Full Code Here

        return last != null && last.markTailCalls();
    }

    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        if (test instanceof Literal) {
            Value testVal = ((Literal)test).getValue();
            // condition known statically, so we only need compile the code if true.
            // This can happen with expressions such as test="function-available('abc')".
            try {
                if (testVal.effectiveBooleanValue()) {
                    return compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));
//                    Block block = new Block();
//                    block.setLocationId(allocateLocationId(getSystemId(), getLineNumber()));
//                    compileChildren(exec, block, true);
//                    return block.simplify(getStaticContext());
View Full Code Here

    /*@NotNull*/
    public SequenceIterator iterate(XPathContext context) throws XPathException {
        if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
            String label = argument[1].evaluateAsString(context).toString();
            int evalMode = ExpressionTool.eagerEvaluationMode(argument[0]); // eagerEvaluate not implemented in CE
            Value value = Value.asValue(ExpressionTool.evaluate(argument[0], evalMode, context, 10));
            notifyListener(label, value, context);
            return value.iterate();
        } else {
            if (!LogConfiguration.loggingIsEnabled()) {
                return argument[0].iterate(context);
            } else {
                return new TracingIterator(argument[0].iterate(context),
View Full Code Here

     */
    public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException {

        if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
            String label = arguments[1].next().getStringValue();
            Value value = Value.asValue(SequenceExtent.makeSequenceExtent(arguments[0]));
            notifyListener(label, value, context);
            return value.iterate();
        } else {

            if (!LogConfiguration.loggingIsEnabled()) {
                return argument[0].iterate(context);
            } else {
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.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.