01: /* FacadeNodeList.java
02:
03: {{IS_NOTE
04:
05: Purpose:
06: Description:
07: History:
08: 2001/10/02 16:33:29, Create, Tom M. Yeh.
09: }}IS_NOTE
10:
11: Copyright (C) 2001 Potix Corporation. All Rights Reserved.
12:
13: {{IS_RIGHT
14: This program is distributed under GPL Version 2.0 in the hope that
15: it will be useful, but WITHOUT ANY WARRANTY.
16: }}IS_RIGHT
17: */
18: package org.zkoss.xml;
19:
20: import java.util.List;
21: import org.w3c.dom.Node;
22: import org.w3c.dom.NodeList;
23:
24: /**
25: * The NodeList which is a facade of another java List.
26: *
27: * @author tomyeh
28: * @see FacadeList
29: */
30: public class FacadeNodeList implements NodeList {
31: /** The java List to facade. */
32: protected List _list;
33:
34: /** Constructor.
35: *
36: * @param list the list to facade; never null
37: */
38: public FacadeNodeList(List list) {
39: _list = list;
40: }
41:
42: //-- NodeList --//
43: public final int getLength() {
44: return _list.size();
45: }
46:
47: public final Node item(int j) {
48: return j >= 0 && j < _list.size() ? (Node) _list.get(j) : null;
49: }
50: }
|