Package bcu.cmp5332.bookingsystem.data
Class FlightDataManager
java.lang.Object
bcu.cmp5332.bookingsystem.data.FlightDataManager
- All Implemented Interfaces:
DataManager
The
FlightDataManager
class is responsible for managing the data
related to flights in the flight booking system. It implements the
DataManager
interface and provides methods to load and store flight data.
The flight data is stored in a text file located at ./resources/data/flights.txt
.
This class reads from and writes to this file to persist the flight information.
- See Also:
-
Field Summary
Fields inherited from interface bcu.cmp5332.bookingsystem.data.DataManager
SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Loads the flight data from the resource file and populates theFlightBookingSystem
with flight information.void
Stores the flight data from theFlightBookingSystem
to the resource file.
-
Constructor Details
-
FlightDataManager
public FlightDataManager()
-
-
Method Details
-
loadData
Loads the flight data from the resource file and populates theFlightBookingSystem
with flight information.- Specified by:
loadData
in interfaceDataManager
- Parameters:
fbs
- theFlightBookingSystem
to be populated with flight data- Throws:
IOException
- if there is an I/O error during the loading processFlightBookingSystemException
- if there is an error in the flight data format
-
storeData
Stores the flight data from theFlightBookingSystem
to the resource file.- Specified by:
storeData
in interfaceDataManager
- Parameters:
fbs
- theFlightBookingSystem
containing flight data to be stored- Throws:
IOException
- if there is an I/O error during the storing process
-