Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. private String compareText;
  2.  
  3.     public BoomerangCellData(ImageIcon icon, String text, String compareText) {
  4.         super(icon, text);
  5.         this.compareText = compareText;
  6.     }
  7.  
  8.     public void setCompareText(String compareText) {
  9.         this.compareText = compareText;
  10.     }
  11.    
  12.     public String getCompareText() {
  13.         return compareText;
  14.     }
  15.    
  16.     @Override
  17.     public int compareTo(CellData o) {
  18.         BoomerangCellData data = (BoomerangCellData) o;
  19.         if (data!= null) {
  20.             if (compareText == null && data.getCompareText() == null) {
  21.                 return 0;
  22.             } else if (compareText == null) {
  23.                 return -1;
  24.             } else if (data.getCompareText() == null) {
  25.                 return 1;
  26.             } else {
  27.                 return compareText.compareTo(data.getCompareText());
  28.             }
  29.         }
  30.         return 1;
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement