01: /*
02:
03: Derby - Class org.apache.derby.iapi.services.classfile.CONSTANT_Double_info
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.iapi.services.classfile;
23:
24: import org.apache.derby.iapi.services.classfile.VMDescriptor;
25:
26: import java.io.IOException;
27:
28: /** Double Constant - page 97 - Section 4.4.5 */
29: final class CONSTANT_Double_info extends ConstantPoolEntry {
30: private final double value;
31:
32: CONSTANT_Double_info(double value) {
33: super (VMDescriptor.CONSTANT_Double);
34: doubleSlot = true; //See page 98.
35: this .value = value;
36: }
37:
38: public int hashCode() {
39: return (int) value;
40: }
41:
42: int classFileSize() {
43: // 1 (tag) + 8 (double length)
44: return 1 + 8;
45: }
46:
47: void put(ClassFormatOutput out) throws IOException {
48: super .put(out);
49: out.writeDouble(value);
50: }
51:
52: public boolean equals(Object other) {
53:
54: // check it is the right type
55: if (other instanceof CONSTANT_Double_info) {
56:
57: return value == ((CONSTANT_Double_info) other).value;
58: }
59:
60: return false;
61: }
62: }
|