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 public Or(Constraint p1, Constraint p2) {
16 _p1 = p1;
17 _p2 = p2;
18 }
19
20 public boolean eval(Object o) {
21 return _p1.eval(o) || _p2.eval(o);
22 }
23
24 public String toString() {
25 return "(" + _p1 + " or " + _p2 + ")";
26 }
27 }
This page was automatically generated by Maven