From f91fc59e79d82e8c5e37e9e5a8a9fb142369e86f Mon Sep 17 00:00:00 2001 From: Christos Houtouridis Date: Tue, 6 Nov 2018 10:33:35 +0200 Subject: [PATCH] A Ladder class rework --- src/SnakePkg/Ladder.java | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/SnakePkg/Ladder.java b/src/SnakePkg/Ladder.java index 6990ac1..195c075 100755 --- a/src/SnakePkg/Ladder.java +++ b/src/SnakePkg/Ladder.java @@ -1,26 +1,39 @@ package SnakePkg; /** - * A class to represent a Ladder in the Board + * @class Ladder + * @brief Represent a Ladder in the Board. + * + * Ladders are part of the elements we place on the board. + * They help the user to elevate rows. Each ladder can be used only once. + * * @author Christos Choutouridis 8997 + * @email cchoutou@ece.auth.gr */ public class Ladder { /** @name Constructors */ /** @{ */ - /** Default ctor */ + /** Default doing nothing constructor */ Ladder () { ladderId = upStepId = downStepId =0; broken = false; } - /** Main ctor */ + /** + * @brief The main constructor + * We create a ladder in the board + * @param ladderId The id of ladder to create + * @param upStepId The up-step tile of ladder + * @param downStepId The down-step tile of ladder + */ Ladder (int ladderId, int upStepId, int downStepId) { this.ladderId = ladderId; this.upStepId = upStepId; this.downStepId = downStepId; this.broken = false; // A new ladder is always in good condition } - /** Copy constructor - * @note We don't use clone as long as we don't inherit Cloneable iface + /** + * Copy constructor + * @param l The ladder we want to copy */ Ladder (Ladder l) { ladderId = l.getLadderId (); @@ -42,11 +55,11 @@ public class Ladder { void setBroken (boolean broken) { this.broken = broken; } /** @} */ - /** @name Data members (private) */ + /** @name Data members */ /** @{ */ - private int ladderId; //!< Ladder's ID - private int upStepId; //!< Ladder's upper step tile location - private int downStepId; //!< Snake's down step tile location - private boolean broken; //!< flag to indicate used/broken ladder + private int ladderId; /**< Ladder's ID */ + private int upStepId; /**< Ladder's upper step tile location */ + private int downStepId; /**< Snake's down step tile location */ + private boolean broken; /**< flag to indicate used/broken ladder */ /** @} */ }