From dec5d004e296803375c3864e62e3c855b8034fda Mon Sep 17 00:00:00 2001 From: Hugo Dimitrijevic Date: Sun, 31 Mar 2024 08:59:14 +0200 Subject: [PATCH] ajout javadoc cell --- app/src/main/java/fr/iutfbleau/sae/Cell.java | 50 ++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/fr/iutfbleau/sae/Cell.java b/app/src/main/java/fr/iutfbleau/sae/Cell.java index 6c9fbc8..297b854 100644 --- a/app/src/main/java/fr/iutfbleau/sae/Cell.java +++ b/app/src/main/java/fr/iutfbleau/sae/Cell.java @@ -4,21 +4,41 @@ import androidx.annotation.NonNull; import java.io.Serializable; - +/** + * {@code Cell} is a class that represents the position of a cell in a + * two-dimensional grid. + * + * @autor Alexeï Kadir, Lyanis Souidi, Hugo Dimitrijevic + * @version 1.0 + */ public class Cell implements Serializable { - + /** + * The x-coordinate of the {@code Cell}. + */ public int x; - + /** + * The y-coordinate of the {@code Cell}. + */ public int y; - + /** + * Constructs a new {@code Cell} with the specified coordinates. + * + * @param x The x-coordinate of the {@code Cell}. + * @param y The y-coordinate of the {@code Cell}. + */ public Cell(int x, int y) { this.x = x; this.y = y; } - + /** + * Constructs a {@code Cell} with the same coordinates as the specified cell. + * + * @param cell The {@code Cell} to copy. If this parameter is {@code null}, the + * new {@code Cell} will have coordinates (0, 0). + */ public Cell(Cell cell) { if (cell == null) return; @@ -27,13 +47,23 @@ public class Cell implements Serializable { this.y = cell.y; } - + /** + * Calculates the hash code of the {@code Cell}. + * + * @return The hash code of the {@code Cell}. + */ @Override public int hashCode() { return this.x + this.y * 31; } - + /** + * Compares the {@code Cell} with the specified object for equality. + * + * @param object The object to compare with the {@code Cell}. + * @return {@code true} if the specified object is equal to the {@code Cell}, + * {@code false} otherwise. + */ @Override public boolean equals(Object object) { if (object == this) @@ -46,7 +76,11 @@ public class Cell implements Serializable { return cell.x == this.x && cell.y == this.y; } - + /** + * Returns a string representation of the {@code Cell}, in the form "[x; y]". + * + * @return A string representation of the {@code Cell}. + */ @NonNull @Override public String toString() {