aboutsummaryrefslogtreecommitdiff
path: root/java/com/xagasoft/gats/GatsDictionary.java
blob: 95ecc45ad42b741d8573a72732329f58894a0212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.xagasoft.gats;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.Hashtable;

public class GatsDictionary extends GatsObject implements Map<String,GatsObject>
{
	private Hashtable<String, GatsObject> hValue =
		new Hashtable<String, GatsObject>();

	public GatsDictionary()
	{
	}

	public int getType()
	{
		return GatsObject.DICTIONARY;
	}

	public void read( InputStream is, char cType ) throws java.io.IOException
	{
		for(;;)
		{
			GatsObject objKey = GatsObject.read( is );
			if( objKey == null )
				break;
			if( objKey.getType() != GatsObject.STRING )
				throw new java.io.IOException("bleh");
			put( objKey.toString(), GatsObject.read( is ) );
		}
	}

	public void write( OutputStream os ) throws java.io.IOException
	{
		os.write( (int)'d' );
		for( String sKey : hValue.keySet() )
		{
			new GatsString( sKey ).write( os );
			hValue.get( sKey ).write( os );
		}
		os.write( (int)'e' );
	}

	public String toString()
	{
		return hValue.toString();
	}

	public void clear() 
	{
		hValue.clear();
	}

	public boolean containsKey( Object arg0 )
	{
		return hValue.containsKey( arg0 );
	}

	public boolean containsValue( Object arg0 )
	{
		return hValue.containsValue( arg0 );
	}

	public Set<java.util.Map.Entry<String, GatsObject>> entrySet()
	{
		return hValue.entrySet();
	}

	public GatsObject get( Object arg0 )
	{
		return hValue.get( arg0 );
	}

	public boolean isEmpty()
	{
		return hValue.isEmpty();
	}

	public Set<String> keySet()
	{
		return hValue.keySet();
	}

	public GatsObject put( String arg0, GatsObject arg1 )
	{
		return hValue.put( arg0, arg1 );
	}

	public void putAll( Map<? extends String, ? extends GatsObject> arg0 )
	{
		hValue.putAll( arg0 );
	}

	public GatsObject remove( Object arg0 )
	{
		return hValue.remove( arg0 );
	}

	public int size()
	{
		return hValue.size();
	}

	public Collection<GatsObject> values()
	{
		return hValue.values();
	}
};