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 double constant in the constant pool of a class file
25 */
26 public class ConstDouble extends ConstValue {
27
28 public static final int MyTag = CONSTANTDouble;
29
30
31 private double doubleValue;
32
33
34
35 /***
36 * The tag of this constant entry
37 */
38 public int tag() {
39 return MyTag;
40 }
41
42 /***
43 * return the value associated with the entry
44 */
45 public double value() {
46 return doubleValue;
47 }
48
49 /***
50 * Return the descriptor string for the constant type.
51 */
52 public String descriptor() {
53 return "D";
54 }
55
56 /***
57 * A printable representation
58 */
59 public String toString() {
60 return "CONSTANTDouble(" + indexAsString() + "): " +
61 "doubleValue(" + Double.toString(doubleValue) + ")";
62 }
63
64 /***
65 * Compares this instance with another for structural equality.
66 */
67
68 public boolean isEqual(Stack msg, Object obj) {
69 if (!(obj instanceof ConstDouble)) {
70 msg.push("obj/obj.getClass() = "
71 + (obj == null ? null : obj.getClass()));
72 msg.push("this.getClass() = "
73 + this.getClass());
74 return false;
75 }
76 ConstDouble other = (ConstDouble)obj;
77
78 if (!super.isEqual(msg, other)) {
79 return false;
80 }
81
82 if (this.doubleValue != other.doubleValue) {
83 msg.push(String.valueOf("doubleValue = "
84 + other.doubleValue));
85 msg.push(String.valueOf("doubleValue = "
86 + this.doubleValue));
87 return false;
88 }
89 return true;
90 }
91
92 /* package local methods *//package-summary/html">class="comment"> package local methods *//package-summary.html">
93
94 /***
95 * Construct a ConstDouble object
96 */
97 ConstDouble(double f) {
98 doubleValue = f;
99 }
100
101 void formatData(DataOutputStream b) throws IOException {
102 b.writeDouble(doubleValue);
103 }
104
105 static ConstDouble read(DataInputStream input) throws IOException {
106 return new ConstDouble(input.readDouble());
107 }
108
109 void resolve(ConstantPool p) { }
110 }