Commit Graph

172 Commits

Author SHA1 Message Date
271395654c
Route used by
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-02 00:02:08 +03:00
19291fbfe1
District report:
- Add best time to dist

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 22:33:24 +03:00
ba02114562
Print time of finishing for both days
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 22:21:50 +03:00
a376d91671
Clean up
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 21:10:00 +03:00
4a87e08a74
busses arrived per hour fix
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 20:51:12 +03:00
336106c7ed
Street toString()
- Print street details and fields.
    - Print scaled street density.
2020-12-01 20:22:59 +03:00
Asaad Dadoush
86651b3a91 method for the bus arrived per hour 2020-12-01 19:05:27 +03:00
HeshamTB
83261572fb
Merge branch 'master' into menu 2020-12-01 06:56:31 +03:00
3e1af27b6d
Print report option in menu
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 04:58:26 +03:00
EngOsamah
e8cdb4b51d CivilVehicleNoise is OK 2020-12-01 00:26:05 +03:00
51bf50ec6d
menu split into methods:
- Stack-like menu. Recurse until
    Return is selected.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 00:24:24 +03:00
0b4e259495
Route toString() Exception fix:
- toString() throws exception
   when invoked on 'noise' vehicles
   The routes made for them dont have
   District and Mashier set. Accessing
   name() from a null method throws
   null ptr ex.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-12-01 00:23:07 +03:00
e28a593280
Print time with menu
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-30 22:42:09 +03:00
fbd39f4081
Street history
- Save time of entry for each vehicle

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-30 22:36:37 +03:00
3a91f2f0f1
Vehicle toString():
- Print route
    - Check if street is null before getting
        name.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-30 21:47:33 +03:00
d7e3fd7a68
Vehicle toString()
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-30 21:05:01 +03:00
2edf82b28b
menu:
- Added street option in menu
    - Street length printed to second

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-30 20:50:23 +03:00
076cb510cf
Merge branch 'master' into menu 2020-11-30 20:28:42 +03:00
680890b864
Street toString()
- Print street details and fields.
    - Print scaled street density.
2020-11-30 20:11:41 +03:00
c3485f94d1
Merge branch 'master' into menu 2020-11-30 18:48:34 +03:00
521b36a117
Fix output glitch
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-28 05:42:21 +03:00
fc05264a46
Menu functions (Exit, Continue) 2020-11-27 20:04:23 +03:00
4346b9348d
Menu functions:
- View Vehicles
    - View Routes
2020-11-27 19:18:44 +03:00
b85a4040f2
Simple menu. Does nothing. 2020-11-27 18:42:17 +03:00
6d3d3b5085
Add pause method in InputListener
- Pause method and var to stop
    Scanner from 'taking' the input
    when in menue.
2020-11-27 18:42:17 +03:00
bd68322a75
Start a thread to listen for console input
- Listen for 'commands' on stdin
    the thread is running alongside
    the simulation.
2020-11-27 18:42:16 +03:00
5fde1eee7e
Route override toString()
- Print length, names of streets
    Estimated time (Best case)
    and endpoints.
2020-11-27 06:04:29 +03:00
b214b279db
Add Buses per District in pre run report 2020-11-27 00:39:40 +03:00
538c4a09a4
Average time for each street in report 2020-11-26 23:50:26 +03:00
51534a5d2b
Keep track of time used on every street on route 2020-11-26 22:41:24 +03:00
ff5c7753ff Add avg time of trip per district (Hour report)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-26 21:14:28 +03:00
480d9ccb46 Print dots as prog bar instead of date (minutes)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-26 21:11:16 +03:00
71c07b5bc1
Remove colored street name in report 2020-11-26 20:27:41 +03:00
bba5441aee Pre-simulation report:
- Make report with details per District
	(Still incomplete)
	- Use String builder for all reports.
2020-11-26 03:30:36 +03:00
946e4004ae Print msg for no arrival (avg)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-26 03:29:08 +03:00
4ab5b750b8
Remove printing of '\b'
- Causes problems in some consoles.
2020-11-23 01:29:23 +03:00
ee94355f42
Method in route getFastestTimeOfTravel(Vehicle):
- Every subclass of Vehicle needs to return
    the max of it self.

    - Calculate best case (empty streets) for
    a given vehcile using a Route.
