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