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