Package org.apache.directory.mavibot.btree.comparator

Examples of org.apache.directory.mavibot.btree.comparator.LongArrayComparator


    /**
     * Create a new instance of LongSerializer
     */
    public LongArraySerializer()
    {
        super( new LongArrayComparator() );
    }
View Full Code Here


    /**
     * Create a new instance of LongSerializer
     */
    public LongArraySerializer()
    {
        comparator = new LongArrayComparator();
    }
View Full Code Here

public class LongArrayComparatorTest
{
    @Test
    public void testLongArrayComparator()
    {
        LongArrayComparator comparator = new LongArrayComparator();

        // Check equality
        assertEquals( 0, comparator.compare( null, null ) );
        assertEquals( 0, comparator.compare( new long[]
            {}, new long[]
            {} ) );
        assertEquals( 0, comparator.compare( new long[]
            { 1L, 2L }, new long[]
            { 1L, 2L } ) );

        // The first long[] is > the second
        assertEquals( 1, comparator.compare( new long[]
            {}, null ) );
        assertEquals( 1, comparator.compare( new long[]
            { 1L }, null ) );
        assertEquals( 1, comparator.compare( new long[]
            { 1L, 2L }, new long[]
            { 1L, 1L } ) );
        assertEquals( 1, comparator.compare( new long[]
            { 1L, 2L, 1L }, new long[]
            { 1L, 2L } ) );
        assertEquals( 1, comparator.compare( new long[]
            { 1L, 2L }, new long[]
            { 1L, 1L, 2L } ) );

        // The first long[] is < the second
        assertEquals( -1, comparator.compare( null, new long[]
            {} ) );
        assertEquals( -1, comparator.compare( null, new long[]
            { 1L, 2L } ) );
        assertEquals( -1, comparator.compare( null, new long[]
            { -1L, 2L } ) );
        assertEquals( -1, comparator.compare( new long[]
            {}, new long[]
            { 1L, 2L } ) );
        assertEquals( -1, comparator.compare( new long[]
            {}, new long[]
            { -1L, 2L } ) );
        assertEquals( -1, comparator.compare( new long[]
            { -1L, 1L }, new long[]
            { 1L, 1L, 2L } ) );
        long[] array = new long[3];
        array[0] = 1L;
        array[1] = 2L;
        assertEquals( -1, comparator.compare( new long[]
            { 1L, 2L }, array ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.mavibot.btree.comparator.LongArrayComparator

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.