Package core.components
Class ParkingSlot
- java.lang.Object
-
- core.components.ParkingSlot
-
public class ParkingSlot extends java.lang.Object
The ParkingSlot class: This class defines what is a parking slot and how it will behave in the application
-
-
Constructor Summary
Constructors Constructor Description ParkingSlot()
The ParkingSlot constructor (that take no argument)ParkingSlot(int state, Bicycle bicycle)
The ParkingSlot constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
equals method for the ParkingSlot classBicycle
getBicycle()
Getter for bicycleint
getId()
Getter for idstatic int
getNumberOfSlots()
Getter for numberOfSlotsint
getState()
Getter for stateint
hashCode()
hashCode method for the ParkingSlot classvoid
setBicycle(Bicycle bicycle)
Setter for bicyclevoid
setState(int state)
Setter for statevoid
setState(int state, Bicycle bicycle)
Setter for statejava.lang.String
toString()
toString method for the ParkingSlot class
-
-
-
Constructor Detail
-
ParkingSlot
public ParkingSlot(int state, Bicycle bicycle)
The ParkingSlot constructor- Parameters:
state
- an initial statebicycle
- an initial bicycle (may be null)
-
ParkingSlot
public ParkingSlot()
The ParkingSlot constructor (that take no argument)This constructor will set the initial state to zero (free)
-
-
Method Detail
-
setState
public void setState(int state)
Setter for state- Parameters:
state
- the state of the parking slot
-
setState
public void setState(int state, Bicycle bicycle)
Setter for state- Parameters:
state
- the state of the parking slotbicycle
- a bicycle parameter that the slot will storage
-
getBicycle
public Bicycle getBicycle()
Getter for bicycle- Returns:
- bicycle
-
setBicycle
public void setBicycle(Bicycle bicycle)
Setter for bicycle- Parameters:
bicycle
- bicycle
-
getState
public int getState()
Getter for state- Returns:
- state
-
getId
public int getId()
Getter for id- Returns:
- id
-
getNumberOfSlots
public static int getNumberOfSlots()
Getter for numberOfSlots- Returns:
- numberOfSlots
-
toString
public java.lang.String toString()
toString method for the ParkingSlot class- Overrides:
toString
in classjava.lang.Object
- Returns:
- a message that represent the ParkingSlot object
-
equals
public boolean equals(java.lang.Object o)
equals method for the ParkingSlot class- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- an object- Returns:
- true, if the two objects are "equal"; false, otherwise
-
hashCode
public int hashCode()
hashCode method for the ParkingSlot class- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash(id, state)
-
-