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 package com.sun.org.apache.bcel.internal.classfile;
22
23 import java.io.DataInput;
24 import java.io.DataOutputStream;
25 import java.io.IOException;
26
27 import com.sun.org.apache.bcel.internal.Const;
28
29 /**
30 * This class is derived from the abstract {@link Constant}
31 * and represents a reference to a Double object.
32 *
33 * @version $Id: ConstantDouble.java 1747278 2016-06-07 17:28:43Z britter $
34 * @see Constant
35 */
36 public final class ConstantDouble extends Constant implements ConstantObject {
37
38 private double bytes;
39
40
41 /**
42 * @param bytes Data
43 */
44 public ConstantDouble(final double bytes) {
45 super(Const.CONSTANT_Double);
46 this.bytes = bytes;
47 }
48
49
50 /**
51 * Initialize from another object.
52 */
53 public ConstantDouble(final ConstantDouble c) {
54 this(c.getBytes());
104 * @param bytes the raw bytes that represent the double value
105 */
106 public final void setBytes( final double bytes ) {
107 this.bytes = bytes;
108 }
109
110
111 /**
112 * @return String representation.
113 */
114 @Override
115 public final String toString() {
116 return super.toString() + "(bytes = " + bytes + ")";
117 }
118
119
120 /** @return Double object
121 */
122 @Override
123 public Object getConstantValue( final ConstantPool cp ) {
124 return new Double(bytes);
125 }
126 }
|
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 package com.sun.org.apache.bcel.internal.classfile;
22
23 import java.io.DataInput;
24 import java.io.DataOutputStream;
25 import java.io.IOException;
26
27 import com.sun.org.apache.bcel.internal.Const;
28
29 /**
30 * This class is derived from the abstract {@link Constant}
31 * and represents a reference to a Double object.
32 *
33 * @version $Id: ConstantDouble.java 1747278 2016-06-07 17:28:43Z britter $
34 * @see Constant
35 * @LastModified: Nov 2017
36 */
37 public final class ConstantDouble extends Constant implements ConstantObject {
38
39 private double bytes;
40
41
42 /**
43 * @param bytes Data
44 */
45 public ConstantDouble(final double bytes) {
46 super(Const.CONSTANT_Double);
47 this.bytes = bytes;
48 }
49
50
51 /**
52 * Initialize from another object.
53 */
54 public ConstantDouble(final ConstantDouble c) {
55 this(c.getBytes());
105 * @param bytes the raw bytes that represent the double value
106 */
107 public final void setBytes( final double bytes ) {
108 this.bytes = bytes;
109 }
110
111
112 /**
113 * @return String representation.
114 */
115 @Override
116 public final String toString() {
117 return super.toString() + "(bytes = " + bytes + ")";
118 }
119
120
121 /** @return Double object
122 */
123 @Override
124 public Object getConstantValue( final ConstantPool cp ) {
125 return bytes;
126 }
127 }
|