-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormatStaff.java
More file actions
49 lines (39 loc) · 1.3 KB
/
Copy pathFormatStaff.java
File metadata and controls
49 lines (39 loc) · 1.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
package shiftman.server;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Takes a staff list as a parameter then performs various tasks on that list
* @author Raymond Yang
*/
public class FormatStaff {
private List<Staff> _staffList;
public FormatStaff(List<Staff> staffList) {
_staffList = staffList;
}
private List<Staff> sortStaffList() {
StaffLastNameComparator staffComparator = new StaffLastNameComparator();
Collections.sort(_staffList, staffComparator);
return _staffList;
}
public List<Staff> getUnassignedStaff(List<Staff> assignedStaff) {
List<Staff> unassignedStaff = _staffList;
unassignedStaff.removeAll(assignedStaff);
return unassignedStaff;
}
/**
* Formats the staff list correctly; ordered by family name and in the correct format
* @return List<String> staff names ordered by family name
*/
public List<String> displayStaffList() {
this.sortStaffList();
List<String> orderedStaffNames = new ArrayList<String>();
for(int i = 0; i < _staffList.size(); i++) {
orderedStaffNames.add(this.displayStaff(_staffList.get(i)));
}
return orderedStaffNames;
}
public String displayStaff(Staff staff) {
return staff.whatIsMyFirstName() + " " + staff.whatIsMyLastName();
}
}