aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-04-21 18:50:54 +0000
committerMike Buland <eichlan@xagasoft.com>2011-04-21 18:50:54 +0000
commitd56af4807693e0e3b443f729b44d9aa8dcbb369d (patch)
tree6ae4c7be0d491af6784516621aedd5969024cf78
parente6655ae0e129a925f101638d5ab57636550c07af (diff)
downloadlibgats-d56af4807693e0e3b443f729b44d9aa8dcbb369d.tar.gz
libgats-d56af4807693e0e3b443f729b44d9aa8dcbb369d.tar.bz2
libgats-d56af4807693e0e3b443f729b44d9aa8dcbb369d.tar.xz
libgats-d56af4807693e0e3b443f729b44d9aa8dcbb369d.zip
Well, dictionary may work...
-rw-r--r--java/com/xagasoft/gats/GatsDictionary.java103
-rw-r--r--java/com/xagasoft/gats/GatsObject.java2
2 files changed, 67 insertions, 38 deletions
diff --git a/java/com/xagasoft/gats/GatsDictionary.java b/java/com/xagasoft/gats/GatsDictionary.java
index cf6d390..95ecc45 100644
--- a/java/com/xagasoft/gats/GatsDictionary.java
+++ b/java/com/xagasoft/gats/GatsDictionary.java
@@ -5,80 +5,109 @@ import java.io.OutputStream;
5import java.util.Collection; 5import java.util.Collection;
6import java.util.Map; 6import java.util.Map;
7import java.util.Set; 7import java.util.Set;
8import java.util.Hashtable;
8 9
9public class GatsDictionary extends GatsObject implements Map<String,GatsObject> 10public class GatsDictionary extends GatsObject implements Map<String,GatsObject>
10{ 11{
12 private Hashtable<String, GatsObject> hValue =
13 new Hashtable<String, GatsObject>();
14
15 public GatsDictionary()
16 {
17 }
18
11 public int getType() 19 public int getType()
12 { 20 {
13 return GatsObject.DICTIONARY; 21 return GatsObject.DICTIONARY;
14 } 22 }
15 23
16 public void read( InputStream is, char cType ) 24 public void read( InputStream is, char cType ) throws java.io.IOException
17 { 25 {
26 for(;;)
27 {
28 GatsObject objKey = GatsObject.read( is );
29 if( objKey == null )
30 break;
31 if( objKey.getType() != GatsObject.STRING )
32 throw new java.io.IOException("bleh");
33 put( objKey.toString(), GatsObject.read( is ) );
34 }
18 } 35 }
19 36
20 public void write( OutputStream os ) throws java.io.IOException 37 public void write( OutputStream os ) throws java.io.IOException
21 { 38 {
39 os.write( (int)'d' );
40 for( String sKey : hValue.keySet() )
41 {
42 new GatsString( sKey ).write( os );
43 hValue.get( sKey ).write( os );
44 }
45 os.write( (int)'e' );
22 } 46 }
23 47
24 public void clear() { 48 public String toString()
25 // TODO Auto-generated method stub 49 {
26 50 return hValue.toString();
27 } 51 }
28 52
29 public boolean containsKey(Object arg0) { 53 public void clear()
30 // TODO Auto-generated method stub 54 {
31 return false; 55 hValue.clear();
32 } 56 }
33 57
34 public boolean containsValue(Object arg0) { 58 public boolean containsKey( Object arg0 )
35 // TODO Auto-generated method stub 59 {
36 return false; 60 return hValue.containsKey( arg0 );
37 } 61 }
38 62
39 public Set<java.util.Map.Entry<String, GatsObject>> entrySet() { 63 public boolean containsValue( Object arg0 )
40 // TODO Auto-generated method stub 64 {
41 return null; 65 return hValue.containsValue( arg0 );
42 } 66 }
43 67
44 public GatsObject get(Object arg0) { 68 public Set<java.util.Map.Entry<String, GatsObject>> entrySet()
45 // TODO Auto-generated method stub 69 {
46 return null; 70 return hValue.entrySet();
47 } 71 }
48 72
49 public boolean isEmpty() { 73 public GatsObject get( Object arg0 )
50 // TODO Auto-generated method stub 74 {
51 return false; 75 return hValue.get( arg0 );
52 } 76 }
53 77
54 public Set<String> keySet() { 78 public boolean isEmpty()
55 // TODO Auto-generated method stub 79 {
56 return null; 80 return hValue.isEmpty();
57 } 81 }
58 82
59 public GatsObject put(String arg0, GatsObject arg1) { 83 public Set<String> keySet()
60 // TODO Auto-generated method stub 84 {
61 return null; 85 return hValue.keySet();
62 } 86 }
63 87
64 public void putAll(Map<? extends String, ? extends GatsObject> arg0) { 88 public GatsObject put( String arg0, GatsObject arg1 )
65 // TODO Auto-generated method stub 89 {
66 90 return hValue.put( arg0, arg1 );
67 } 91 }
68 92
69 public GatsObject remove(Object arg0) { 93 public void putAll( Map<? extends String, ? extends GatsObject> arg0 )
70 // TODO Auto-generated method stub 94 {
71 return null; 95 hValue.putAll( arg0 );
72 } 96 }
73 97
74 public int size() { 98 public GatsObject remove( Object arg0 )
75 // TODO Auto-generated method stub 99 {
76 return 0; 100 return hValue.remove( arg0 );
77 } 101 }
78 102
79 public Collection<GatsObject> values() { 103 public int size()
80 // TODO Auto-generated method stub 104 {
81 return null; 105 return hValue.size();
106 }
107
108 public Collection<GatsObject> values()
109 {
110 return hValue.values();
82 } 111 }
83}; 112};
84 113
diff --git a/java/com/xagasoft/gats/GatsObject.java b/java/com/xagasoft/gats/GatsObject.java
index cb97a43..266a08f 100644
--- a/java/com/xagasoft/gats/GatsObject.java
+++ b/java/com/xagasoft/gats/GatsObject.java
@@ -41,7 +41,7 @@ public abstract class GatsObject
41 break; 41 break;
42 42
43 case 'd': 43 case 'd':
44 // goRet = new GatsDictionary(); 44 goRet = new GatsDictionary();
45 break; 45 break;
46 46
47 case 'f': 47 case 'f':