1 /*
2 Copyright (C) 2003 Together
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package org.enhydra.xml;
20
21 import java.util.ArrayList;
22 import java.util.HashMap;
23
24 import org.w3c.dom.DOMException;
25 import org.w3c.dom.NamedNodeMap;
26 import org.w3c.dom.Node;
27
28
29
30 /***
31 * @author Tweety
32 *
33 * A class representing a node in a meta-data tree, which implements
34 * the <a href="../../../../api/org/w3c/dom/NamedNodeMap.html">
35 *
36 * @version 1.0
37 */
38 class HashMapNamedNodeMap extends NamedNodeMapImpl {
39
40
41 /***
42 * HashMap of <code>Node</code> items.
43 */
44 HashMap hNodes;
45
46
47 /***
48 * Constructs a <code>HashMapNamedNodeMap</code> from the given <code>HashMap</code>.
49 *
50 * @param nodes , as a <code>HashMap</code>.
51 */
52 public HashMapNamedNodeMap(HashMap nodes) {
53 super(new ArrayList(nodes.values()));
54 this.hNodes = nodes;
55 }
56
57
58 /***
59 * Returns the items count.
60 *
61 * @return items count.
62 */
63 public int getLength() {
64 return hNodes.size();
65 }
66
67
68 /***
69 * Returns the <code>Node</code> item with the given name.
70 *
71 * @param name <code>Node</code> name.
72 *
73 * @return <code>Node</code> item with the given name.
74 */
75 public Node getNamedItem(String name) {
76 return (Node) hNodes.get(name);
77 }
78
79 }
This page was automatically generated by Maven