| 1 | |
package org.paneris.jammyjoes.mvp; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
|
| 5 | |
import org.melati.poem.Persistable; |
| 6 | |
|
| 7 | |
|
| 8 | |
public class CollectOverTheTopCommand implements Command { |
| 9 | |
|
| 10 | |
ArrayList _list; |
| 11 | 2 | int _index = 0; |
| 12 | |
|
| 13 | 2 | public CollectOverTheTopCommand(ArrayList list, int size, Context context) { |
| 14 | 2 | _list = list; |
| 15 | 2 | _list.ensureCapacity(size); |
| 16 | 20 | for (int i = 0; i < size; i++) { |
| 17 | 18 | _list.add(i,new UncheckedProduct((Integer)context.get(new IntegerConverter(), i+""))); |
| 18 | |
} |
| 19 | 2 | } |
| 20 | |
|
| 21 | |
public Object visit(Object visited) { |
| 22 | 2 | return _list.set(_index++,new UncheckedProduct((Persistable)visited)); |
| 23 | |
} |
| 24 | |
|
| 25 | |
public void lastInteraction() { |
| 26 | 0 | } |
| 27 | |
|
| 28 | |
} |