Commit Graph

111 Commits

Author SHA1 Message Date
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
83fddd5724
Merge pull request #4 from EngOsamah/master
Update
2020-11-10 17:18:27 +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
HeshamTB
182e57afb4
Merge pull request #3 from EngOsamah/master
راجع TODO
2020-11-09 10:01:09 +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
eabe86923d
Fix improper UID String and getUID()
generateUID() used to produce spaces rather then
	leading zeros.
	Before
		(   1)
	After
		(0001)

	Also add getUID method
2020-11-06 23:28:58 +03:00
1372282168 Update Campaigns constructors
General improved constructors with regard to
	agreed upon final UML.

	generateUID() method to set UID for camp
	in constructors based on the new static int
	'numberOfCampaigns'. 0001, 0002, ...

	The type os UID is now String to accommodate
	the leading zeros.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-06 22:53:08 +03:00
3bc0940bee getVehicles() in Campaign
Allow to get ref to Array of Vehicles of Camp

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-06 22:49:33 +03:00
83cb6bcee7 Add Route to Vehicle
This is debatable since every Campgians has routes
	but is done to support all cases.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-06 22:42:15 +03:00
f8b5e79187 Add ref to street in every Accident
Add Street Object for Accident as location
	for Instances of Accident.

	Removed 'isInAccident()' from 'Breakable' interface
	The idea is from Previous suggested UML that replaces
	Broken and Accident with getStatus() that gives info about
	Breakable object. isBroken() now returns 1 if its eaither in
	Accident or Broken. Can check getCurrentAccident() for null.

Signed-off-by: HeshamTB <hishaminv@gmail.com>

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-06 22:36:01 +03:00
8a4a7d8f29 Campaign and new enums Mashier, Distrcit:
Update according to UML
   Set vehicles for camp
   new Constructor for camp

   Enum for District and Mashier. This will be set as endpoints
    for Streets, Routes or Campaigns.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-11-06 21:48:59 +03:00
d7cbd2910d
remove Date check on Accident
Removed the check on date of accidnet due
	to incomplete information. The start date of
	the simulation will be a static object in the
	future. Implement checks when added. TODO is
	there to reminde.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-10-27 11:55:39 +03:00
8e20f78eb9
Remove Gender enum:
The gender enum was made to be used with the removed
	Pilgrim class. The previous class and simulation vision
	has changed to be more targeted toward Vehicle flow and
	ignore dead-weight information like Pilgrims.

	Priority enum is still avialable to be used with campaigns
	to give preset priority for expermintation.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-10-27 07:52:19 +03:00
04149a4853
remove imports 2020-10-21 11:48:23 +03:00
eb94de2754 Remake Vehicle classes
- Abstract class CivilVehicle that implements Breakable and
	contains all common fields of vehicles. Now for example,
	Sedan <- CivilVehicle <- Vehicle
		      ^
		  Breakable
	The breakable methods are mostly implemented in CivilVehicle
	Except getTimeToFix() which is defined in subclasses of
	CivilVehicle.

	- Breakable interface:
	The method collide() now returns instance of Accident instead of
	void

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-10-21 11:35:19 +03:00
1b8b05cbb5 Remove Cap from Sedan and implement fix() from Breakable
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-10-21 05:45:16 +03:00
49f7be0ceb Campaign update:
- Remove fields as discussed in first project meeting
	- Add 2 Routes to each object with get/set

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-10-21 05:42:45 +03:00
e12c5ec296
Added classes:
- Bus class that extends Vehicle and implements Breakable
	- Street class and properties
	- Route still to be updated. Add Locations for start/end?
2020-10-21 03:15:03 +03:00