Skip to content

Package: ComparisonTerm

ComparisonTerm

nameinstructionbranchcomplexitylinemethod
ComparisonTerm()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
equals(Object)
M: 3 C: 14
82%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 1 C: 3
75%
M: 0 C: 1
100%
hashCode()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package jakarta.mail.search;
18:
19: /**
20: * This class models the comparison operator. This is an abstract
21: * class; subclasses implement comparisons for different datatypes.
22: *
23: * @author Bill Shannon
24: * @author John Mani
25: */
26: public abstract class ComparisonTerm extends SearchTerm {
27: private static final long serialVersionUID = 1456646953666474308L;
28:
29: public static final int LE = 1;
30: public static final int LT = 2;
31: public static final int EQ = 3;
32: public static final int NE = 4;
33: public static final int GT = 5;
34: public static final int GE = 6;
35:
36: /**
37: * The comparison.
38: *
39: * @serial
40: */
41: protected int comparison;
42:
43: /**
44: * Creates a default {@code ComparisonTerm}.
45: *
46: * @see #comparison
47: */
48: public ComparisonTerm() {
49: }
50:
51: /**
52: * Equality comparison.
53: */
54: @Override
55: public boolean equals(Object obj) {
56:•        if (!(obj instanceof ComparisonTerm))
57:          return false;
58:         ComparisonTerm ct = (ComparisonTerm)obj;
59:•        return ct.comparison == this.comparison;
60: }
61:
62: /**
63: * Compute a hashCode for this object.
64: */
65: @Override
66: public int hashCode() {
67:         return comparison;
68: }
69: }