public class Parcel extends java.lang.Object implements BoardElement
Modifier and Type | Field and Description |
---|---|
Node |
destination
The node where this parcel is to be delivered.
|
Node |
start
The node on which this this parcel started.
|
COLOR_TOKEN, DESTINATION_TOKEN, LENGTH_TOKEN, LOCATION_TOKEN, NAME_TOKEN, X_TOKEN, Y_TOKEN
Modifier and Type | Method and Description |
---|---|
Board |
getBoard()
Return the board on which this Parcel belongs.
|
Circle |
getCircle()
Return the circle that represents this Parcel on the GUI
|
java.awt.Color |
getColor()
Return the color of this Parcel.
|
Node |
getLocation()
Return the current location for this Parcel
|
java.lang.String |
getMappedName()
Return an empty string --Parcels do not have mapped names.
|
int |
getRelativeX()
Return 0, since Parcels have no mapped name.
|
int |
getRelativeY()
Return the y coordinate of this Object's string drawing relative to the object.
|
java.lang.Object |
getUserData()
Return the userData stored in this Node (may be null).
|
boolean |
isColorSignificant()
Return true - the color of Parcels is significant
|
boolean |
isHeld()
Returns true iff some truck currently holds this Parcel.
|
boolean |
isTruckHere(Truck t)
Return true iff t currently holds this Parcel.
|
void |
setUserData(java.lang.Object uData)
Set the userData to uData.
|
java.lang.String |
toJSONString()
Return this parcel's start location and its color for JSON string.
|
int |
trucksHere()
Return 1 if a truck is currently holding this Parcel, 0 otherwise
|
void |
updateGUILocation(int x,
int y)
Update the circle position to (x, y).
|
public final Node start
public final Node destination
public Board getBoard()
getBoard
in interface BoardElement
public Node getLocation()
public java.awt.Color getColor()
public boolean isColorSignificant()
isColorSignificant
in interface Colorable
public java.lang.Object getUserData()
getUserData
in interface UserData
public void setUserData(java.lang.Object uData)
setUserData
in interface UserData
public Circle getCircle()
public java.lang.String getMappedName()
getMappedName
in interface BoardElement
public java.lang.String toJSONString()
toJSONString
in interface org.json.JSONString
public int getRelativeX()
getRelativeX
in interface BoardElement
public int getRelativeY()
BoardElement
getRelativeY
in interface BoardElement
public boolean isTruckHere(Truck t)
isTruckHere
in interface BoardElement
public boolean isHeld()
public int trucksHere()
trucksHere
in interface BoardElement
public void updateGUILocation(int x, int y)
updateGUILocation
in interface BoardElement