KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > constraint > IsGreaterThan


1 /* Copyright (c) 2002 Nat Pryce. All rights reserved.
2  *
3  * Created on February 10, 2002, 11:35 PM
4  */

5 package com.mockobjects.constraint;
6
7
8 /**
9  * Is the value greater than another {@link java.lang.Comparable} value?
10  */

11 public class IsGreaterThan implements Constraint
12 {
13     private Comparable JavaDoc _object;
14     
15     public IsGreaterThan( Comparable JavaDoc o ) {
16         _object = o;
17     }
18     
19     public boolean eval( Object JavaDoc arg ) {
20         return _object.compareTo(arg) < 0;
21     }
22     
23     public String JavaDoc toString() {
24         return "a value greater than <" + _object + ">";
25     }
26 }
27
Popular Tags