Repository navigation
Expand file tree
/
Copy pathCriminalDatabaseApplication.java
More file actions
1037 lines (968 loc) · 41.3 KB
/
Copy pathCriminalDatabaseApplication.java
File metadata and controls
1037 lines (968 loc) · 41.3 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import java.util.ArrayList;
import java.util.UUID;
import java.util.Map;
import java.util.HashMap;
public class CriminalDatabaseApplication {
private static CaseList caseList = CaseList.getInstance();
private static UserList userList = UserList.getInstance();
private static PersonList personList = PersonList.getInstance();
private static EvidenceList evidenceList = EvidenceList.getInstance();
private static User user;
private static CriminalDatabaseApplication criminalDatabaseApplication;
/**
*
* @param caseList arrayLists of cases
* @param userList arrayLists of users
* @param personList arrayLists of people
* @param user a single user
*/
public CriminalDatabaseApplication(CaseList caseList, UserList userList, PersonList personList, User user)
{
CriminalDatabaseApplication.user = user;
}
/**
* Creates an instance of the Database
*/
public static CriminalDatabaseApplication getInstance() {
if (criminalDatabaseApplication == null){
criminalDatabaseApplication = new CriminalDatabaseApplication(caseList, userList, personList, user);//CaseList.getInstance(), UserList.getInstance(), PersonList.getInstance(), null);
}
return criminalDatabaseApplication;
}
/**
*
* @param userID the unique user id
* @param firstName first name of the admin
* @param lastName last name of the admin
* @param username username of the admin
* @param password password of the admin
* @param email email of the admin
* @param phoneNumber phone number of the admin
* @param department department of the admin
* @param updateCase whether or not the admin can update a case
* This method takes in the above parameters an creates an admin account
*/
public void createAdmin(UUID userID, String firstName, String lastName, String username, String password, String email, String phoneNumber, String department, boolean updateCase)
{
Administrator admin = new Administrator(UUID.randomUUID(), firstName, lastName, username, password, email, phoneNumber, department, updateCase);
userList.addAdmin(admin);
}
/**
*
* @param userID unique user id
* @param firstName first name of the officer
* @param lastName last name of the officer
* @param username username of the officer
* @param password password of the officer
* @param email email of the officer
* @param phoneNumber phone number of the officer
* @param department department of the officer
* @param badgeID badge id of the officer
* @param caseCount how many cases the officer entered
* @param editAccess if the officer can edit
* This method takes in the above parameters an creates an officer account
*/
public void createPolice(UUID userID, String firstName, String lastName, String username, String password, String email, String phoneNumber, String department, String badgeID, int caseCount, boolean editAccess)
{
policeOfficer policeofficer = new policeOfficer(UUID.randomUUID(), firstName, lastName, username, password, email, phoneNumber, department, badgeID, caseCount, editAccess);
userList.addPolice(policeofficer);
}
/**
*
* @param associate associates of the detective
* @param department department the detective is in
* @param userID the unique user ID
* @param firstName first name of the detective
* @param lastName last name of the detective
* @param username user name of the detective
* @param password password of the detective
* @param email email of the detective
* @param phoneNumber phone number of the detective
* This method takes in the above parameters an creates a detective account
*/
public void createDetective(String associate, String department, UUID userID, String firstName, String lastName, String username, String password, String email, String phoneNumber)
{
Detective detective = new Detective(associate, department, userID, firstName, lastName, username, password, email, phoneNumber);
userList.addDetective(detective);
}
/**
*
* @param caseID unique Case ID
* @param closedCase boolean if its a closed case
* @param caseName name of the case
* @param updateCase boolean if the case can be updated
* @param federalCase boolean if its a federal case
* @param misdimeanor boolean if its a misdimeanor
* @param category what type of case it is
* @param userWorking which users are on the case
* @param criminals which criminals are part of the case
* @param suspects which suspects are part of the case
* @param witness which witnesses are part of the case
* @param evidenceList the evidence associated with the case
* This method takes in the above parameters an creates a case
*/
public void createCase(UUID caseID, boolean closedCase, String caseName, boolean updateCase, boolean federalCase, boolean misdimeanor, Category category, ArrayList<User> userWorking,
ArrayList<Criminal> criminals, ArrayList<Suspect> suspects, ArrayList<Witness> witness, ArrayList<Evidence> evidenceList){
Case case1 = new Case(caseID, closedCase, caseName, updateCase, federalCase, misdimeanor, category, userWorking, suspects, witness, evidenceList);
caseList.addCase(case1);
}
/**
*
* @param personID unique person ID
* @param firstName criminal first name
* @param lastName criminal last name
* @param gender criminal gender
* @param race criminal race
* @param age criminal age
* @param height criminal height
* @param weight criminal weight
* @param phoneNumber criminal phone number
* @param address criminal home address
* @param occupation criminal occupation
* @param bloodType criminal blood type
* @param fingerprint criminal fingerprint type
* @param hairColor criminal hair color
* @param clothing criminal number of clothing and type of clothing
* @param footSize criminal foot size
* @param eyeColor criminal eye color
* @param isAlive boolean to check alive or dead
* @param tattoos criminals number of tattoos and description
* This method takes in the above parameters an creates a criminal
*/
public void createCriminal(UUID personID, String firstName, String lastName, String gender, String race, int age, double height, double weight, String phoneNumber, String address,
String occupation, String bloodType, String fingerprint, String hairColor, ArrayList<String> clothing, String footSize, String eyeColor, boolean isAlive, ArrayList<String> tattoos){
Criminal criminal = new Criminal(personID, firstName, lastName, gender, race, age, height, weight, phoneNumber, address, occupation, bloodType,
fingerprint, hairColor, clothing, footSize, eyeColor, isAlive, tattoos);
caseList.addCriminal(criminal);
}
/**
*
* @param criminal takes in the made criminal and adds it to the personList
*/
public void addCriminal(Criminal criminal){
personList.addCriminal(criminal);
}
/**
*
* @param criminal takes in the made suspect and adds it to the personList
*/
public void addSuspect(Suspect suspect){
personList.addSuspect(suspect);
}
/**
*
* @param criminal takes in the made witness and adds it to the personList
*/
public void addWitness(Witness witness){
personList.addWitness(witness);
}
/**
*
* @param criminal takes in the made victim and adds it to the personList
*/
public void addVictim(Victim victim){
personList.addVictim(victim);
}
/**
*
* @param criminal takes in the made POI and adds it to the personList
*/
public void addPOI(PersonOfInterest poi){
personList.addPOI(poi);
}
/**
*
* @param personID unique user ID
* @param firstName witness first name
* @param lastName witness last name
* @param gender witness gender
* @param race witness race
* @param age witness race
* @param height witness height
* @param weight witness weight
* @param phoneNumber witness phone number
* @param address witness address
* @param occupation witness occupation
* @param relationship witness relationship to criminal
* @param statement witness statment regarding crime
* This method takes in the above parameters an creates a witness
*/
public void createWitness(UUID personID, String firstName, String lastName, String gender, String race, int age, double height, double weight, String phoneNumber, String address, String occupation, String relationship, String statement){
Witness witness = new Witness(personID, firstName, lastName, gender, race, age, height, weight, phoneNumber, address, occupation, relationship, statement);
caseList.addWitness(witness);
}
/**
*
* @param personID unique user id
* @param firstName victim first name
* @param lastName victim last name
* @param gender victim gender
* @param race victim race
* @param age victim age
* @param height victim height
* @param weight victim weight
* @param phoneNumber victim phone number
* @param address victim address
* @param occupation victim occupation
* @param relationship victim relationship to criminal
* @param statement victim crime statement
* This method takes in the above parameters an creates a victim
*/
public void createVictim(UUID personID, String firstName, String lastName, String gender, String race, int age, double height, double weight, String phoneNumber, String address, String occupation, String relationship, String statement){
Victim victim = new Victim(personID, firstName, lastName, gender, race, age, height, weight, phoneNumber, address, occupation, relationship, statement);
caseList.addVictim(victim);
}
/**
*
* @param personID unique user id
* @param firstName suspect first name
* @param lastName suspect last name
* @param gender suspect gender
* @param race suspect race
* @param age suspect age
* @param height suspect height
* @param weight suspect weight
* @param phoneNumber suspect phone number
* @param address suspect address
* @param occupation suspect occupation
* @param hairColor suspect hair color
* @param eyeColor suspect eye color
* @param footSize suspect foot size
* @param bloodType suspect blood type
* @param fingerPrint suspect finger print type
* @param details details about the suspect
* @param clothing number of clothes and type of clothes the suspect has on
* @param tattoos number of tattoos the suspect has and description of the tattoos
* This method takes in the above parameters an creates a suspect
*/
public void createSuspect(UUID personID, String firstName, String lastName, String gender, String race, int age, double height, double weight, String phoneNumber, String address, String occupation, String hairColor,
String eyeColor, String footSize, String bloodType, String fingerPrint, String details, ArrayList<String> clothing, ArrayList<String> tattoos){
Suspect suspect = new Suspect(personID, firstName, lastName, gender, race, age, height, weight, phoneNumber, address, occupation, hairColor, eyeColor, footSize, bloodType, fingerPrint, details, clothing, tattoos);
caseList.addSuspect(suspect);
}
/**
*
* @param personID unique user id
* @param firstName POI first name
* @param lastName POI last name
* @param gender POI gender
* @param race POI race
* @param age POI age
* @param height POI height
* @param weight POI weight
* @param phoneNumber POI phone number
* @param address POI address
* @param occupation POI occupation
* @param hairColor POI hair color
* @param eyeColor POI eye color
* @param reasonofInterest the reason this person might be a suspect
* @param avaliableDetails any available details about the POI
* This method takes in the above parameters an creates a POI
*/
public void createPOI(UUID personID, String firstName, String lastName, String gender, String race, int age, double height, double weight, String phoneNumber, String address, String occupation, String hairColor,
String eyeColor, String reasonofInterest, String avaliableDetails){
PersonOfInterest poi = new PersonOfInterest(personID, firstName, lastName, gender, race, age, height, weight, phoneNumber, address, occupation, hairColor, eyeColor, reasonofInterest, avaliableDetails);
caseList.addPOI(poi);
}
/**
*
* @param evidenceID unique evidence ID
* @param evidenceType the type of evidence it was, any description about it
* @param locationFound where it was found
* This method takes in the above parameters an creates evidence
*/
public void createEvidence(UUID evidenceID, String evidenceType, String locationFound){
Evidence evidence = new Evidence(evidenceID, evidenceType, locationFound);
evidenceList.addEvidence(evidence);
}
/**
*
* @param evidence takes in the evidence and adds it to the evidenceList
*/
public void addEvidence(Evidence evidence){
evidenceList.addEvidence(evidence);
}
/**
*
* @param userName entered user name
* @param password entered password
* @return the user that just logged in
* If the user name and password entered is correct, it prints out that youre logging in as the first and last name of that user
* if the user name and password is incorrect, it prints out that it was incorrect
*/
public User login(String userName, String password)
{
if(userList.findUserName(userName)!=null){
User desiredUser = userList.findUserName(userName);
//System.out.println(desiredUser);//Colin is a dumb fool who needs to learn how to read
if(userName.equals(desiredUser.getUserName()) && password.equals(desiredUser.getPassword())){
System.out.println("Logging in as "+desiredUser.getFirstName()+" "+desiredUser.getLastName());
return desiredUser;
}
}
System.out.println("Username/Password was incorrect");
return null;
}
/**
*
* @param name first and last name of the person
* @return returns a person in personList with that name
*/
public Person findPerson(String name) {
return personList.findPerson(name);
}
/**
*
* @param username username of the user
* @return returns a user in userList with that user name
*/
public User findUser(String username) {
return userList.findUserName(username);
}
/**
*
* @param id unique user id
* @return returns a person in personList with that UUID
*/
public Person findPerson(UUID id) {
return personList.findPerson(id);
}
/**
*
* @param id unique user id
* @return returns a user in userList with that UUID
*/
public User findUser(UUID id) {
return userList.findUser(id);
}
/**
*
* @param id unique case id
* @return returns a case in caseList with that UUID
*/
public Case findCase(UUID id){
return caseList.findCase(id);
}
/**
*
* @param id unique evidence id
* @return returns evidence in evidenceList with that UUID
*/
public Evidence findEvidence(UUID id){
return evidenceList.findEvidence(id);
}
/**
* prints items in userList
*/
public void printUserList(){
userList.print();
}
/**
* prints items in personList
*/
public void printPersonList(){
personList.print();
}
/**
* prints items in caseList
*/
public void printCaseList(){
caseList.print();
}
/**
* prints items in evidenceList
*/
public void printEvidenceList(){
evidenceList.print();
}
/**
*
* @param firstName the first name the method is searching for
* @return arrayList people of everyone who has that name
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchFirst(String firstName){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getFirstName().equals(firstName)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getFirstName().equals(firstName)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getFirstName().equals(firstName)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getFirstName().equals(firstName)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getFirstName().equals(firstName)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param lastName the last name the method is searching for
* @return arrayList people of everyone who has that name
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchLast(String lastName){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getLastName().equals(lastName)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getLastName().equals(lastName)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getLastName().equals(lastName)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getLastName().equals(lastName)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getLastName().equals(lastName)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param gender the gender the method is searching for
* @return arrayList people of everyone who has that gender
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchGender(String gender){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getGender().equals(gender)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getGender().equals(gender)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getGender().equals(gender)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getGender().equals(gender)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getGender().equals(gender)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param race the race the method is searching for
* @return arrayList people of everyone who has that race
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchRace(String race){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getRace().equals(race)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getRace().equals(race)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getRace().equals(race)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getRace().equals(race)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getRace().equals(race)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param age the age the method is searching for
* @return arrayList people of everyone who has that age
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchAge(int age){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getAge()==age){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getAge()==age){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getAge()==age){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getAge()==age){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getAge()==age){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param height the height the method is searching for
* @return arrayList people of everyone who has that height
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchHeight(double height){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getHeight()==height){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getHeight()==height){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getHeight()==height){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getHeight()==height){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getHeight()==height){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param weight the weight the method is searching for
* @return arrayList people of everyone who has that weight
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchWeight(double weight){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getWeight()==weight){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getWeight()==weight){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getWeight()==weight){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getWeight()==weight){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getWeight()==weight){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param phoneNumber the phoneNumber the method is searching for
* @return arrayList people of everyone who has that phoneNumber
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchPhone(String phoneNumber){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getPhoneNumber().equals(phoneNumber)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getPhoneNumber().equals(phoneNumber)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getPhoneNumber().equals(phoneNumber)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getPhoneNumber().equals(phoneNumber)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getPhoneNumber().equals(phoneNumber)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param address the address the method is searching for
* @return arrayList people of everyone who has that address
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchAddress(String address){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getAddress().equals(address)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getAddress().equals(address)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getAddress().equals(address)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getAddress().equals(address)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getAddress().equals(address)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param occupation the occupation the method is searching for
* @return arrayList people of everyone who has that occupation
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchOccupation(String occupation){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Person name = personList.getSuspects().get(i);
if(name.getOccupation().equals(occupation)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Person name = personList.getCriminals().get(i);
if(name.getOccupation().equals(occupation)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getVictims().size();i++){
Person name = personList.getVictims().get(i);
if(name.getOccupation().equals(occupation)){
people.add(personList.getVictims().get(i));
}
}
for(int i=0;i<personList.getWitnesses().size();i++){
Person name = personList.getWitnesses().get(i);
if(name.getOccupation().equals(occupation)){
people.add(personList.getWitnesses().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
Person name = personList.getPersonsOfInterests().get(i);
if(name.getOccupation().equals(occupation)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param blood the blood type the method is searching for
* @return arrayList people of everyone who has that blood type
* Searches through the array list of people, which includes suspects, criminals, victims, witnesses, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchBlood(String blood){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getBloodType().equals(blood)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getBloodType().equals(blood)){
people.add(personList.getCriminals().get(i));
}
}
return people;
}
public ArrayList<Person> searchFinger(String finger){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getFingerPrint().equals(finger)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getFingerPrint().equals(finger)){
people.add(personList.getCriminals().get(i));
}
}
return people;
}
/**
*
* @param hair the hair color the method is searching for
* @return arrayList people of everyone who has that hair color
* Searches through the array list of people, which includes suspects, criminals, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchHair(String hair){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getHairColor().equals(hair)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getHairColor().equals(hair)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
PersonOfInterest name = personList.getPersonsOfInterests().get(i);
if(name.getHairColor().equals(hair)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param foot the foot size the method is searching for
* @return arrayList people of everyone who has that foot size
* Searches through the array list of people, which includes suspects and criminals and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchFoot(String foot){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getFootSize().equals(foot)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getFootSize().equals(foot)){
people.add(personList.getCriminals().get(i));
}
}
return people;
}
/**
*
* @param gender the gender the method is searching for
* @return arrayList people of everyone who has that gender
* Searches through the array list of people, which includes suspects, criminals, and POIs, and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchEye(String eye){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getEyeColor().equals(eye)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getEyeColor().equals(eye)){
people.add(personList.getCriminals().get(i));
}
}
for(int i=0;i<personList.getPersonsOfInterests().size();i++){
PersonOfInterest name = personList.getPersonsOfInterests().get(i);
if(name.getEyeColor().equals(eye)){
people.add(personList.getPersonsOfInterests().get(i));
}
}
return people;
}
/**
*
* @param tattoo the tattoos the method is searching for
* @return arrayList people of everyone who has that tattoo
* Searches through the array list of people, which includes suspects and criminals and adds them to a separate arrayList and prints out the array list
*/
public ArrayList<Person> searchTattoo(String tattoo){
ArrayList<Person> people = new ArrayList<Person>();
for(int i=0;i<personList.getSuspects().size();i++){
Suspect name = personList.getSuspects().get(i);
if(name.getTattoos().toString().toLowerCase().contains(tattoo)){
people.add(personList.getSuspects().get(i));
}
}
for(int i=0;i<personList.getCriminals().size();i++){
Criminal name = personList.getCriminals().get(i);
if(name.getTattoos().toString().toLowerCase().contains(tattoo)){
people.add(personList.getCriminals().get(i));
}
}
return people;
}
public ArrayList<Person> findCorrectPersons(ArrayList<Person> people, int numNeeded) {
ArrayList<Person> retMe = new ArrayList<Person>();
ArrayList<String> uuids = new ArrayList<String>();
Map<String, Integer> frequencyMap = new HashMap<>();
for (Person s: people) {
Integer count = frequencyMap.get(s.getUUID().toString());
if (count == null) {
count = 0;
}
frequencyMap.put(s.getUUID().toString(), count + 1);
}
for (Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
if(entry.getValue() == numNeeded) {
retMe.add(findPerson(UUID.fromString(entry.getKey())));
}
}
return retMe;
}