-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuanLyHoiDong.java
57 lines (48 loc) · 1.71 KB
/
QuanLyHoiDong.java
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.thanhttt.baitaplon;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
*
* @author Admin
*/
public class QuanLyHoiDong {
private List<HoiDongBaoVe> danhSachHoiDong = new ArrayList<>();
public void them(HoiDongBaoVe ...h){
this.danhSachHoiDong.addAll(Arrays.asList(h));
}
public void xoa(HoiDongBaoVe h){
this.danhSachHoiDong.removeIf(hd -> hd.equals(h) == true);
}
public List<HoiDongBaoVe> getDanhSachHoiDong() {
return this.danhSachHoiDong;
}
public void setDanhSachHoiDong(List<HoiDongBaoVe> ds) {
this.danhSachHoiDong = ds;
}
public void hienThi(){
for (HoiDongBaoVe hd: danhSachHoiDong){
hd.hienThi();
System.out.println("--------------");
}
}
public List<HoiDongBaoVe> timTheoNgayBaoVe(Date d){
List<HoiDongBaoVe> kq = new ArrayList<HoiDongBaoVe>();
for (HoiDongBaoVe hd: danhSachHoiDong)
if (hd.getNgayLamViec().getTime() == d.getTime())
kq.add(hd);
return kq;
}
public List<HoiDongBaoVe> timTheoNgayBaoVe(Date d1, Date d2){
List<HoiDongBaoVe> kq = new ArrayList<HoiDongBaoVe>();
for (HoiDongBaoVe hd: danhSachHoiDong)
if (hd.getNgayLamViec().getTime() >= d1.getTime() && hd.getNgayLamViec().getTime() <= d2.getTime())
kq.add(hd);
return kq;
}
}