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: package com.tc.object.walker;
06:
07: import java.util.Collection;
08: import java.util.Iterator;
09:
10: public class CollectionNode extends PlainNode {
11:
12: private final Iterator entryIterator;
13: private int index = 0;
14:
15: protected CollectionNode(Collection c, WalkTest walkTest) {
16: super (c, walkTest);
17: entryIterator = c.iterator();
18: }
19:
20: public boolean done() {
21: return super .done() && !entryIterator.hasNext();
22: }
23:
24: public MemberValue next() {
25: if (!super.done()) {
26: return super.next();
27: } else {
28: return MemberValue.elementValue(index++, entryIterator
29: .next());
30: }
31: }
32:
33: }
|