KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > walker > ArrayNode


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.object.walker;
6
7 import java.lang.reflect.Array JavaDoc;
8
9 public class ArrayNode extends AbstractNode implements Node {
10
11   private final int length;
12   private int index = 0;
13
14   protected ArrayNode(Object JavaDoc o) {
15     super(o);
16     length = Array.getLength(o);
17   }
18
19   public boolean done() {
20     return index >= length;
21   }
22
23   public MemberValue next() {
24     return MemberValue.elementValue(index, Array.get(getObject(), index++));
25   }
26
27 }
28
Popular Tags