Package java.util

Examples of java.util.Comparator.compare()


        Object[] tree = heap.m_elements;
        for (int i = 1; i <= heap.m_size; i++) {
            Object parent = tree[i];
            if (i * 2 <= heap.m_size) {
                assertTrue("Parent is less than or equal to its left child", c.compare(parent, tree[i * 2]) <= 0);
            }
            if (i * 2 + 1 < heap.m_size) {
                assertTrue("Parent is less than or equal to its right child", c.compare(parent, tree[i * 2 + 1]) <= 0);
            }
        }
View Full Code Here


            Object parent = tree[i];
            if (i * 2 <= heap.m_size) {
                assertTrue("Parent is less than or equal to its left child", c.compare(parent, tree[i * 2]) <= 0);
            }
            if (i * 2 + 1 < heap.m_size) {
                assertTrue("Parent is less than or equal to its right child", c.compare(parent, tree[i * 2 + 1]) <= 0);
            }
        }
    }

    //----------------------------------------------------------------------- 
View Full Code Here

            for ( Value<?> value : attr )
            {
                Object normValue = normalizer.normalize( value );

                // Found a value that is greater than or equal to the ava value
                if ( comparator.compare( normValue, filterValue ) >= 0 )
                {
                    return true;
                }
            }
        }
View Full Code Here

            for ( Value<?> value : attr )
            {
                Object normValue = normalizer.normalize( value );

                // Found a value that is less than or equal to the ava value
                if ( comparator.compare( normValue, filterValue ) <= 0 )
                {
                    return true;
                }
            }
        }
View Full Code Here

         */
        for ( Value<?> val : attr )
        {
            Value<?> normValue = normalizer.normalize( val );

            if ( 0 == comparator.compare( normValue.getValue(), filterValue.getValue() ) )
            {
                return true;
            }
        }

View Full Code Here

            Comparator typeComparator = (Comparator) typeComparators.get(leftJahiaObject.getObjectKey().getType());
            if (typeComparator == null) {
                logger.warn("No comparator found for type : " + leftJahiaObject.getObjectKey().getType() + ", returning equal in comparison.");
                return 0;
            }
            return typeComparator.compare(o1, o2);
        } else {
            // these comparators should only be used with subclasses of JahiaObject,
            // never with anything else
            if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) {
                Comparable leftComparable = (Comparable) o1;
View Full Code Here

        }
        Iterator comparatorIter = orderedComparators.iterator();
        int curCompareResult = 0;
        while (comparatorIter.hasNext()) {
            Comparator curComparator = (Comparator) comparatorIter.next();
            curCompareResult = curComparator.compare(o1, o2);
            if (curCompareResult != 0) {
                return curCompareResult;
            }
        }
        return curCompareResult;
View Full Code Here

            {
               equals = output != null ? output.equals(expected) : expected == null;
            }
            else
            {
               equals = c.compare(output, expected) == 0;
            }
            assertTrue("Transform of "+input+" equals "+expected+", output="+output, equals);
              
            String expectedStringOutput = expectedStringData[t][i];
            String stringOutput = editor.getAsText();
View Full Code Here

            for ( Value<?> value : attr )
            {
                Object normValue = normalizer.normalize( value );

                // Found a value that is greater than or equal to the ava value
                if ( 0 >= comparator.compare( normValue, filterValue ) )
                {
                    return true;
                }
            }
        }
View Full Code Here

            for ( Value<?> value : attr )
            {
                Object normValue = normalizer.normalize( value );

                // Found a value that is less than or equal to the ava value
                if ( 0 <= comparator.compare( normValue, filterValue ) )
                {
                    return true;
                }
            }
        }
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.