|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectMonopoly.Cell
Monopoly.Property
public abstract class Property
This abstract class represents any cell which can be owned by a player of Monopoly
This class methods manage the bying and the selling of a cell which can by a property
Implementation invariants: the price of the property cell is constant during the game
| Constructor Summary | |
|---|---|
Property(java.lang.String name,
int location,
int price)
Constructs a new cell which can be owned by a player. |
|
| Method Summary | |
|---|---|
void |
act(Monopoly game)
Makes a player to buy the property or pay the rent for it. |
Player |
getOwner()
Returns the owner of the property cell (Accessor). |
java.lang.String |
getOwnerName()
Returns the name of the cell's owner (Accessor). |
int |
getPrice()
Returns the price of the property cell (Accessor). |
abstract int |
getRent()
Calculates and returns the rent of the property cell that someone must pay if he goes at the exact cell (Accessor). |
boolean |
ismortaged()
Returns whether a property is mortaged or not (Accessor). |
void |
mortage()
Mortages the property cell (Transformer). |
void |
setOwner(Player owner)
Sets the given player as the owner of the property cell (Transformer). |
java.lang.String |
toString()
Returns the name of the Property cell (Accessor). |
void |
unmortage()
Unmortages the property cell (Transformer). |
| Methods inherited from class Monopoly.Cell |
|---|
getLocation, getName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Property(java.lang.String name,
int location,
int price)
| Method Detail |
|---|
public int getPrice()
public abstract int getRent()
public boolean ismortaged()
public Player getOwner()
getOwner in interface Collectablepublic java.lang.String getOwnerName()
public java.lang.String toString()
throws java.lang.NullPointerException
toString in class java.lang.Objectjava.lang.NullPointerExceptionpublic void mortage()
public void unmortage()
public void setOwner(Player owner)
setOwner in interface Collectableowner - The player who will be the ownerpublic void act(Monopoly game)
act in interface Interactiveact in class Cellgame - the Monopoly instance that represents the game.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||