KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > functions > IsEqual


1 package gnu.kawa.functions;
2 import gnu.expr.Language;
3
4 /** Implement the standard Scheme procedure <tt>equal?</tt>
5  * and the Lisp <tt>equal</tt>. */

6
7 public class IsEqual extends gnu.mapping.Procedure2
8 {
9   Language language;
10
11   public IsEqual(Language language, String JavaDoc name)
12   {
13     this.language = language;
14     setName(name);
15   }
16
17   public static boolean apply (Object JavaDoc arg1, Object JavaDoc arg2)
18   {
19     return arg1 == arg2 || (arg1 != null && arg1.equals (arg2));
20   }
21
22   public Object JavaDoc apply2 (Object JavaDoc arg1, Object JavaDoc arg2)
23   {
24     return language.booleanObject(apply(arg1, arg2));
25   }
26
27 }
28
Popular Tags