source: trunk/org/expeditee/simple/SInteger.java@ 4

Last change on this file since 4 was 4, checked in by davidb, 16 years ago

Starting source code to Expeditee

File size: 1.0 KB
Line 
1package org.expeditee.simple;
2
3public class SInteger extends SPrimitive<Long> {
4 public static String prefix = SVariable.prefix + "i" + SVariable.separator;
5
6 public SInteger() {
7 super();
8 }
9
10 public SInteger(String name, Long value) {
11 super(name, value);
12 }
13
14 public SInteger(String name, Integer value) {
15 super(name, value.longValue());
16 }
17
18 public SInteger(long value) throws Exception {
19 super(value);
20 }
21
22 public SInteger(int value) throws Exception {
23 super((long) value);
24 }
25
26 @Override
27 public void parse(String s) throws Exception {
28 if (s == "")
29 value_ = 0L;
30 else
31 value_ = (long) Double.parseDouble(s);
32 }
33
34 @Override
35 public Boolean booleanValue() {
36 return value_ > 0;
37 }
38
39 @Override
40 public Long integerValue() {
41 return value_;
42 }
43
44 @Override
45 public Double doubleValue() {
46 return value_.doubleValue();
47 }
48
49 @Override
50 public Character characterValue() {
51 return new Character((char) value_.intValue());
52 }
53
54 @Override
55 public void setValue(SPrimitive v) throws Exception {
56 value_ = v.integerValue();
57 }
58}
Note: See TracBrowser for help on using the repository browser.