Mercurial > hg > Members > shoshi > TreeCMSv2
comparison src/treecms/api/NodeAttributesImpl.java @ 14:8bf59f161b23
separete Node methods to NodeContext , NodeAttribute , NodeChildren
author | misaka |
---|---|
date | Tue, 17 May 2011 18:44:14 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:c8601b0fa8a3 | 14:8bf59f161b23 |
---|---|
1 package treecms.api; | |
2 | |
3 import java.nio.ByteBuffer; | |
4 import java.util.Collections; | |
5 import java.util.HashMap; | |
6 import java.util.Map; | |
7 import java.util.Set; | |
8 | |
9 public class NodeAttributesImpl implements NodeAttributes | |
10 { | |
11 private Map<ByteBuffer,ByteBuffer> m_attrs; | |
12 | |
13 public NodeAttributesImpl() | |
14 { | |
15 m_attrs = new HashMap<ByteBuffer,ByteBuffer>(); | |
16 } | |
17 | |
18 public NodeAttributesImpl(NodeAttributesImpl _attrs) | |
19 { | |
20 super(); | |
21 m_attrs.putAll(_attrs.m_attrs); | |
22 } | |
23 | |
24 @Override | |
25 public Set<ByteBuffer> getKeySet() | |
26 { | |
27 return m_attrs.keySet(); | |
28 } | |
29 | |
30 @Override | |
31 public void put(ByteBuffer _name, ByteBuffer _value) | |
32 { | |
33 m_attrs.put(_name,_value); | |
34 } | |
35 | |
36 @Override | |
37 public void putAll(NodeAttributes _attrs) | |
38 { | |
39 m_attrs.putAll(_attrs.asMap()); | |
40 } | |
41 | |
42 @Override | |
43 public Map<ByteBuffer,ByteBuffer> asMap() | |
44 { | |
45 return Collections.unmodifiableMap(m_attrs); | |
46 } | |
47 | |
48 @Override | |
49 public ByteBuffer get(ByteBuffer _name) | |
50 { | |
51 return m_attrs.get(_name); | |
52 } | |
53 | |
54 @Override | |
55 public NodeAttributes getAll() | |
56 { | |
57 return this; | |
58 } | |
59 | |
60 @Override | |
61 public void remove(ByteBuffer _name) | |
62 { | |
63 m_attrs.remove(_name); | |
64 } | |
65 | |
66 @Override | |
67 public void removeAll(Set<ByteBuffer> _keySet) | |
68 { | |
69 for(ByteBuffer _key : _keySet){ | |
70 remove(_key); | |
71 } | |
72 } | |
73 | |
74 @Override | |
75 public void clearAttributes() | |
76 { | |
77 m_attrs.clear(); | |
78 } | |
79 | |
80 } |