package foundation.json.tree;
|
|
import java.util.Iterator;
|
|
import foundation.util.MapList;
|
|
public class JBand implements Iterable<JBandItem> {
|
|
private MapList<String, JBandItem> items;
|
private int pos;
|
|
public JBand() {
|
items = new MapList<String, JBandItem>();
|
pos = -1;
|
}
|
|
public void appendOne(String name, Object value) {
|
JBandItem item = new JBandItem(name, value);
|
items.add(name, item);
|
}
|
|
public void toHomePosition() {
|
pos = -1;
|
}
|
|
public boolean hasNext() {
|
if (items.isEmpty() || pos >= items.size()) {
|
return false;
|
}
|
|
return true;
|
}
|
|
public boolean hasNext(String name, int level) {
|
// TODO Auto-generated method stub
|
return false;
|
}
|
|
public JBandItem next() {
|
pos = pos++;
|
return items.get(pos);
|
}
|
|
public boolean isEmpty() {
|
return items.isEmpty();
|
}
|
|
@Override
|
public Iterator<JBandItem> iterator() {
|
return items.iterator();
|
}
|
}
|