KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > ResultHolderList


1 package com.opensymphony.workflow.designer;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.Iterator JavaDoc;
5 import java.util.List JavaDoc;
6
7 import com.opensymphony.workflow.loader.ResultDescriptor;
8
9 public class ResultHolderList extends ArrayList JavaDoc
10 {
11   public List JavaDoc getResultsToStep(int stepId)
12   {
13     Iterator JavaDoc results = iterator();
14     List JavaDoc returnValue = new ArrayList JavaDoc();
15     while(results.hasNext())
16     {
17       ResultHolder result = (ResultHolder)results.next();
18       if(stepId == result.getStep())
19       {
20         returnValue.add(result);
21       }
22     }
23     return returnValue;
24   }
25
26   public List JavaDoc getResultsToSplit(int splitId)
27   {
28     Iterator JavaDoc results = iterator();
29     List JavaDoc returnValue = new ArrayList JavaDoc();
30     while(results.hasNext())
31     {
32       ResultHolder result = (ResultHolder)results.next();
33       if(splitId == result.getSplit())
34       {
35         returnValue.add(result);
36       }
37     }
38     return returnValue;
39   }
40
41   public List JavaDoc getResultsToJoin(int joinId)
42   {
43     Iterator JavaDoc results = iterator();
44     List JavaDoc returnValue = new ArrayList JavaDoc();
45     while(results.hasNext())
46     {
47       ResultHolder result = (ResultHolder)results.next();
48       if(joinId == result.getJoin())
49       {
50         returnValue.add(result);
51       }
52     }
53     return returnValue;
54   }
55
56   public ResultHolder getResultCell(ResultDescriptor result)
57   {
58     ResultHolder ret = null;
59
60     Iterator JavaDoc iter = iterator();
61     while(iter.hasNext())
62     {
63       ret = (ResultHolder)iter.next();
64       if(ret.getDescriptor() == result)
65       {
66         return ret;
67       }
68     }
69
70     return null;
71   }
72 }
73
Popular Tags