-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTruck.h
82 lines (79 loc) · 2.43 KB
/
Truck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* @file Truck.h
* @brief Truck Class
* @version 0.1
* @copyright Copyright secured by YMY Team(c) 2022
*/
#pragma once
#include<string>
#include"Def.h"
#include "Cargo.h"
#include "PriQueue.h"
using namespace std;
class Truck
{
private:
UI* ui_p;
PriQueue<Cargo*>container;
TRUCK_TYPE Type;
int Truck_Capacity; //# of cargos
float Maintenance_Time; //hours
float Speed; //Km/h
int J; // journeys untill checkup
int Journeys_Till_Check; ////counter for journeys untill checkup
float Delivery_Interval; //Time to deliver all cargos & comeback, Calculated
float Delivery_Distance; //distance of the furthest cargo in container
Time Nearest_stop; // the delivery time for the nearsest cargo
float Nearest_dis;// distance for the nearest cargo
int ID;
int move_counter; //initialized with the highest load_time cargo in the container, once it reaches 0 the truck moves.
Time finish_point; // when the checkup finishes
Time AT;
int TDC;
int N;
Time moving_time;
TRUCK_SHIFT shift;
public:
Truck(int id, TRUCK_TYPE T, int TC, float MT, int j, float S,TRUCK_SHIFT sh);
TRUCK_TYPE GetType() const;
int GetCapacity() const;
void set_finish_point(const Time&);// set the time at which the checkup finishes
Time get_finish_point();
float GetMaintenanceTime() const;
float Get_nearest_dis();// gets the distance of the nearest cargo in container (top)
float GetSpeed() const;
float GetDeliveryInterval();
TRUCK_SHIFT getshift();
void setSpeed(float);
void set_nearest_stop(Time, float); //set the nearest destination time (delivery or return)
Time Get_nearest_stop();
int GetJTC(); //get the 'journeys till checkup' counter value
int GetContainer_count(); // gets the number of cargos in container
void restore_JTC(); // restore 'journeys till checkup' counter with the original "J"
void DecrementJTC(); //decrement the counter after each journey
int GetID() const;
void set_DInterval();
void load(Cargo*, float delivery_time); //load cargo into conatiner
Cargo* unload(); //unload cargo from the container
void count_down();
int get_move_counter();
void Set_AT(int h);
void inc_TDC();
void inc_N();
int Get_TDC();
int Get_N();
Time Get_AT();
float utilization(Time& Sim_Time);
void print_container();
void print();
void Set_moving_time(Time& Sim_Time);
Time get_moving_time();
};
/**
* @brief overloading << operator
*
* @param ostream& out
* @param Truck* c
* @return ostream&
*/
ostream& operator<<(ostream& out, Truck* t);