From 9bc43e93c95b52faf8a22290be482a61aeb3ee36 Mon Sep 17 00:00:00 2001 From: Lyanis Souidi Date: Sat, 30 Mar 2024 17:08:09 +0100 Subject: [PATCH] Ajout classe `Cell` --- app/src/main/java/fr/iutfbleau/sae/Cell.java | 55 ++++++++++++++++++++ app/src/main/res/xml/preferences.xml | 23 -------- 2 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 app/src/main/java/fr/iutfbleau/sae/Cell.java delete mode 100644 app/src/main/res/xml/preferences.xml diff --git a/app/src/main/java/fr/iutfbleau/sae/Cell.java b/app/src/main/java/fr/iutfbleau/sae/Cell.java new file mode 100644 index 0000000..6c9fbc8 --- /dev/null +++ b/app/src/main/java/fr/iutfbleau/sae/Cell.java @@ -0,0 +1,55 @@ +package fr.iutfbleau.sae; + +import androidx.annotation.NonNull; + +import java.io.Serializable; + + +public class Cell implements Serializable { + + public int x; + + + public int y; + + + public Cell(int x, int y) { + this.x = x; + this.y = y; + } + + + public Cell(Cell cell) { + if (cell == null) + return; + + this.x = cell.x; + this.y = cell.y; + } + + + @Override + public int hashCode() { + return this.x + this.y * 31; + } + + + @Override + public boolean equals(Object object) { + if (object == this) + return true; + if (object == null || this.getClass() != object.getClass()) + return false; + + Cell cell = (Cell) object; + + return cell.x == this.x && cell.y == this.y; + } + + + @NonNull + @Override + public String toString() { + return "[" + this.x + "; " + this.y + "]"; + } +} diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml deleted file mode 100644 index 9d73598..0000000 --- a/app/src/main/res/xml/preferences.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - -