| 1 | |
|
| 2 | |
package org.galagosearch.tupleflow.execution; |
| 3 | |
|
| 4 | |
import java.io.Serializable; |
| 5 | |
import java.util.ArrayList; |
| 6 | |
import java.util.HashMap; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | 0 | public class Stage extends Locatable implements Serializable, Cloneable { |
| 14 | 4 | public HashMap<String, StageConnectionPoint> connections = new HashMap<String, StageConnectionPoint>(); |
| 15 | 4 | public ArrayList<Step> steps = new ArrayList<Step>(); |
| 16 | |
public String name; |
| 17 | |
|
| 18 | |
public Stage() { |
| 19 | 0 | super(null); |
| 20 | 0 | } |
| 21 | |
|
| 22 | |
public Stage(String name) { |
| 23 | 4 | super(null); |
| 24 | 4 | this.name = name; |
| 25 | 4 | } |
| 26 | |
|
| 27 | |
public Stage(FileLocation location) { |
| 28 | 0 | super(location); |
| 29 | 0 | } |
| 30 | |
|
| 31 | |
public ArrayList<Step> getSteps() { |
| 32 | 0 | return steps; |
| 33 | |
} |
| 34 | |
|
| 35 | |
public boolean containsInput(String name) { |
| 36 | 0 | return connections.containsKey(name) && |
| 37 | |
connections.get(name).type == ConnectionPointType.Input; |
| 38 | |
} |
| 39 | |
|
| 40 | |
public boolean containsOutput(String name) { |
| 41 | 0 | return connections.containsKey(name) && |
| 42 | |
connections.get(name).type == ConnectionPointType.Output; |
| 43 | |
} |
| 44 | |
|
| 45 | |
public HashMap<String, StageConnectionPoint> getConnections() { |
| 46 | 0 | return connections; |
| 47 | |
} |
| 48 | |
|
| 49 | |
public StageConnectionPoint getConnection(String pointName) { |
| 50 | 0 | return connections.get(pointName); |
| 51 | |
} |
| 52 | |
|
| 53 | |
@Override |
| 54 | |
public Stage clone() { |
| 55 | 0 | Stage result = null; |
| 56 | |
|
| 57 | |
try { |
| 58 | 0 | result = (Stage) super.clone(); |
| 59 | 0 | result.name = name; |
| 60 | 0 | result.steps = new ArrayList<Step>(steps); |
| 61 | 0 | result.connections = new HashMap<String, StageConnectionPoint>(connections); |
| 62 | 0 | } catch (CloneNotSupportedException e) { |
| 63 | 0 | throw new RuntimeException("Didn't expect clone to not be supported in superclass", e); |
| 64 | 0 | } |
| 65 | |
|
| 66 | 0 | return result; |
| 67 | |
} |
| 68 | |
|
| 69 | |
public void add(StageConnectionPoint point) { |
| 70 | 4 | connections.put(point.getExternalName(), point); |
| 71 | 4 | } |
| 72 | |
|
| 73 | |
public void add(Step step) { |
| 74 | 0 | steps.add(step); |
| 75 | 0 | } |
| 76 | |
} |
| 77 | |
|