KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmock > core > constraint > IsNot


1 /* Copyright (c) 2000-2004 jMock.org
2  */

3 package org.jmock.core.constraint;
4
5 import org.jmock.core.Constraint;
6
7
8 /**
9  * Calculates the logical negation of a constraint.
10  */

11 public class IsNot implements Constraint
12 {
13     private Constraint constraint;
14
15     public IsNot( Constraint constraint ) {
16         this.constraint = constraint;
17     }
18
19     public boolean eval( Object JavaDoc arg ) {
20         return !constraint.eval(arg);
21     }
22
23     public StringBuffer JavaDoc describeTo( StringBuffer JavaDoc buffer ) {
24         buffer.append("not ");
25         constraint.describeTo(buffer);
26         return buffer;
27     }
28 }
29
Popular Tags