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