start of new file
[IRC.git] / Robust / src / ClassLibrary / Object.java
1 public class Object {
2     public native int nativehashCode();
3     private int cachedCode;//first field has to be a primitive
4     private boolean cachedHash;
5
6     /* DO NOT USE ANY OF THESE - THEY ARE FOR IMPLEMENTING TAGS */
7     private Object tags;
8
9     public int hashCode() {
10         if (!cachedHash) {
11             cachedCode=nativehashCode();
12             cachedHash=true;
13         }
14         return cachedCode;
15     }
16
17     /* DON'T USE THIS METHOD UNLESS NECESSARY */
18     /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */
19     public native int getType();
20
21     public String toString() {
22         return "Object"+hashCode();
23     }
24
25     public boolean equals(Object o) {
26         if (o==this)
27             return true;
28         return false;
29     }
30 }