KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > services > classfile > CONSTANT_Float_info


1 /*
2
3    Derby - Class org.apache.derby.iapi.services.classfile.CONSTANT_Float_info
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (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 import java.io.IOException JavaDoc;
26
27
28 /** Float Constant - page 96 */
29 final class CONSTANT_Float_info extends ConstantPoolEntry {
30     private final float value;
31
32     CONSTANT_Float_info(float value) {
33         super(VMDescriptor.CONSTANT_Float);
34         this.value = value;
35     }
36
37     public int hashCode() {
38         return (int) value;
39     }
40
41     public boolean equals(Object JavaDoc other) {
42
43         // check it is the right type
44
if (other instanceof CONSTANT_Float_info) {
45         
46             return value == ((CONSTANT_Float_info) other).value;
47         }
48
49         return false;
50     }
51
52     int classFileSize() {
53         // 1 (tag) + 4 (float length)
54
return 1 + 4;
55     }
56
57     void put(ClassFormatOutput out) throws IOException JavaDoc {
58         super.put(out);
59         out.writeFloat(value);
60     }
61 }
62
63
Popular Tags