KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > ext > pao > runtime > Primitive


1 package polyglot.ext.pao.runtime;
2
3 /**
4  * Boxed primitives. This is the abstract superclass of the classes used to box
5  * primitive values at runtime.
6  */

7 public abstract class Primitive {
8     /**
9      * Method used to implement <code>o == p</code> when <code>o</code> or
10      * <code>p</code> could be a boxed primitive. Boxed primitives are
11      * compared by their primitive value, not by identity.
12      *
13      * @param o object to compare to p
14      * @param p object to compare to o
15      * @return true if <code>o == p</code> or if o and p are instances of
16      * <code>Primitive</code> and box the same primitive value.
17      */

18     public static boolean equals(Object JavaDoc o, Object JavaDoc p) {
19         return o == p || (o instanceof Primitive && ((Primitive)o).equals(p));
20     }
21 }
Popular Tags