Examples of ByteArrayComparator


Examples of com.fasterxml.sort.std.ByteArrayComparator

public class TestByteArrayComparator
    extends SortTestBase
{
    public void testSimple()
    {
        ByteArrayComparator cmp = new ByteArrayComparator();
        // simple equality
        assertEquals(0, cmp.compare(new byte[] { }, new byte[] { }));
        assertEquals(0, cmp.compare(new byte[] { 1, 2 }, new byte[] { 1, 2 }));

        // longer vs shorter
        assertEquals(-1, cmp.compare(new byte[] { 1, 2 }, new byte[] { 1, 2, 3}));
        assertEquals(1, cmp.compare(new byte[] { 1, 2, 3 }, new byte[] { 1, 2 }));

        // then comparisons with normal signed values
        assertEquals(1, cmp.compare(new byte[] { 1, 2 }, new byte[] { 1, 1 }));
        assertEquals(-1, cmp.compare(new byte[] { 1, 1 }, new byte[] { 1, 2 }));

        // and finally ensure that we ignore "signed-ness" of bytes
        assertTrue(cmp.compare(new byte[] { 1, (byte) 0xFF }, new byte[] { 1, 1 }) > 0);
        assertTrue(cmp.compare(new byte[] { 1, 1 }, new byte[] { 1, (byte) 0xFF }) < 0);
    }
View Full Code Here

Examples of jdbm.helper.ByteArrayComparator



        recman = RecordManagerFactory.createRecordManager( "test" );

        tree = BTree.createInstance( recman, new ByteArrayComparator() );



        tree.insert( test1, value1, false );
View Full Code Here

Examples of jdbm.helper.ByteArrayComparator



        recman = RecordManagerFactory.createRecordManager( "test" );

        tree = BTree.createInstance( recman, new ByteArrayComparator() );



        tree.insert( test1, value1, false);
View Full Code Here

Examples of jdbm.helper.ByteArrayComparator



        recman = RecordManagerFactory.createRecordManager( "test" );

        tree = BTree.createInstance( recman, new ByteArrayComparator() );



        tree.insert( test1, value1, false );
View Full Code Here

Examples of org.apache.accumulo.core.util.ByteArrayComparator

    // add a leaf state (shared)
    objectTree.add((byte) 0x0);
    objectTree.add((byte) 0x1);
   
    // create a sorted set of the byte[] values
    SortedSet<byte[]> sortedValues = new TreeSet<byte[]>(new ByteArrayComparator());
   
    sortedValues.addAll(values);
   
    // create the arraylist representation of the trie
    create(sortedValues, 1);
View Full Code Here

Examples of org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator

                    return comparator
                        .compare( getNormReference(), binaryValue.getNormReference() );
                }
                else
                {
                    return new ByteArrayComparator( null ).compare( getNormReference(), binaryValue
                        .getNormReference() );
                }
            }
            catch ( LdapException e )
            {
                String msg = I18n.err( I18n.ERR_04443, Arrays.toString( getReference() ), value );
                LOG.error( msg, e );
                throw new IllegalStateException( msg, e );
            }
        }
        else
        {
            return new ByteArrayComparator( null ).compare( getNormValue(), binaryValue.getNormValue() );
        }
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator

        s = EntryUtils.syntaxFactory( "1.1.1.1", false );
        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );

        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
                if ( !value.isHumanReadable() )
View Full Code Here

Examples of org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator

        s = EntryUtils.syntaxFactory( "1.1.1.1", false );
        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );

        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
                if ( !value.isHumanReadable() )
View Full Code Here

Examples of org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator

        sb = new EntryUtils.S( "1.1.1.1", false );
        sb.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mrb = new EntryUtils.MR( "1.1.2.1" );
        mrb.setSyntax( sb );

        mrb.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mrb.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
                if ( !value.isHumanReadable() )
View Full Code Here

Examples of org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator

        } );

        MutableMatchingRule matchingRule = new MutableMatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );

        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
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.