2020-11-23 01:20:48 +03:00
6367b48746
Notes form 21-11-2020 meeting 2020-11-21 17:27:23 +03:00
dfbd961eca addCivilVehileNoise():
- Found possible fix for the method. Not yet done
	The 'numOfSedan', 'numOfSUV' ... get smaller for
	every loop iteration.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-21 02:49:00 +03:00
35cda81a46 Output:
- Add label for current minute output
	- Use "\b" instead of " " when clearing line

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-21 02:43:55 +03:00
da001dc5cd Output Color with respect to capacity
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-21 00:25:43 +03:00
1efd3e2dec Added new output and fixed street overflow
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-21 00:05:55 +03:00
4b0e8800be
Reset num of arrived busses after setting new route 2020-11-20 20:15:13 +03:00
012c8170f9 Two day simulation (buggy)?
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-19 17:06:12 +03:00
d2eeac04ec Setup for new time managment
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-18 19:35:49 +03:00
11a9269cb4 Street capacity used instead of remaining.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-18 19:28:38 +03:00
9ecbfe15ed updated todo tasks
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-18 19:28:17 +03:00
Asaad Dadoush
5030e7e5ac Edit Routes and Add Streets 2020-11-18 18:22:07 +03:00
86a4ac509a Move counting methods to street
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-17 20:44:10 +03:00
b06a15e303 rename counting methods
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-17 20:25:40 +03:00
200acf9a98 Improved output
Added Breakdown of car types on each street.

	Calculate avg trip time in last 10 min

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-17 20:18:17 +03:00
Asaad Dadoush
5e612c2995 Edit 2020-11-17 17:45:21 +03:00
d5891ad2d1 Add ref to Camp in Bus ...
- Ref to Camp in Bus.
	- Override arrive() in bus to
	notify camp.
	- isAllArrived() changed to implement camp.isDone().
	Should be a bit faster

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-15 17:02:56 +03:00
f6209c669d
Remove camp field and better output 2020-11-15 11:48:48 +03:00
124920787c
Better street report 2020-11-15 01:42:17 +03:00
EngOsamah
0458ff143e maybe this is going to be phase one 2020-11-15 01:21:15 +03:00
Asaad Dadoush
bb46419ed3 Report 2020-11-14 21:27:32 +03:00
Asaad Dadoush
3e1b1f162c Add UID for Sedan / SUV / Truck 2020-11-14 16:31:43 +03:00
2eb6a96a23
Better movement.
- Move Vehicles from list
   in Makkah.
2020-11-14 02:37:57 +03:00
fe781f43b6
Better movement.
- Move Vehicles from list
   in Makkah.
2020-11-14 01:30:20 +03:00
392993a008
Cars move on top of each other 2020-11-13 22:35:52 +03:00
fac5ed0089 Major update
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-12 00:13:05 +03:00
62c8fb22fa Major update
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-12 00:12:59 +03:00
Asaad Dadoush
6aabadd1f0 add enum 2020-11-11 21:35:18 +03:00
16ff81a44c update Vehicle and Campaign
- Added movment in vehicle.
   - Now Campaign sets Routes for
   it's Vehicles.
   - Fixed Array size of stdRoutes
   - Added getShortestRoute(Campaign)
   and getRoutesToDistrict(District)
   in MakkahCity

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-11 21:02:59 +03:00
f4bb5e6099
Prevent IndexOutOFBoundEx:
In genCivilVehicles(), the
    casting might step over
    the number of cars size
    of the array. So, use try
    catch blocks and skip in that
    case.
2020-11-11 14:26:41 +03:00
9fb653397f Make PDate refrence type rather then static members 2020-11-11 12:04:50 +03:00
be05e7f848
Method to make noise cars 2020-11-10 20:48:32 +03:00
b491eaf4ab Vehicle: calc distance to next
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 20:16:36 +03:00
92661695b1 Meeting work
Signed-off-by: HeshamTB <hishaminv@gmail.com>

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 20:16:11 +03:00
HeshamTB
f3258355fe
Merge branch 'master' into master 2020-11-10 17:06:28 +03:00
EngOsamah
2b037e40e8 Update 2020-11-10 16:45:35 +03:00
3fb2291b85
Note to review 2020-11-10 08:02:55 +03:00
fc6b93697c
Street: Add get remaining percent capacity() 2020-11-10 00:54:31 +03:00
96a1254ce3 Makkah: add all busses from camps to list
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:43:16 +03:00
0fb689a3a0 MakkahCity: Main simulation begins
- Defined static lists and arrays holding
	All object references.

	- Generate campaigns with random number range
	based on Area. This is based on estimate of
	real values and density of the Districts in
	Makkah.

	- Main loop is made and limited by
	PDate.isEnded() which is static variable
	indicates the end of the timeline.
	The incrementor is PDate.step(key,value)

	Simulation begins...

	- H.B.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:10:31 +03:00
