Revision 7983

View differences:

trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/values/ComplexValue.java
1
package com.hardcode.gdbms.engine.values;
2

  
3
import java.util.Collection;
4
import java.util.LinkedHashMap;
5
import java.util.Map;
6
import java.util.Set;
7

  
8
public class ComplexValue extends StringValue implements Map {
9
	private LinkedHashMap mapValues =null;
10

  
11
	/**
12
	 * Construye un objeto ConplexValue con el texto que se pasa como parametro
13
	 *
14
	 * @param text
15
	 */
16
	ComplexValue(String text) {
17
		super(text);
18
		this.mapValues = new LinkedHashMap();
19
		this.parse();
20
	}
21

  
22
	/**
23
	 * Creates a new ComplexValue object.
24
	 */
25
	ComplexValue() {
26
		super();
27
		this.mapValues = new LinkedHashMap();
28
	}
29
	
30
	private void parse() {
31
		//TODO: implementar
32
	}
33
	
34
	private String dump() {
35
		//TODO: implementar
36
		return null;
37
	}
38

  
39
	public int size() {	
40
		return this.mapValues.size();
41
	}
42

  
43
	public void clear() {
44
		super.setValue("");
45
		this.mapValues.clear();
46

  
47
	}
48

  
49
	public boolean isEmpty() {		
50
		return this.mapValues.isEmpty();
51
	}
52

  
53
	public boolean containsKey(Object key) {		
54
		return this.mapValues.containsKey(key);
55
	}
56

  
57
	public boolean containsValue(Object value) {		
58
		return this.mapValues.containsValue(value);
59
	}
60

  
61
	public Collection values() {
62
		return this.mapValues.values();
63
	}
64

  
65
	public void putAll(Map t) {
66
		throw new UnsupportedOperationException();
67
	}
68

  
69
	public Set entrySet() {		
70
		return this.mapValues.entrySet();
71
	}
72

  
73
	public Set keySet() {
74
		return this.mapValues.keySet();
75
	}
76

  
77
	public Object get(Object key) {
78
		return this.mapValues.get(key);
79
	}
80

  
81
	public Object remove(Object key) {
82
		return this.mapValues.remove(key);
83
	}
84

  
85
	public Object put(Object key, Object value) {
86
		// FIXME: Falta comprobar que value sea instancia de Value
87
		return this.mapValues.put(key,value);
88
	}
89

  
90
	public String getStringValue(ValueWriter writer) {
91
		super.setValue(this.dump());
92
		return super.getStringValue(writer);
93
	}
94

  
95
	public String getValue() {
96
		super.setValue(this.dump());
97
		return super.getValue();
98
	}
99

  
100
	public void setValue(String value) {		
101
		super.setValue(value);
102
		this.parse();
103
	}
104

  
105
}
0 106

  

Also available in: Unified diff