Package org.apache.xerces.impl.dv.xs

Examples of org.apache.xerces.impl.dv.xs.TypeValidator


class DataMatcher {

    public static boolean compareActualValues(Object value1, Object value2, int comparator,
            XSSimpleTypeDecl type) {

        TypeValidator typeValidator = type.getTypeValidator();
        short ordered = type.getOrdered();

        if (ordered == XSSimpleTypeDecl.ORDERED_FALSE) {
            //if the type is not ordered then only equality can be tested
            //delegate the test to the type
            if (comparator == CompNode.EQ) {
                return type.isEqual(value1, value2);
            }
            else if (comparator == CompNode.NE) {
                return !type.isEqual(value1, value2);
            }
            else {
                //only equality can be tested upon unordered types
                return false;
            }
        }

        //if the type is ordered then the corresponding TypeValidator should
        //know how to compare the values
        switch (comparator) {

        case CompNode.EQ: return typeValidator.compare(value1, value2) == 0;
        case CompNode.NE: return typeValidator.compare(value1, value2) != 0;
        case CompNode.GT: return typeValidator.compare(value1, value2) > 0;
        case CompNode.GE: return typeValidator.compare(value1, value2) >= 0;
        case CompNode.LT: return typeValidator.compare(value1, value2) < 0;
        case CompNode.LE: return typeValidator.compare(value1, value2) <= 0;
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.xerces.impl.dv.xs.TypeValidator

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.