01: // Copyright (c) 2001 Per M.A. Bothner and Brainfood Inc.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.expr;
05:
06: import gnu.lists.Convert;
07:
08: /** Override gnu.lists.Convert to use Kawa number and Char classes. */
09:
10: public class KawaConvert extends Convert {
11: public static Convert instance = new KawaConvert();
12:
13: public static Convert getInstance() {
14: return instance;
15: }
16:
17: public static void setInstance(Convert value) {
18: instance = value;
19: };
20: /*
21: public Object charToObject(char ch)
22: {
23: return gnu.text.Char.make(ch);
24: }
25:
26: public char objectToChar(Object obj)
27: {
28: return ((gnu.text.Char) obj).charValue();
29: }
30:
31: public Object byteToObject(byte value)
32: {
33: return gnu.math.IntNum.make(value);
34: }
35:
36: public Object shortToObject(short value)
37: {
38: return gnu.math.IntNum.make(value);
39: }
40:
41: public Object intToObject(int value)
42: {
43: return gnu.math.IntNum.make(value);
44: }
45:
46: public Object longToObject(long value)
47: {
48: return gnu.math.IntNum.make(value);
49: }
50:
51: public Object byteToObjectUnsigned(byte value)
52: {
53: return gnu.math.IntNum.make(value & 0xFF);
54: }
55:
56: public Object shortToObjectUnsigned(short value)
57: {
58: return gnu.math.IntNum.make(value & 0xFFFF);
59: }
60:
61: public Object intToObjectUnsigned(int value)
62: {
63: return gnu.math.IntNum.make((long) value & 0xFFFFFFFFL);
64: }
65:
66: public Object longToObjectUnsigned(long value)
67: {
68: return gnu.math.IntNum.makeU(value);
69: }
70:
71: public Object floatToObject(float value)
72: {
73: return gnu.math.DFloNum.make(value);
74: }
75:
76: public Object doubleToObject(double value)
77: {
78: return gnu.math.DFloNum.make(value);
79: }
80: */
81:
82: }
|