Changeset 1868 for trunk/autoquest-plugin-android/src/main/java/de/ugoe
- Timestamp:
- 01/30/15 18:01:08 (10 years ago)
- Location:
- trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/eventcore/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/eventcore/gui/CharacterTyped.java
r1819 r1868 58 58 @Override 59 59 public boolean startsLogicalSequence() { 60 return false;60 throw new UnsupportedOperationException("not implemented yet"); 61 61 } 62 62 63 63 @Override 64 64 public boolean finishesLogicalSequence() { 65 return false;65 throw new UnsupportedOperationException("not implemented yet"); 66 66 } 67 67 … … 73 73 @Override 74 74 public boolean equals(Object obj) { 75 if (obj instanceof CharacterTyped){76 return (((CharacterTyped) obj).getString() == getString());75 if(obj == this){ 76 return true; 77 77 } 78 return false; 78 if(!(obj instanceof CharacterTyped)){ 79 return false; 80 } 81 CharacterTyped character = (CharacterTyped)obj; 82 return character.string.equals(string); 83 79 84 } 80 85 … … 87 92 public int hashCode() { 88 93 return getString().hashCode(); 94 } 95 96 /* 97 * (non-Javadoc) 98 * 99 * @see java.lang.Object#toString() 100 */ 101 @Override 102 public String toString() { 103 return "StringTyped: " + string; 89 104 } 90 105 -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/eventcore/gui/TouchSingle.java
r1819 r1868 17 17 /** 18 18 * <p> 19 * Event type for a single touch events, i.e. ,touch on a mobile phone.19 * Event type for a single touch events, i.e. touch on a mobile phone. 20 20 * </p> 21 21 * … … 104 104 @Override 105 105 public boolean equals(Object obj) { 106 if (obj instanceof TouchSingle){107 return (((TouchSingle) obj).getX() == getX()) && (((TouchSingle) obj).getY() == getY());106 if(obj == this){ 107 return true; 108 108 } 109 return false; 109 if(!(obj instanceof TouchSingle)){ 110 return false; 111 } 112 TouchSingle touch = (TouchSingle)obj; 113 return touch.getX() == x && touch.getY() == y; 110 114 } 111 115 … … 117 121 @Override 118 122 public int hashCode() { 119 //TODO create a hashCode 120 return 0; 123 // 17 due to the reason that this is a prime number. 124 int result = 17; 125 /* 126 * 31 due to the reason that a lot of VM's could optimize this multiplication by a shift. 127 * Source: Effective Java, Joshua Bloch, 2008, p.48 128 */ 129 result = 31 * result + Float.floatToIntBits(x); 130 result = 31 * result + Float.floatToIntBits(y); 131 return result; 121 132 } 122 133
Note: See TracChangeset
for help on using the changeset viewer.