1 17 18 package org.objectweb.jac.aspects.gui; 19 20 public class SortCriteria { 21 int column; 22 boolean ascending; 23 public SortCriteria(int column, boolean ascending) { 24 this.column = column; 25 this.ascending = ascending; 26 } 27 public int getColumn() { 28 return column; 29 } 30 public boolean isAscending() { 31 return ascending; 32 } 33 public void toggleAscending() { 34 ascending = !ascending; 35 } 36 37 public String toString() { 38 return (ascending?"":"-")+column; 39 } 40 41 public boolean equals(Object o) { 42 if (!(o instanceof SortCriteria)) 43 return false; 44 SortCriteria criteria = (SortCriteria)o; 45 return criteria.column==column && criteria.ascending==ascending; 46 } 47 48 public int hashCode() { 49 return column ^ (ascending ? 0 : 2^31); 50 } 51 } 52 | Popular Tags |