01: package com.opensymphony.workflow.designer;
02:
03: import java.util.ArrayList;
04: import java.util.Iterator;
05: import java.util.List;
06:
07: import com.opensymphony.workflow.loader.ResultDescriptor;
08:
09: public class ResultHolderList extends ArrayList {
10: public List getResultsToStep(int stepId) {
11: Iterator results = iterator();
12: List returnValue = new ArrayList();
13: while (results.hasNext()) {
14: ResultHolder result = (ResultHolder) results.next();
15: if (stepId == result.getStep()) {
16: returnValue.add(result);
17: }
18: }
19: return returnValue;
20: }
21:
22: public List getResultsToSplit(int splitId) {
23: Iterator results = iterator();
24: List returnValue = new ArrayList();
25: while (results.hasNext()) {
26: ResultHolder result = (ResultHolder) results.next();
27: if (splitId == result.getSplit()) {
28: returnValue.add(result);
29: }
30: }
31: return returnValue;
32: }
33:
34: public List getResultsToJoin(int joinId) {
35: Iterator results = iterator();
36: List returnValue = new ArrayList();
37: while (results.hasNext()) {
38: ResultHolder result = (ResultHolder) results.next();
39: if (joinId == result.getJoin()) {
40: returnValue.add(result);
41: }
42: }
43: return returnValue;
44: }
45:
46: public ResultHolder getResultCell(ResultDescriptor result) {
47: ResultHolder ret = null;
48:
49: Iterator iter = iterator();
50: while (iter.hasNext()) {
51: ret = (ResultHolder) iter.next();
52: if (ret.getDescriptor() == result) {
53: return ret;
54: }
55: }
56:
57: return null;
58: }
59: }
|