File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ String eventString(final int s) {
124124
125125 int addString (final String s ) {
126126 int stringCount = data .getStringCount ();
127- if (stringCount >= MAX_COUNT ) throw new IllegalStateException ("Too many shapes !" );
127+ if (stringCount >= MAX_COUNT ) throw new IllegalStateException ("Too many strings !" );
128128 data .setStringCount (stringCount + 1 );
129129 data .setStrings (stringCount , s );
130130 return stringCount ;
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ public String toString() {
5252 }
5353
5454 @ Override
55- public boolean equals (final Object o ) {
56- if (o instanceof Pair ) {
57- final Pair op = ( Pair ) o ;
58- return first . equals ( op . first ) && second . equals ( op . second ) ;
59- }
60- return false ;
55+ public boolean equals (Object o ) {
56+ if (this == o ) return true ;
57+ if ( o == null || getClass () != o . getClass ()) return false ;
58+ Pair pair = ( Pair ) o ;
59+ return Objects . equals ( first , pair . first ) &&
60+ Objects . equals ( second , pair . second ) ;
6161 }
6262
6363 @ Override
Original file line number Diff line number Diff line change @@ -57,13 +57,13 @@ public int getApproxDistance(final Point point) {
5757 }
5858
5959
60- public boolean equals ( final Object o ) {
61- if ( o != null && this . getClass (). equals (o . getClass ()) ) {
62- final Point point = ( Point ) o ;
63- return x == point . x && y == point . y ;
64- }
65- return false ;
66-
60+ @ Override
61+ public boolean equals (Object o ) {
62+ if ( this == o ) return true ;
63+ if ( o == null || getClass () != o . getClass ()) return false ;
64+ Point point = ( Point ) o ;
65+ return x == point . x &&
66+ y == point . y ;
6767 }
6868
6969 /**
@@ -75,6 +75,7 @@ public boolean isValid(final Game game) {
7575 scalar * y < game .mapPixelHeight ();
7676 }
7777
78+ @ Override
7879 public int hashCode () {
7980 return (x << 16 ) ^ y ;
8081 }
You can’t perform that action at this time.
0 commit comments