KickJava   Java API By Example, From Geeks To Geeks.

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


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 /** Is the value the same object as another value?
9  */

10 public class IsSame implements Constraint
11 {
12     private Object JavaDoc _object;
13     
14     /** Creates a new instance of IsSame
15      *
16      * @param o
17      * The predicate evaluates to true only when the argument is
18      * this object.
19      */

20     public IsSame(Object JavaDoc o) {
21         _object = o;
22     }
23     
24     public boolean eval( Object JavaDoc arg ) {
25         return arg == _object;
26     }
27     
28     public String JavaDoc toString() {
29         return "the same object as <" + _object + ">";
30     }
31 }
32
Popular Tags