From 5309cf4c441571a94e6c0033765ec43a3dc67ec8 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Mon, 7 Mar 2016 17:22:53 +0100 Subject: Use this class reference --- src/ch/epfl/xblast/server/Board.java | 6 +++--- src/ch/epfl/xblast/server/Bomb.java | 12 +++++------ src/ch/epfl/xblast/server/Player.java | 40 +++++++++++++++++------------------ 3 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/ch') diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java index 5e03671..18ee532 100644 --- a/src/ch/epfl/xblast/server/Board.java +++ b/src/ch/epfl/xblast/server/Board.java @@ -119,7 +119,7 @@ public final class Board { for (List aHalfInnerBoard : halfInnerBoard) rowsList.add(Lists.mirrored(aHalfInnerBoard)); - return ofInnerBlocksWalled(rowsList); + return Board.ofInnerBlocksWalled(rowsList); } /** @@ -129,7 +129,7 @@ public final class Board { * @return the sequence of blocks related to the given cell. */ public Sq blocksAt(Cell c) { - return blocks.get(c.rowMajorIndex()); + return this.blocks.get(c.rowMajorIndex()); } /** @@ -139,7 +139,7 @@ public final class Board { * @return the first block of the sequence related to the given cell */ public Block blockAt(Cell c) { - return blocksAt(c).head(); + return this.blocksAt(c).head(); } } diff --git a/src/ch/epfl/xblast/server/Bomb.java b/src/ch/epfl/xblast/server/Bomb.java index 12e8888..3b1203b 100644 --- a/src/ch/epfl/xblast/server/Bomb.java +++ b/src/ch/epfl/xblast/server/Bomb.java @@ -71,35 +71,35 @@ public final class Bomb { * @return the ID of the owner of the bomb */ public PlayerID ownerId() { - return ownerId; + return this.ownerId; } /** * @return the position of the bomb */ public Cell position() { - return position; + return this.position; } /** * @return the length of the fuse */ public Sq fuseLengths() { - return fuseLengths; + return this.fuseLengths; } /** * @return the remaining time before the explosion */ public int fuseLength() { - return fuseLengths.head(); + return this.fuseLengths.head(); } /** * @return the range of the Bomb */ public int range() { - return range; + return this.range; } /** @@ -108,7 +108,7 @@ public final class Bomb { public List>> explosion() { List>> explosion = new ArrayList<>(); for (Direction dir : Direction.values()) { - explosion.add(explosionArmTowards(dir)); + explosion.add(this.explosionArmTowards(dir)); } return explosion; } diff --git a/src/ch/epfl/xblast/server/Player.java b/src/ch/epfl/xblast/server/Player.java index 7b5ac26..094d395 100644 --- a/src/ch/epfl/xblast/server/Player.java +++ b/src/ch/epfl/xblast/server/Player.java @@ -47,21 +47,21 @@ public final class Player { * @return the number of lives */ public int lives() { - return lives; + return this.lives; } /** * @return the state */ public State state() { - return state; + return this.state; } /** * @return true if the actual state allow to move */ public boolean canMove() { - return (state() == State.INVULNERABLE || state() == State.VULNERABLE); + return this.state() == State.INVULNERABLE || this.state() == State.VULNERABLE; } } @@ -104,28 +104,28 @@ public final class Player { * @return the position */ public SubCell position() { - return position; + return this.position; } /** * @return a new directed position with the given position and the previous direction */ public DirectedPosition withPosition(SubCell newPosition) { - return new DirectedPosition(newPosition, direction); + return new DirectedPosition(newPosition, this.direction()); } /** * @return the direction */ public Direction direction() { - return direction; + return this.direction; } /** * @return a new directed position with the previous position and the given direction */ public DirectedPosition withDirection(Direction newDirection) { - return new DirectedPosition(position, newDirection); + return new DirectedPosition(this.position(), newDirection); } } @@ -219,14 +219,14 @@ public final class Player { * @return the player's ID */ public PlayerID id() { - return id; + return this.id; } /** * @return the player's life states */ public Sq lifeStates() { - return lifeStates; + return this.lifeStates; } /** @@ -256,77 +256,77 @@ public final class Player { * @return the current life state of the player */ public LifeState lifeState() { - return lifeStates.head(); + return this.lifeStates.head(); } /** * @return the current number of lives of the player */ public int lives() { - return lifeStates.head().lives(); + return this.lifeStates.head().lives(); } /** * @return true is the player has more than 0 lives */ public boolean isAlive() { - return lives() >= 0; + return this.lives() >= 0; } /** * @return the directed position sequence of the player */ public Sq directedPositions() { - return directedPos; + return this.directedPos; } /** * @return the position of the player */ public SubCell position() { - return directedPos.head().position(); + return this.directedPos.head().position(); } /** * @return the current direction of the player */ public Direction direction() { - return directedPos.head().direction(); + return this.directedPos.head().direction(); } /** * @return the maximum number of bombs that the player can use */ public int maxBombs() { - return maxBombs; + return this.maxBombs; } /** * @return a new Player with the new maximum of bombs */ public Player withMaxBombs(int newMaxBombs) { - return new Player(id, lifeStates, directedPos, newMaxBombs, bombRange); + return new Player(this.id(), this.lifeStates(), directedPos, newMaxBombs, this.bombRange()); } /** * @return the range of the player's bomb */ public int bombRange() { - return bombRange; + return this.bombRange; } /** * @return a new Player with the new bomb range */ public Player withBombRange(int newBombRange) { - return new Player(id, lifeStates, directedPos, maxBombs, newBombRange); + return new Player(this.id(), this.lifeStates(), this.directedPos, this.maxBombs(), newBombRange); } /** * @return a new bomb posed by the Player */ public Bomb newBomb() { - return new Bomb(id, position().containingCell(), Ticks.BOMB_FUSE_TICKS, bombRange); + return new Bomb(this.id(), this.position().containingCell(), Ticks.BOMB_FUSE_TICKS, this.bombRange()); } } -- cgit v1.2.3