1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| package javax.mail.search; |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| public abstract class IntegerComparisonTerm extends ComparisonTerm { |
26 |
| protected int number; |
27 |
| |
28 |
0
| protected IntegerComparisonTerm(int comparison, int number) {
|
29 |
0
| super();
|
30 |
0
| this.comparison = comparison;
|
31 |
0
| this.number = number;
|
32 |
| } |
33 |
| |
34 |
0
| public int getNumber() {
|
35 |
0
| return number;
|
36 |
| } |
37 |
| |
38 |
0
| public int getComparison() {
|
39 |
0
| return comparison;
|
40 |
| } |
41 |
| |
42 |
0
| protected boolean match(int match) {
|
43 |
0
| switch (comparison) {
|
44 |
0
| case EQ:
|
45 |
0
| return match == number;
|
46 |
0
| case NE:
|
47 |
0
| return match != number;
|
48 |
0
| case GT:
|
49 |
0
| return match > number;
|
50 |
0
| case GE:
|
51 |
0
| return match >= number;
|
52 |
0
| case LT:
|
53 |
0
| return match < number;
|
54 |
0
| case LE:
|
55 |
0
| return match <= number;
|
56 |
0
| default:
|
57 |
0
| return false;
|
58 |
| } |
59 |
| } |
60 |
| |
61 |
0
| public boolean equals(Object other) {
|
62 |
0
| if (other == this) return true;
|
63 |
0
| if (other instanceof IntegerComparisonTerm == false) return false;
|
64 |
0
| final IntegerComparisonTerm term = (IntegerComparisonTerm) other;
|
65 |
0
| return this.comparison == term.comparison && this.number == term.number;
|
66 |
| } |
67 |
| |
68 |
0
| public int hashCode() {
|
69 |
0
| return number;
|
70 |
| } |
71 |
| } |