[481] | 1 | package schedframe; |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | import java.util.ArrayList; |
---|
| 5 | import java.util.Collection; |
---|
| 6 | import java.util.Collections; |
---|
| 7 | import java.util.Iterator; |
---|
| 8 | import java.util.List; |
---|
| 9 | import java.util.ListIterator; |
---|
| 10 | |
---|
[490] | 11 | import dcworms.schedframe.scheduling.ExecTask; |
---|
| 12 | |
---|
[481] | 13 | public class ExecutablesList implements List<ExecTask> { |
---|
| 14 | |
---|
| 15 | private List<ExecTask> executables; |
---|
[490] | 16 | |
---|
[481] | 17 | public ExecutablesList (){ |
---|
| 18 | executables = Collections.synchronizedList(new ArrayList<ExecTask>()); |
---|
| 19 | } |
---|
| 20 | |
---|
[1152] | 21 | public List<ExecTask> getExecutables(String jobId){ |
---|
| 22 | List<ExecTask> list = new ArrayList<ExecTask>(); |
---|
[481] | 23 | synchronized (executables) { |
---|
| 24 | for(int i = 0; i < executables.size(); i++){ |
---|
[1152] | 25 | ExecTask exec = executables.get(i); |
---|
[481] | 26 | |
---|
| 27 | if(exec.getJobId().equals(jobId)) |
---|
| 28 | list.add(exec); |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | return list; |
---|
| 32 | } |
---|
| 33 | |
---|
[1152] | 34 | public List<ExecTask> getExecutable(String jobId, String taskId){ |
---|
[481] | 35 | |
---|
[1152] | 36 | List<ExecTask> list = new ArrayList<ExecTask>(); |
---|
[481] | 37 | synchronized (executables) { |
---|
| 38 | for(int i = 0; i < executables.size(); i++){ |
---|
[1152] | 39 | ExecTask exec = executables.get(i); |
---|
[481] | 40 | |
---|
| 41 | if(exec.getJobId().equals(jobId) && exec.getId().equals(taskId)) |
---|
| 42 | list.add(exec); |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | return list; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | public boolean add(ExecTask arg0) { |
---|
| 50 | return executables.add(arg0); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | public void add(int arg0, ExecTask arg1) { |
---|
| 54 | executables.add(arg0, arg1); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public boolean addAll(Collection<? extends ExecTask> arg0) { |
---|
| 58 | return executables.addAll(arg0); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | public boolean addAll(int arg0, Collection<? extends ExecTask> arg1) { |
---|
| 62 | return executables.addAll(arg0, arg1); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | public void clear() { |
---|
| 66 | executables.clear(); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | public boolean contains(Object arg0) { |
---|
| 70 | return executables.contains(arg0); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | public boolean containsAll(Collection<?> arg0) { |
---|
| 74 | return executables.containsAll(arg0); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | public ExecTask get(int arg0) { |
---|
| 78 | return executables.get(arg0); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | public int indexOf(Object arg0) { |
---|
| 82 | return indexOf(arg0); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | public boolean isEmpty() { |
---|
| 86 | return executables.isEmpty(); |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | public Iterator<ExecTask> iterator() { |
---|
| 90 | return executables.iterator(); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | public int lastIndexOf(Object arg0) { |
---|
| 94 | return executables.lastIndexOf(arg0); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | public ListIterator<ExecTask> listIterator() { |
---|
| 98 | return executables.listIterator(); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | public ListIterator<ExecTask> listIterator(int arg0) { |
---|
| 102 | return executables.listIterator(arg0); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | public boolean remove(Object arg0) { |
---|
| 106 | return executables.remove(arg0); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | public ExecTask remove(int arg0) { |
---|
| 110 | return executables.remove(arg0); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | public boolean removeAll(Collection<?> arg0) { |
---|
| 114 | return executables.removeAll(arg0); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | public boolean retainAll(Collection<?> arg0) { |
---|
| 118 | return executables.retainAll(arg0); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | public ExecTask set(int arg0, ExecTask arg1) { |
---|
| 122 | return executables.set(arg0, arg1); |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | public int size() { |
---|
| 126 | return executables.size(); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | public List<ExecTask> subList(int arg0, int arg1) { |
---|
| 130 | return executables.subList(arg0, arg1); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | public Object[] toArray() { |
---|
| 134 | return executables.toArray(); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | public <T> T[] toArray(T[] arg0) { |
---|
| 138 | return executables.toArray(arg0); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | } |
---|
| 142 | |
---|