01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.impl;
11:
12: public class FloatConstant extends Constant {
13:
14: float value;
15:
16: public static Constant fromValue(float value) {
17: return new FloatConstant(value);
18: }
19:
20: private FloatConstant(float value) {
21: this .value = value;
22: }
23:
24: public byte byteValue() {
25: return (byte) value;
26: }
27:
28: public char charValue() {
29: return (char) value;
30: }
31:
32: public double doubleValue() {
33: return value; // implicit cast to return type
34: }
35:
36: public float floatValue() {
37: return this .value;
38: }
39:
40: public int intValue() {
41: return (int) value;
42: }
43:
44: public long longValue() {
45: return (long) value;
46: }
47:
48: public short shortValue() {
49: return (short) value;
50: }
51:
52: public String stringValue() {
53: return String.valueOf(this .value);
54: }
55:
56: public String toString() {
57: return "(float)" + value; //$NON-NLS-1$
58: }
59:
60: public int typeID() {
61: return T_float;
62: }
63: }
|