1 package spoon.support.reflect; 2 3 import java.util.Comparator ; 4 5 import spoon.reflect.declaration.CtElement; 6 7 11 public class CtLineElementComparator implements Comparator <CtElement> { 12 13 16 public int compare(CtElement o1, CtElement o2) { 17 if (o1.getPosition() == null) 18 return 1; 19 if (o2.getPosition() == null) 20 return -1; 21 if (o1.getPosition().getLine() == o2.getPosition().getLine()) { 22 return ((Integer )o1.getPosition().getColumn()).compareTo(o2.getPosition().getColumn()); 23 } 24 return ((Integer )o1.getPosition().getLine()).compareTo(o2 25 .getPosition().getLine()); 26 } 27 28 } 29 | Popular Tags |