refactor Tuple to Triplet and create Cardinal enum on utils package

This commit is contained in:
Katchan 2021-10-15 18:53:34 +02:00
parent 77a2800a78
commit 26f0290047
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
package fr.lnl.game.server.utils;
public enum Cardinal {
NORTH,SOUTH,EAST,WEST,NORTH_EAST,NORTH_WEST,SOUTH_EAST,SOUTH_WEST
}

View File

@ -2,19 +2,19 @@ package fr.lnl.game.server.utils;
import java.util.Objects; import java.util.Objects;
public class Tuple<A,B,C> { public class Triplet<A,B,C> {
private A a; private A a;
private B b; private B b;
private C c; private C c;
public Tuple(A a, B b, C c){ public Triplet(A a, B b, C c){
this.a = a; this.a = a;
this.b = b; this.b = b;
this.c = c; this.c = c;
} }
public Tuple(){ public Triplet(){
this(null, null, null); this(null, null, null);
} }
@ -46,7 +46,7 @@ public class Tuple<A,B,C> {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
Tuple<?, ?, ?> tuple = (Tuple<?, ?, ?>) o; Triplet<?, ?, ?> tuple = (Triplet<?, ?, ?>) o;
return Objects.equals(a, tuple.a) && Objects.equals(b, tuple.b) && Objects.equals(c, tuple.c); return Objects.equals(a, tuple.a) && Objects.equals(b, tuple.b) && Objects.equals(c, tuple.c);
} }