package foundation.state;
|
|
import java.util.Iterator;
|
import java.util.List;
|
|
import foundation.util.MapList;
|
import foundation.util.Util;
|
|
public class StatePointBucket implements Iterable<StatePoint> {
|
|
private MapList<String, StatePoint> points;
|
|
public StatePointBucket() {
|
points = new MapList<String, StatePoint>();
|
}
|
|
public void loadOne(StatePoint point) {
|
points.add(point.getKey(), point);
|
}
|
|
public StatePoint get(String key) {
|
return points.get(key);
|
}
|
|
public StatePoint getPointByToState(String another) {
|
if (Util.isEmpty(another)) {
|
return null;
|
}
|
|
for (StatePoint point: points) {
|
String toCode = point.getToCode();
|
|
if (another.equals(toCode)) {
|
return point;
|
}
|
}
|
|
return null;
|
}
|
|
public List<StatePoint> getList() {
|
return points.getItemList();
|
}
|
|
@Override
|
public Iterator<StatePoint> iterator() {
|
return points.iterator();
|
}
|
|
}
|