1 26 27 package org.objectweb.ccm.IDL3; 28 29 38 39 public class DependencyComparator 40 implements java.util.Comparator 41 { 42 48 54 57 public 58 DependencyComparator() 59 { 60 } 61 62 68 71 public int 72 compare(java.lang.Object o1, 73 java.lang.Object o2) 74 { 75 Declaration decl1 = (Declaration)o1; 76 Declaration decl2 = (Declaration)o2; 77 78 Declaration[] depend = decl1.getDependencies(); 79 for (int i=0;i<depend.length;i++) 80 { 81 if (depend[i]==o2) 82 return 1; 83 } 84 85 depend = decl2.getDependencies(); 86 for (int i=0;i<depend.length;i++) 87 { 88 if (depend[i]==o1) 89 return -1; 90 } 91 92 return 0; 93 } 94 95 98 public boolean 99 equals(java.lang.Object o) 100 { 101 return (o==this); 102 } 103 } 104 | Popular Tags |