01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2005-2007 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.type;
20:
21: /**
22: * A floating point type.
23: *
24: * @author Robert Grimm
25: * @version $Revision: 1.23 $
26: */
27: public class FloatT extends NumberT {
28:
29: /**
30: * Create a new floating point type.
31: *
32: * @param kind The kind.
33: * @throws IllegalArgumentException Signals an invalid kind.
34: */
35: public FloatT(Kind kind) {
36: this (null, kind);
37: }
38:
39: /**
40: * Create a new flaoting point type.
41: *
42: * @param template The type whose annotations to copy.
43: * @param kind The kind.
44: * @throws IllegalArgumentException Signals an invalid kind.
45: */
46: public FloatT(Type template, Kind kind) {
47: super (template, kind);
48: switch (kind) {
49: case FLOAT:
50: case DOUBLE:
51: case LONG_DOUBLE:
52: case FLOAT_COMPLEX:
53: case DOUBLE_COMPLEX:
54: case LONG_DOUBLE_COMPLEX:
55: // All is well.
56: break;
57: default:
58: throw new IllegalArgumentException("Not a float kind "
59: + kind);
60: }
61: }
62:
63: public FloatT copy() {
64: return new FloatT(this , kind);
65: }
66:
67: public Type.Tag tag() {
68: return Type.Tag.FLOAT;
69: }
70:
71: public boolean isFloat() {
72: return true;
73: }
74:
75: public FloatT toFloat() {
76: return this;
77: }
78:
79: }
|