| 1 | |
|
| 2 | |
package org.galagosearch.tupleflow.execution; |
| 3 | |
|
| 4 | |
import java.util.ArrayList; |
| 5 | |
import org.galagosearch.tupleflow.IncompatibleProcessorException; |
| 6 | |
import org.galagosearch.tupleflow.Linkage; |
| 7 | |
import org.galagosearch.tupleflow.Processor; |
| 8 | |
import org.galagosearch.tupleflow.Source; |
| 9 | |
import org.galagosearch.tupleflow.Step; |
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | 0 | public class Chain { |
| 16 | 0 | ArrayList<Step> items = new ArrayList(); |
| 17 | |
|
| 18 | |
public void add(Step stage) throws IncompatibleProcessorException { |
| 19 | 0 | if (items.size() > 0) { |
| 20 | |
|
| 21 | 0 | Object previousSource = items.get(items.size() - 1); |
| 22 | 0 | ((Source) previousSource).setProcessor(stage); |
| 23 | |
} |
| 24 | |
|
| 25 | 0 | items.add(stage); |
| 26 | 0 | } |
| 27 | |
|
| 28 | |
public Step getStage() { |
| 29 | 0 | if (items.size() > 0) { |
| 30 | 0 | Step first = items.get(0); |
| 31 | 0 | return first; |
| 32 | |
} |
| 33 | 0 | return null; |
| 34 | |
} |
| 35 | |
} |