1 18 package org.apache.beehive.netui.databinding.datagrid.api.sort; 19 20 30 public class SortDirection 31 implements java.io.Serializable { 32 33 36 public static final int INT_ASCENDING = 0; 37 38 41 public static final int INT_DESCENDING = 1; 42 43 46 public static final int INT_NONE = 2; 47 48 51 public static final SortDirection ASCENDING = new SortDirection(INT_ASCENDING); 52 53 56 public static final SortDirection DESCENDING = new SortDirection(INT_DESCENDING); 57 58 61 public static final SortDirection NONE = new SortDirection(INT_NONE); 62 63 private int _val; 64 65 private SortDirection(int val) { 66 _val = val; 67 } 68 69 74 public String toString() { 75 switch(_val) { 76 case INT_ASCENDING: 77 return "ASCENDING"; 78 case INT_DESCENDING: 79 return "DESCENDING"; 80 case INT_NONE: 81 return "NONE"; 82 } 83 84 String message = "Encountered an unknown sort direction with value \"" + _val + "\""; 85 assert false : message; 86 throw new IllegalStateException (message); 87 } 88 89 94 public boolean equals(Object value) { 95 if(value == this) 96 return true; 97 if(value == null || !(value instanceof SortDirection)) 98 return false; 99 100 return ((SortDirection)value)._val == _val; 101 } 102 103 107 public int hashCode() { 108 return _val; 109 } 110 111 116 public int getValue() { 117 return _val; 118 } 119 } 120 | Popular Tags |