@ Override public int compare ( AVA a1 , AVA a2 ) { boolean a1Has2253 = a1 . hasRFC2253Keyword ( ) ; boolean a2Has2253 = a2 . hasRFC2253Keyword ( ) ; if ( a1Has2253 ) { if ( a2Has2253 ) { return a1 . toRFC2253CanonicalString ( ) . compareTo ( a2 . toRFC2253CanonicalString ( ) ) ; } else { return - 1 ; } } else { if ( a2Has2253 ) { return 1 ; } else { int [ ] a1Oid = a1 . getObjectIdentifier ( ) . toIntArray ( ) ; int [ ] a2Oid = a2 . getObjectIdentifier ( ) . toIntArray ( ) ; int pos = 0 ; int len = ( a1Oid . length > a2Oid . length ) ? a2Oid . length : a1Oid . length ; while ( pos < len && a1Oid [ pos ] == a2Oid [ pos ] ) { ++ pos ; } return ( pos == len ) ? a1Oid . length - a2Oid . length : a1Oid [ pos ] - a2Oid [ pos ] ; } } }
AVA s containing a standard keyword are ordered alphabetically followed by AVA s containing an OID keyword ordered numerically