Package core.system
Class MyVelibSystem
- java.lang.Object
-
- core.system.MyVelibSystem
-
public class MyVelibSystem extends java.lang.Object
The MyVelibSystem class : This class is responsible to implement what a myVelib system (or network) is. It shows how the system will behave, what are its attributes and important methods
-
-
Constructor Summary
Constructors Constructor Description MyVelibSystem()
(Simplest) constructor for the system class, will create an (empty) systemMyVelibSystem(java.util.List<Station> stations)
(Simpler) constructor for the system classMyVelibSystem(java.util.List<Station> stations, java.util.List<User> users, double money)
Constructor for the system class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMoney(double money)
This methods is responsible for adding money in the systemvoid
displayStationReport(Station station)
This method displays a report for a given station in the systemvoid
displaySystemReport()
This method displays a report for the system (the system itself)void
displayUserReport(User user)
This method displays a report for a given user in the systemboolean
equals(java.lang.Object o)
equals methoddouble
getMoney()
Getter for the money parameterjava.lang.String
getName()
Getter for the namejava.util.List<Station>
getStations()
Getter for the stations parameterjava.util.List<User>
getUsers()
Getter for the users parameterint
hashCode()
hashCode methodvoid
removeMoney(double money)
This methods is responsible for removing money from the systemvoid
rentBicycle(int userID, int StationID)
This method is responsible to implement a way to rent a bicycle in the system class.void
setMoney(double money)
Setter for moneyvoid
setName(java.lang.String name)
Setter for the name of the systemvoid
setStations(java.util.List<Station> stations)
Setter for the stations parametervoid
setUsers(java.util.List<User> users)
Setter for usersjava.lang.String
toString()
toString method
-
-
-
Constructor Detail
-
MyVelibSystem
public MyVelibSystem(java.util.List<Station> stations, java.util.List<User> users, double money)
Constructor for the system class- Parameters:
stations
- a list of stationsusers
- a list of usersmoney
- an amount of money that the system will have
-
MyVelibSystem
public MyVelibSystem(java.util.List<Station> stations)
(Simpler) constructor for the system class- Parameters:
stations
- a list of stations
-
MyVelibSystem
public MyVelibSystem()
(Simplest) constructor for the system class, will create an (empty) system
-
-
Method Detail
-
getStations
public java.util.List<Station> getStations()
Getter for the stations parameter- Returns:
- stations
-
setStations
public void setStations(java.util.List<Station> stations)
Setter for the stations parameter- Parameters:
stations
- a list of stations
-
getUsers
public java.util.List<User> getUsers()
Getter for the users parameter- Returns:
- users
-
setUsers
public void setUsers(java.util.List<User> users)
Setter for users- Parameters:
users
- a list of user objects
-
getMoney
public double getMoney()
Getter for the money parameter- Returns:
- money
-
setMoney
public void setMoney(double money)
Setter for money- Parameters:
money
- the amount of money that the system will have
-
getName
public java.lang.String getName()
Getter for the name- Returns:
- name of the system
-
setName
public void setName(java.lang.String name)
Setter for the name of the system- Parameters:
name
- A string that represents the new name of the system
-
toString
public java.lang.String toString()
toString method- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string that represents the system
-
equals
public boolean equals(java.lang.Object o)
equals method- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- an object- Returns:
- true or false
-
hashCode
public int hashCode()
hashCode method- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash(stations, users)
-
rentBicycle
public void rentBicycle(int userID, int StationID)
This method is responsible to implement a way to rent a bicycle in the system class. It will ask for the algorithm in the Terminal class- Parameters:
userID
- the user idStationID
- the station id
-
addMoney
public void addMoney(double money)
This methods is responsible for adding money in the system- Parameters:
money
- the amount of money to be added
-
removeMoney
public void removeMoney(double money)
This methods is responsible for removing money from the system- Parameters:
money
- the amount of money to be removed
-
displayUserReport
public void displayUserReport(User user)
This method displays a report for a given user in the system- Parameters:
user
- the user that will be studied
-
displayStationReport
public void displayStationReport(Station station)
This method displays a report for a given station in the system- Parameters:
station
- the station
-
displaySystemReport
public void displaySystemReport()
This method displays a report for the system (the system itself)
-
-