1 26 27 package net.groboclown.util.states.v1; 28 29 30 36 public class State 37 { 38 41 42 45 46 49 50 53 54 57 58 61 private int index; 62 private int category; 63 64 65 66 69 70 73 protected State( int stateCategory, int stateIndex ) 74 { 75 this.index = stateIndex; 76 this.category = stateCategory; 77 } 78 79 80 81 82 83 86 public boolean equals( Object o ) 87 { 88 if (o == null) return false; 89 if (o == this) return true; 90 if (o instanceof State) 91 { 92 State s = (State)o; 93 if (s.index == this.index && s.category == this.category) 94 { 95 return true; 96 } 97 } 98 return false; 99 } 100 101 102 public int hashcode() 103 { 104 return this.index + this.category; 105 } 106 107 protected boolean isSameCategory( State s ) 108 { 109 return (s.category == this.category); 110 } 111 112 115 116 protected int getIndex() 117 { 118 return this.index; 119 } 120 121 protected int getCategory() 122 { 123 return this.category; 124 } 125 126 127 128 } 131 132 | Popular Tags |