All Packages Class Hierarchy This Package Previous Next Index
Class busrider.PlayerView
java.lang.Object
|
+----busrider.PlayerView
- public class PlayerView
- extends Object
This immutable class represents a view of a player.
It provides read-only access to a Player object.
One can see most or all properties of the player, depending on the
"self" flag, but alter nothing.
Constructor Index
-
PlayerView(Player, boolean)
- creates a PlayerView.
Method Index
-
getCash()
- returns the player's cash, if this PlayerView was delivered to
Strategy.startGame()
; otherwise returns 0.
-
getCurrentRoute()
- returns the player's current Route.
-
getDestination()
- returns the player's destination.
-
getIndex()
- returns the player's index.
-
getLocation()
- returns a copy of the player's location.
-
getName()
- returns the player's name.
-
getOrigin()
- returns the player's terminus of origin.
-
isBankrupt()
- indicates whether the player is bankrupt.
-
isFast()
- indicates whether the player is fast (throws three dice).
-
isWealthy()
- indicates whether the player has at least
Game.WEALTHY_CASH
cash.
Constructors
PlayerView
public PlayerView(Player pl,
boolean self)
- creates a PlayerView.
Methods
getName
public String getName()
- returns the player's name.
getIndex
public int getIndex()
- returns the player's index.
getCash
public int getCash()
- returns the player's cash, if this PlayerView was delivered to
Strategy.startGame()
; otherwise returns 0.
isWealthy
public boolean isWealthy()
- indicates whether the player has at least
Game.WEALTHY_CASH
cash.
isBankrupt
public boolean isBankrupt()
- indicates whether the player is bankrupt.
isFast
public boolean isFast()
- indicates whether the player is fast (throws three dice).
getOrigin
public Junction getOrigin()
- returns the player's terminus of origin.
getLocation
public Location getLocation()
- returns a copy of the player's location.
getDestination
public Junction getDestination()
- returns the player's destination.
But returns null if the player is at a terminus and hasn't
selected his next destination.
getCurrentRoute
public Route getCurrentRoute()
- returns the player's current Route.
All Packages Class Hierarchy This Package Previous Next Index