01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05:
06: package com.tc.object.walker;
07:
08: import java.util.Iterator;
09: import java.util.Map;
10: import java.util.Map.Entry;
11:
12: public class MapNode extends PlainNode {
13:
14: private final Iterator entryIterator;
15: private int index = 0;
16:
17: public MapNode(Map map, WalkTest walkTest) {
18: super (map, walkTest);
19: entryIterator = map.entrySet().iterator();
20: }
21:
22: public boolean done() {
23: return super .done() && !entryIterator.hasNext();
24: }
25:
26: public MemberValue next() {
27: if (!super .done()) {
28: return super .next();
29: } else {
30: Map.Entry entry = (Entry) entryIterator.next();
31: return new MapEntry(entry, index++);
32: }
33: }
34:
35: }
|