forked from benjyberk/ADP-ex4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f20420d
Showing
41 changed files
with
1,606 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(ADP_ex4) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
|
||
set(SOURCE_FILES Driver.cpp Driver.h MaritalStatus.h Color.h Point.cpp Point.h GraphSquare.cpp GraphSquare.h GridMap.cpp GridMap.h findPath.cpp findPath.h TripInfo.cpp TripInfo.h Passenger.cpp Passenger.h Taxi.cpp Taxi.h CarMaker.h StandardTaxi.cpp StandardTaxi.h LuxuryTaxi.cpp LuxuryTaxi.h TaxiDispatch.cpp TaxiDispatch.h DriverLocationListener.cpp DriverLocationListener.h GameControl.cpp GameControl.h DriverTaxiContainer.cpp DriverTaxiContainer.h) | ||
set(MAIN_FILES main.cpp Clock.cpp Clock.h) | ||
add_executable(ADP_ex4 ${MAIN_FILES} ${SOURCE_FILES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef ADVANCED_EX2_CARMAKER_H | ||
#define ADVANCED_EX2_CARMAKER_H | ||
|
||
enum CarMaker { | ||
HONDA, | ||
SUBARU, | ||
TESLA, | ||
FIAT | ||
}; | ||
|
||
#endif //ADVANCED_EX2_CARMAKER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#include "Clock.h" | ||
|
||
Clock::Clock() { | ||
time = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef ADP_EX4_CLOCK_H | ||
#define ADP_EX4_CLOCK_H | ||
|
||
|
||
class Clock { | ||
public: | ||
int time; | ||
Clock(); | ||
}; | ||
|
||
|
||
#endif //ADP_EX4_CLOCK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef ADVANCED_EX2_COLOR_H | ||
#define ADVANCED_EX2_COLOR_H | ||
|
||
enum Color { | ||
RED, | ||
BLUE, | ||
GREEN, | ||
PINK, | ||
WHITE | ||
}; | ||
|
||
#endif //ADVANCED_EX2_COLOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#include "Driver.h" | ||
#include "TripInfo.h" | ||
#include "Taxi.h" | ||
|
||
using namespace std; | ||
|
||
Driver::Driver(int n_id, int n_age, MaritalStatus n_mStatus, int n_experience, int n_vehicleID) { | ||
id = n_id; | ||
age = n_age; | ||
maritalStatus = n_mStatus; | ||
yearsExperience = n_experience; | ||
carID = n_vehicleID; | ||
} | ||
|
||
int Driver::getID() { | ||
return id; | ||
} | ||
|
||
int Driver::getAge() { | ||
return age; | ||
} | ||
|
||
MaritalStatus Driver::getMarital() { | ||
return SINGLE; | ||
} | ||
|
||
Taxi* Driver::getTaxi() { | ||
return 0; | ||
} | ||
|
||
int Driver::getYears() { | ||
return 0; | ||
} | ||
|
||
void Driver::setTaxi(Taxi*) { | ||
|
||
} | ||
|
||
|
||
|
||
void Driver::notifyListeners() { | ||
|
||
} | ||
|
||
int Driver::getSatisfaction() { | ||
return 0; | ||
} | ||
|
||
void Driver::addListener(DriverLocationListener * listener) { | ||
observers.push_back(listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef ADVANCED_EX2_DRIVER_H | ||
#define ADVANCED_EX2_DRIVER_H | ||
|
||
class Taxi; | ||
class DriverLocationListener; | ||
|
||
#include <cstdlib> | ||
#include <vector> | ||
#include "MaritalStatus.h" | ||
#include "Taxi.h" | ||
#include "DriverLocationListener.h" | ||
#include "TripInfo.h" | ||
|
||
/** | ||
* The driver is essentially a container class for information. His only (cureent) | ||
* method of note is add listener - which simply adds a listener | ||
*/ | ||
class Driver { | ||
private: | ||
int id; | ||
int age; | ||
MaritalStatus maritalStatus; | ||
int yearsExperience; | ||
int averageSatisfaction; | ||
int passengers; | ||
int carID; | ||
Taxi* taxi; | ||
std::vector<DriverLocationListener *> observers; | ||
public: | ||
Driver(int, int, MaritalStatus, int, int); | ||
int getID(); | ||
int getAge(); | ||
MaritalStatus getMarital(); | ||
Taxi* getTaxi(); | ||
int getSatisfaction(); | ||
int getYears(); | ||
void setTaxi(Taxi*); | ||
void notifyListeners(); | ||
// Add a listener for the driver position | ||
void addListener(DriverLocationListener *); | ||
}; | ||
|
||
|
||
#endif //ADVANCED_EX2_DRIVER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#include "DriverLocationListener.h" | ||
|
||
|
||
void DriverLocationListener::moveEvent(Point * newP) { | ||
currentLocation = newP; | ||
} | ||
|
||
Point *DriverLocationListener::getLocation() { | ||
return currentLocation; | ||
} | ||
|
||
DriverLocationListener::DriverLocationListener(Point * begin, int driverID) { | ||
currentLocation = begin; | ||
id = driverID; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef ADVANCED_EX2_DRIVERLOCATIONLISTENER_H | ||
#define ADVANCED_EX2_DRIVERLOCATIONLISTENER_H | ||
|
||
|
||
#include "Point.h" | ||
|
||
/** | ||
* The driver-location-listener class provides a notification when a move event | ||
* has occured. | ||
*/ | ||
class DriverLocationListener { | ||
private: | ||
Point * currentLocation; | ||
public: | ||
DriverLocationListener(Point *, int); | ||
void moveEvent(Point *); | ||
Point * getLocation(); | ||
int id; | ||
}; | ||
|
||
|
||
#endif //ADVANCED_EX2_DRIVERLOCATIONLISTENER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#include "DriverTaxiContainer.h" | ||
|
||
DriverTaxiContainer::DriverTaxiContainer() { | ||
taxi = 0; | ||
driver = 0; | ||
location = new Point(0,0); | ||
} | ||
|
||
void DriverTaxiContainer::setDriver(Driver * newDriver) { | ||
driver = newDriver; | ||
} | ||
|
||
void DriverTaxiContainer::setTaxi(Taxi * newTaxi) { | ||
taxi = newTaxi; | ||
} | ||
|
||
void DriverTaxiContainer::setLocation(Point * newLocation) { | ||
location = newLocation; | ||
} | ||
|
||
DriverTaxiContainer::~DriverTaxiContainer() { | ||
if (taxi) { | ||
delete taxi; | ||
} | ||
if (driver) { | ||
delete driver; | ||
} | ||
delete location; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// Benjy Berkowicz - 336182589 | ||
// Advanced Programming 2016-2017 Bar Ilan | ||
// | ||
|
||
#ifndef EX2_V2_DRIVERTAXICONTAINER_H | ||
#define EX2_V2_DRIVERTAXICONTAINER_H | ||
|
||
class Taxi; | ||
|
||
#include "Taxi.h" | ||
|
||
/** | ||
* A container class that holds the driver and the taxi as well as their location | ||
*/ | ||
class DriverTaxiContainer { | ||
public: | ||
Taxi * taxi; | ||
Driver * driver; | ||
Point * location; | ||
DriverTaxiContainer(); | ||
void setDriver(Driver *); | ||
void setTaxi(Taxi *); | ||
void setLocation(Point *); | ||
~DriverTaxiContainer(); | ||
}; | ||
|
||
|
||
#endif //EX2_V2_DRIVERTAXICONTAINER_H |
Oops, something went wrong.