1 20 package org.apache.directory.ldapstudio.schemas.view.editors.attributeType; 21 22 23 import java.util.Comparator ; 24 25 import org.apache.directory.ldapstudio.schemas.model.MatchingRule; 26 27 28 34 public class ATEMatchingRulesComboComparator implements Comparator <Object > 35 { 36 39 public int compare( Object o1, Object o2 ) 40 { 41 if ( o1 instanceof MatchingRule && o2 instanceof MatchingRule ) 42 { 43 return ( ( MatchingRule ) o1 ).getName().compareToIgnoreCase( ( ( MatchingRule ) o2 ).getName() ); 44 } 45 else if ( o1 instanceof MatchingRule && o2 instanceof NonExistingMatchingRule ) 46 { 47 return ( ( MatchingRule ) o1 ).getName().compareToIgnoreCase( ( ( NonExistingMatchingRule ) o2 ).getName() ); 48 } 49 else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof MatchingRule ) 50 { 51 return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase( ( ( MatchingRule ) o2 ).getName() ); 52 } 53 else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof NonExistingMatchingRule ) 54 { 55 return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase( 56 ( ( NonExistingMatchingRule ) o2 ).getName() ); 57 } 58 59 return 0; 60 } 61 } 62 | Popular Tags |