View Javadoc

1   // Address.java, created Wed Sep 18  1:22:46 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Memory;
5   
6   import joeq.Class.PrimordialClassLoader;
7   import joeq.Class.jq_Class;
8   
9   /***
10   * @author  John Whaley <jwhaley@alum.mit.edu>
11   * @version $Id: Address.java 1456 2004-03-09 22:01:46Z jwhaley $
12   */
13  public abstract class Address {
14  
15      public abstract Address peek();
16  
17      public abstract byte peek1();
18  
19      public abstract short peek2();
20  
21      public abstract int peek4();
22  
23      public abstract long peek8();
24  
25      public abstract void poke(Address v);
26  
27      public abstract void poke1(byte v);
28  
29      public abstract void poke2(short v);
30  
31      public abstract void poke4(int v);
32  
33      public abstract void poke8(long v);
34  
35      public abstract Address offset(int offset);
36  
37      public abstract Address align(int shift);
38  
39      public abstract int difference(Address v);
40  
41      public abstract boolean isNull();
42  
43      public abstract int to32BitValue();
44  
45      public abstract String stringRep();
46  
47      public static final int alignInt(int val, int shift) {
48          int v = (1 << shift) - 1;
49          return (val + v) & ~v;
50      }
51  
52      public static final jq_Class _class;
53  
54      static {
55          _class = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Memory/Address;");
56      }
57  
58      protected final Object clone() throws CloneNotSupportedException {
59          throw new InternalError("cannot call clone on Address types!");
60      }
61  
62      public final boolean equals(Object arg0) {
63          throw new InternalError("cannot call equals on Address types!");
64      }
65  
66      public final int hashCode() {
67          throw new InternalError("cannot call hashCode on Address types!");
68      }
69  
70      public final String toString() {
71          throw new InternalError("cannot call toString on Address types!  use stringRep instead.");
72      }
73  
74  }