1 20 21 package org.apache.directory.ldapstudio.schemas.view.views.wrappers; 22 23 24 import java.util.Comparator ; 25 26 import org.apache.directory.ldapstudio.schemas.model.AttributeType; 27 import org.apache.directory.ldapstudio.schemas.model.ObjectClass; 28 29 30 33 public class OidSorter implements Comparator <ITreeNode> 34 { 35 38 public int compare( ITreeNode o1, ITreeNode o2 ) 39 { 40 if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper ) ) 41 { 42 AttributeType at1 = ( ( AttributeTypeWrapper ) o1 ).getMyAttributeType(); 43 AttributeType at2 = ( ( AttributeTypeWrapper ) o2 ).getMyAttributeType(); 44 45 return at1.getOid().compareToIgnoreCase( at2.getOid() ); 46 } 47 else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof ObjectClassWrapper ) ) 48 { 49 ObjectClass oc1 = ( ( ObjectClassWrapper ) o1 ).getMyObjectClass(); 50 ObjectClass oc2 = ( ( ObjectClassWrapper ) o2 ).getMyObjectClass(); 51 52 return oc1.getOid().compareToIgnoreCase( oc2.getOid() ); 53 } 54 55 return o1.toString().compareToIgnoreCase( o2.toString() ); 57 } 58 } 59 | Popular Tags |