1 26 27 package org.objectweb.openccm.ast.lib; 28 29 30 import org.objectweb.openccm.ast.api.Declaration; 31 32 33 42 43 public class DependencyComparator 44 implements java.util.Comparator 45 { 46 52 58 61 public 62 DependencyComparator() 63 { 64 } 65 66 72 75 public int 76 compare(java.lang.Object o1, 77 java.lang.Object o2) 78 { 79 Declaration decl1 = (Declaration)o1; 80 Declaration decl2 = (Declaration)o2; 81 82 Declaration[] depend = decl1.getDependencies(); 83 for (int i=0;i<depend.length;i++) 84 { 85 if (depend[i]==o2) 86 return 1; 87 } 88 89 depend = decl2.getDependencies(); 90 for (int i=0;i<depend.length;i++) 91 { 92 if (depend[i]==o1) 93 return -1; 94 } 95 96 return 0; 97 } 98 99 102 public boolean 103 equals(java.lang.Object o) 104 { 105 return (o==this); 106 } 107 } 108 | Popular Tags |