diff options
Diffstat (limited to '')
-rw-r--r-- | java/com/xagasoft/gats/GatsNull.java | 40 | ||||
-rw-r--r-- | java/com/xagasoft/gats/GatsObject.java | 5 |
2 files changed, 45 insertions, 0 deletions
diff --git a/java/com/xagasoft/gats/GatsNull.java b/java/com/xagasoft/gats/GatsNull.java new file mode 100644 index 0000000..7919433 --- /dev/null +++ b/java/com/xagasoft/gats/GatsNull.java | |||
@@ -0,0 +1,40 @@ | |||
1 | package com.xagasoft.gats; | ||
2 | |||
3 | import java.io.InputStream; | ||
4 | import java.io.OutputStream; | ||
5 | |||
6 | /** | ||
7 | * Represents a null value. This is really is the simplest type, GatsBoolean is | ||
8 | * a damn liar. This doesn't have any value, it's just null. | ||
9 | */ | ||
10 | public class GatsNull extends GatsObject | ||
11 | { | ||
12 | private boolean bValue = false; | ||
13 | |||
14 | /** | ||
15 | * Construct a new GatsNull, the default value is false. | ||
16 | */ | ||
17 | public GatsNull() | ||
18 | { | ||
19 | } | ||
20 | |||
21 | public int getType() | ||
22 | { | ||
23 | return GatsObject.NULL; | ||
24 | } | ||
25 | |||
26 | public String toString() | ||
27 | { | ||
28 | return "(null)"; | ||
29 | } | ||
30 | |||
31 | void read( InputStream is, char cType ) throws java.io.IOException | ||
32 | { | ||
33 | } | ||
34 | |||
35 | void write( OutputStream os ) throws java.io.IOException | ||
36 | { | ||
37 | os.write( (int)'n' ); | ||
38 | } | ||
39 | }; | ||
40 | |||
diff --git a/java/com/xagasoft/gats/GatsObject.java b/java/com/xagasoft/gats/GatsObject.java index 47602b3..e26ab7b 100644 --- a/java/com/xagasoft/gats/GatsObject.java +++ b/java/com/xagasoft/gats/GatsObject.java | |||
@@ -18,6 +18,7 @@ public abstract class GatsObject | |||
18 | public final static int LIST = 4; | 18 | public final static int LIST = 4; |
19 | public final static int DICTIONARY = 5; | 19 | public final static int DICTIONARY = 5; |
20 | public final static int BOOLEAN = 6; | 20 | public final static int BOOLEAN = 6; |
21 | public final static int NULL = 7; | ||
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Gets the type of the current object, type can be one of INTEGER, FLOAT, | 24 | * Gets the type of the current object, type can be one of INTEGER, FLOAT, |
@@ -74,6 +75,10 @@ public abstract class GatsObject | |||
74 | goRet = new GatsFloat(); | 75 | goRet = new GatsFloat(); |
75 | break; | 76 | break; |
76 | 77 | ||
78 | case 'n': | ||
79 | goRet = new GatsNull(); | ||
80 | break; | ||
81 | |||
77 | case 'e': | 82 | case 'e': |
78 | return null; | 83 | return null; |
79 | 84 | ||