Refactor variable name on Pair

This commit is contained in:
Katchan 2021-10-18 18:17:52 +02:00
parent f5b26810b8
commit cfaeebe221
2 changed files with 21 additions and 13 deletions

View File

@ -2,22 +2,31 @@ package fr.lnl.game.server.utils;
import java.util.Objects; import java.util.Objects;
public class Pair<X,Y> { public class Pair<A,B> {
private X x; private A a;
private Y y; private B b;
public Pair(X x, Y y){ public Pair(A a, B b){
this.x = x; this.a = a;
this.y = y; this.b = b;
} }
public X getX() { public A getA() {
return this.x; return this.a;
} }
public Y getY() { public B getB() {
return y; return this.b;
}
public void setA(A a) {
this.a = a;
}
public void setB(B b) {
this.b = b;
} }
@Override @Override
@ -25,11 +34,11 @@ public class Pair<X,Y> {
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;
Pair<?, ?> point = (Pair<?, ?>) o; Pair<?, ?> point = (Pair<?, ?>) o;
return Objects.equals(x, point.x) && Objects.equals(y, point.y); return Objects.equals(a, point.a) && Objects.equals(b, point.b);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(x, y); return Objects.hash(a, b);
} }
} }

View File

@ -5,5 +5,4 @@ public class Point extends Pair<Integer, Integer> {
public Point(int a, int b) { public Point(int a, int b) {
super(a, b); super(a, b);
} }
} }