public class Space
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CHANCE |
static int |
FREE_PARKING |
static int |
GO |
static int |
GOTO_JAIL |
static int |
JAIL |
private Property |
property |
static int |
PROPERTY |
| Constructor and Description |
|---|
Space(java.lang.String name,
int type)
Construct a Space from a name and a type.
|
Space(java.lang.String name,
int group,
int baseRent)
Constructs a Space of type PROPERTY from a name, group number, and rent.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName()
Get the name of the space.
|
Property |
getProperty()
Get the Property associated with this Space.
|
int |
getType()
Get the type of the space.
|
java.lang.String |
toString()
Create a String representation of this space.
|
public static final int GO
public static final int JAIL
public static final int FREE_PARKING
public static final int GOTO_JAIL
public static final int PROPERTY
public static final int CHANCE
private Property property
public Space(java.lang.String name,
int type)
If type is invalid, Space will be CHANCE.
name - The name of the Spacetype - The type of the Spacepublic Space(java.lang.String name,
int group,
int baseRent)
name - The name of the Propertygroup - The group number of the PropertybaseRent - The base rent of the Propertypublic java.lang.String toString()
String should be as follows:
"space-name"
E.g.:
Chance
toString in class java.lang.Objectpublic java.lang.String getName()
public int getType()
public Property getProperty()