Last change
on this file since 4 was 4, checked in by davidb, 16 years ago |
Starting source code to Expeditee
|
File size:
945 bytes
|
Line | |
---|
1 | package org.expeditee.simple;
|
---|
2 |
|
---|
3 | public class SReal extends SPrimitive<Double> {
|
---|
4 | public static String prefix = SVariable.prefix + "r" + SVariable.separator;
|
---|
5 |
|
---|
6 | public SReal() {
|
---|
7 | super();
|
---|
8 | }
|
---|
9 |
|
---|
10 | public SReal(String name, Double value) {
|
---|
11 | super(name, value);
|
---|
12 | }
|
---|
13 |
|
---|
14 | public SReal(double value) throws Exception {
|
---|
15 | super(value);
|
---|
16 | }
|
---|
17 |
|
---|
18 | public SReal(float value) throws Exception {
|
---|
19 | super((double) value);
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public void parse(String s) throws Exception {
|
---|
24 | if (s == "")
|
---|
25 | value_ = 0.0;
|
---|
26 | else
|
---|
27 | value_ = Double.parseDouble(s);
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public Boolean booleanValue() {
|
---|
32 | return value_ > 0;
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public Long integerValue() {
|
---|
37 | return value_.longValue();
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public Double doubleValue() {
|
---|
42 | return value_;
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public Character characterValue() {
|
---|
47 | return new Character((char) value_.intValue());
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public void setValue(SPrimitive v) throws Exception {
|
---|
52 | value_ = v.doubleValue();
|
---|
53 | }
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.