1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jdo.impl.enhancer.classfile;
19
20 import java.io.*;
21 import java.util.Stack;
22
23 /***
24 * Class representing a long constant in the constant pool of a class file
25 */
26 public class ConstLong extends ConstValue {
27
28 public static final int MyTag = CONSTANTLong;
29
30
31 private long longValue;
32
33
34
35 /***
36 * The tag of this constant entry
37 */
38 public int tag() { return MyTag; }
39
40 /***
41 * return the value associated with the entry
42 */
43 public long value() {
44 return longValue;
45 }
46
47 /***
48 * Return the descriptor string for the constant type.
49 */
50 public String descriptor() {
51 return "J";
52 }
53
54 /***
55 * A printable representation
56 */
57 public String toString() {
58 return "CONSTANTLong(" + indexAsString() + "): " +
59 "longValue(" + Long.toString(longValue) + ")";
60 }
61
62 /***
63 * Compares this instance with another for structural equality.
64 */
65
66 public boolean isEqual(Stack msg, Object obj) {
67 if (!(obj instanceof ConstLong)) {
68 msg.push("obj/obj.getClass() = "
69 + (obj == null ? null : obj.getClass()));
70 msg.push("this.getClass() = "
71 + this.getClass());
72 return false;
73 }
74 ConstLong other = (ConstLong)obj;
75
76 if (!super.isEqual(msg, other)) {
77 return false;
78 }
79
80 if (this.longValue != other.longValue) {
81 msg.push(String.valueOf("longValue = "
82 + other.longValue));
83 msg.push(String.valueOf("longValue = "
84 + this.longValue));
85 return false;
86 }
87 return true;
88 }
89
90 /* package local methods *//package-summary/html">class="comment"> package local methods *//package-summary.html">
91
92 ConstLong(long i) {
93 longValue = i;
94 }
95
96 void formatData(DataOutputStream b) throws IOException {
97 b.writeLong(longValue);
98 }
99
100 static ConstLong read(DataInputStream input) throws IOException {
101 return new ConstLong(input.readLong());
102 }
103
104 void resolve(ConstantPool p) { }
105 }