-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDVDBean.java
More file actions
95 lines (74 loc) · 1.81 KB
/
DVDBean.java
File metadata and controls
95 lines (74 loc) · 1.81 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
public class DVDBean implements Comparable<DVDBean> {
//名称
private String name;
//状态
private Integer state;
//日期
private Integer date;
//次数
private Integer count;
public DVDBean() {
}
public DVDBean(String name, Integer state, Integer date, Integer count) {
this.name = name;
this.state = state;
this.date = date;
this.count = count;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Integer getDate() {
return date;
}
public void setDate(Integer date) {
this.date = date;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
@Override
public int compareTo(DVDBean dvdBean) {
int result = 0;
// if(this.state> dvdBean.state){
// result = 1;
// }else if(this.state< dvdBean.state){
// result = -1;
// }else{
// if(this.count.compareTo(dvdBean.count)>0){
// result = 1;
// }
//
// if(this.count.compareTo(dvdBean.count)<0){
// result = -1;
// }
// }
/*先比较状态*/
if(this.state> dvdBean.state){
result = 1;
}
if(this.state< dvdBean.state){
result = -1;
}
/*再比较count*/
if(this.count.compareTo(dvdBean.count)>0){
result = 1;
}
if(this.count.compareTo(dvdBean.count)<0){
result = -1;
}
return result;
}
}