Package net.sf.saxon.sort

Examples of net.sf.saxon.sort.AtomicComparer


    /**
    * Evaluate the function to return an iteration of selected values or nodes.
    */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        AtomicComparer comp = atomicComparer;
        if (comp == null) {
            int type = argument[0].getItemType(context.getConfiguration().getTypeHierarchy()).getPrimitiveType();
            comp = makeAtomicSortComparer(type, context);
        } else {
            comp = comp.provideContext(context);
        }
        SequenceIterator iter = argument[0].iterate(context);
        return new DistinctIterator(iter, comp);
    }
View Full Code Here


        //AtomicComparer comparer = getAtomicComparer(1, context);
        BuiltInAtomicType type = argumentType;
        if (type == BuiltInAtomicType.UNTYPED_ATOMIC) {
            type = BuiltInAtomicType.DOUBLE;
        }
        AtomicComparer comparer =
                GenericAtomicComparer.makeAtomicComparer(type, type, collator, context);
        SequenceIterator iter = argument[0].iterate(context);
        try {
            return minimax(iter, operation, comparer, ignoreNaN, context);
        } catch (XPathException err) {
View Full Code Here

                sortKey.expression = new Atomizer(key);
            }

            SortKeyDefinition sk = new SortKeyDefinition();
            sk.setSortKey(sortKey.expression);
            AtomicComparer comp = sk.makeComparator(context);
            AtomicComparer[] comps = {comp};

            iterator = new SortedIterator(context, iterator, this, comps);
            ((SortedIterator)iterator).setHostLanguage(Configuration.XPATH);
        }
View Full Code Here

            throw new IllegalArgumentException("Other Node must be a Saxon NodeInfo");
        }
        return DeepEqual.deepEquals(
                SingletonIterator.makeIterator(this),
                SingletonIterator.makeIterator((NodeInfo)arg),
                new AtomicComparer(CodepointCollator.getInstance()),
                getDocumentRoot().getConfiguration());
    }
View Full Code Here

    /**
    * Evaluate the function to return an iteration of selected nodes.
    */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        AtomicComparer comparer = getAtomicComparer(2, context);
        SequenceIterator seq = argument[0].iterate(context);
        AtomicValue val = (AtomicValue)argument[1].evaluateItem(context);
        return new IndexIterator(seq, val, comparer);
    }
View Full Code Here

    * If this argument was not supplied, the default collation is used
    * @param context The dynamic evaluation context.
    */

    protected AtomicComparer getAtomicComparer(int arg, XPathContext context) throws XPathException {
        return new AtomicComparer(getCollator(arg, context, true));
    }
View Full Code Here

    /**
    * Evaluate the expression
    */

    public Item evaluateItem(XPathContext context) throws XPathException {
        AtomicComparer collator = getAtomicComparer(2, context);

        SequenceIterator op1 = argument[0].iterate(context);
        SequenceIterator op2 = argument[1].iterate(context);

        Configuration config =
View Full Code Here

        if (arg1==null) {
            return null;
        }
        arg1 = arg1.getPrimitiveValue();

        AtomicComparer collator = getAtomicComparer(2, context);

        int result = collator.compare(arg0, arg1);
        if (result < 0) {
            return IntegerValue.MINUS_ONE;
        } else if (result > 0) {
            return IntegerValue.PLUS_ONE;
        } else {
View Full Code Here

            return vc.simplify(env).analyze(env, contextItemType);
        }

        Comparator comp = env.getCollation(env.getDefaultCollationName());
        if (comp==null) comp = CodepointCollator.getInstance();
        comparer = new AtomicComparer(comp);

        // Check if neither argument allows a sequence of >1

        if (!Cardinality.allowsMany(c0) && !Cardinality.allowsMany(c1)) {
View Full Code Here

    public void setComparator(Comparator comp) {
        if (comp instanceof AtomicComparer) {
            comparer = (AtomicComparer)comp;
        } else {
            comparer = new AtomicComparer(comp);
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.sort.AtomicComparer

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.