d242489985 Campaign and Bus:
- Buses now have fixed vehicle length
	stored in STD_BUS_SIZE and are constructed
	without parameters.

	- Fixed generateBuses() in Campaign
	to not be public and used one in practice

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:05:58 +03:00
1bf7290dbf Street:
- Added getCombinedLength(). Returns
	sum of the length of each lane on street

	- Fixed addVehicle() condition to be relative
	to the provided vehicle plus padding

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:03:29 +03:00
7c9fd44070 Clean up TrafficPoliceCar and Changed CanBeGovtCar
Signed-off-by: HeshamTB <hishaminv@gmail.com>

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:02:08 +03:00
713e902e05 Route:
- Changed constructor to take
	Enums of District and Mashier
	as endpoint (start, end)

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-10 00:00:20 +03:00
6d0ea7654e PDate: fix stepping method to not step over sim timeline
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-09 23:57:28 +03:00
0bc231222a StreetNames:
Index values of streets

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-09 23:53:42 +03:00
d3d515a818
Street capacity() calculation:
Add padding for each car except the first
	and last (i.e. number of cars - 2).
2020-11-09 12:42:32 +03:00
af5548734d Fix error in Camp.addVehicle()
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-09 12:30:18 +03:00
11252e7996
Ammar: Street.addVehicle() and capacity(): 2020-11-09 12:24:51 +03:00
4dde706eda Camp: Vehicles list points to null:
vehicles is null, thus, can't use .add() in generateBusses()
	First make an Object in generateBusses() then fill with add().
	Or make generateBusses() only add to an instance member
	(i.e. construct with ref with instance)

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-09 11:57:35 +03:00
EngOsamah
d4d91a4f17 راجع TODO 2020-11-08 23:35:39 +03:00
eb9223b2c2 Campaign check for valid leave date
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-08 18:26:06 +03:00
3ae32ebb11 Rework PDate
- Make PDate a static class or all
   methods and members are static to
   be used in the main implementation
   (Makkah)

   - isValidTime(Date) method to check
   if date is within simulation timeline
2020-11-08 18:22:55 +03:00
1f884631ee PDate class:
- Manege timeline of simulation

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-08 17:26:25 +03:00
HeshamTB
4110fc97ac
Merge pull request #2 from AsaadDadoush/master
Edit
2020-11-08 16:40:37 +03:00
Asaad Dadoush
074cb0a59b TODO Tasks 2020-11-08 16:34:10 +03:00
Asaad Dadoush
da8ef062ae add capcity method , canTakeVehicles , addVehicle 2020-11-08 16:03:44 +03:00
Asaad Dadoush
d63335beb8 Add Class 2020-11-08 03:05:52 +03:00
asaad
8c17a87105 Added classes: 2020-11-08 02:38:37 +03:00
asaad
be384ebf76 SUV Class 2020-11-08 02:31:20 +03:00
b70bad851e Use encapsulation principal in CivilVehicle
Since every occurrence of collide should set
	currentAccident and broken for all cars, use
	setCurrentAccident() for both cars in collide()
	which sets both values.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-07 12:35:35 +03:00
e65d3d16e9 Add isDone() boolean method to Accident
isDone() checks all invovlved CivilVehicles
	in Accident instance. If any car has reference
	to 'this' then it is still not done.
	Done would be true if fix() of each car is invoked.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-07 12:33:01 +03:00
IMXHERO
eeca8c5cbb
Update Campaign.java 2020-11-07 00:07:50 +03:00
IMXHERO
605dff3982
Update Campaign.java 2020-11-07 00:01:20 +03:00