@Test public void testSimpleTelephoneNumbers() { String tel1 = "01 02 03 04 05"; String tel2 = "01 02 03 04 05"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "0102030405"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); }
public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 );  }