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;
public class Pair<X,Y> {
public class Pair<A,B> {
private X x;
private Y y;
private A a;
private B b;
public Pair(X x, Y y){
this.x = x;
this.y = y;
public Pair(A a, B b){
this.a = a;
this.b = b;
}
public X getX() {
return this.x;
public A getA() {
return this.a;
}
public Y getY() {
return y;
public B getB() {
return this.b;
}
public void setA(A a) {
this.a = a;
}
public void setB(B b) {
this.b = b;
}
@Override
@ -25,11 +34,11 @@ public class Pair<X,Y> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
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
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) {
super(a, b);
}
}