@Test public void testBigIntegerValues() { assertEquals( -1, comparator.compare( null, "1000000000000000000000000" ) ); assertEquals( 1, comparator.compare( "1000000000000000000000000", null ) ); assertEquals( 0, comparator.compare( "1000000000000000000000000", "1000000000000000000000000" ) ); long t0 = System.currentTimeMillis(); for ( int i = 0; i < 10000000; i++ ) { assertEquals( -1, comparator.compare( "9223372036854775805", "9223372036854775806" ) ); } long t1 = System.currentTimeMillis(); System.out.println( "Delta = " + ( t1 - t0 ) ); assertEquals( 1, comparator.compare( "1000000000000000000000001", "1000000000000000000000000" ) ); }
@Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( String ) v2 ); } else if ( v1 instanceof Value ) { return compare( ( ( Value ) v1 ).getString(), ( ( Value ) v2 ).getString() ); } else { return Long.compare( ( Long ) v1, ( Long ) v2 ); } }
IntegerComparator extends LdapComparator<Object> implements Serializable { @Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( String ) v2 ); } else if ( v1 instanceof Value ) { return compare( ( ( Value ) v1 ).getString(), ( ( Value ) v2 ).getString() ); } else { return Long.compare( ( Long ) v1, ( Long ) v2 ); } } }
IntegerComparator extends LdapComparator<Object> implements Serializable { @Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( String ) v2 ); } else if ( v1 instanceof Value ) { return compare( ( ( Value ) v1 ).getString(), ( ( Value ) v2 ).getString() ); } else { return Long.compare( ( Long ) v1, ( Long ) v2 ); } } IntegerComparator( String oid ); }
IntegerComparator extends LdapComparator<Object> implements Serializable { @Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( String ) v2 ); } else if ( v1 instanceof Value ) { return compare( ( ( Value ) v1 ).getString(), ( ( Value ) v2 ).getString() ); } else { return Long.compare( ( Long ) v1, ( Long ) v2 ); } } IntegerComparator( String oid ); @Override int compare( Object v1, Object v2 ); }
IntegerComparator extends LdapComparator<Object> implements Serializable { @Override public int compare( Object v1, Object v2 ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } else { return -1; } } else if ( v2 == null ) { return 1; } if ( v1 instanceof String ) { return compare( ( String ) v1, ( String ) v2 ); } else if ( v1 instanceof Value ) { return compare( ( ( Value ) v1 ).getString(), ( ( Value ) v2 ).getString() ); } else { return Long.compare( ( Long ) v1, ( Long ) v2 ); } } IntegerComparator( String oid ); @Override int compare( Object v1, Object v2 );  }