|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Or.java | - | 75% | 66.7% | 71.4% |
|
1 |
/* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
|
|
2 |
package org.jmock.constraint;
|
|
3 |
|
|
4 |
import org.jmock.Constraint;
|
|
5 |
|
|
6 |
/**
|
|
7 |
* Calculates the logical disjunction of two constraints.
|
|
8 |
* Evaluation is shortcut, so that the second constraint is not
|
|
9 |
* called if the first constraint returns <code>true</code>.
|
|
10 |
*/
|
|
11 |
public class Or |
|
12 |
implements Constraint {
|
|
13 |
Constraint _p1, _p2; |
|
14 |
|
|
15 | 8 |
public Or(Constraint p1, Constraint p2) {
|
16 | 8 |
_p1 = p1; |
17 | 8 |
_p2 = p2; |
18 |
} |
|
19 |
|
|
20 | 8 |
public boolean eval(Object o) { |
21 | 8 |
return _p1.eval(o) || _p2.eval(o);
|
22 |
} |
|
23 |
|
|
24 | 0 |
public String toString() {
|
25 | 0 |
return "(" + _p1 + " or " + _p2 + ")"; |
26 |
} |
|
27 |
} |
|
28 |
|
|