21 |
|
|
22 |
package nongnu.cashews.language.process; |
package nongnu.cashews.language.process; |
23 |
|
|
24 |
|
import java.io.Serializable; |
25 |
|
|
26 |
import java.net.URI; |
import java.net.URI; |
27 |
|
import java.net.URISyntaxException; |
28 |
|
|
29 |
/** |
/** |
30 |
* Consumes input for use in a <code>CompositeProcess</code>. |
* Consumes input for use in a <code>CompositeProcess</code>. |
35 |
* @see Performance |
* @see Performance |
36 |
*/ |
*/ |
37 |
public class Consume |
public class Consume |
38 |
|
implements Serializable |
39 |
{ |
{ |
40 |
|
|
41 |
/** |
/** |
65 |
* @serial the index of the destination input. |
* @serial the index of the destination input. |
66 |
*/ |
*/ |
67 |
private int toIndex; |
private int toIndex; |
68 |
|
|
69 |
|
/** |
70 |
|
* Construct a new <code>Consume</code> with the specified |
71 |
|
* destination performance, source and destination inputs, |
72 |
|
* along with the supplied index. |
73 |
|
* |
74 |
|
* @param fromInput the input on the composite process. |
75 |
|
* @param toPerformance the performance to send the input to. |
76 |
|
* @param toInput the input on the destination performance. |
77 |
|
* @param toIndex the index on the input on the destination performance. |
78 |
|
* @throws URISyntaxException if one of the supplied names is not a valid |
79 |
|
* URI. |
80 |
|
*/ |
81 |
|
public Consume(String fromInput, String toPerformance, String toInput, |
82 |
|
int toIndex) |
83 |
|
throws URISyntaxException |
84 |
|
{ |
85 |
|
setFromInput(fromInput); |
86 |
|
setToPerformance(toPerformance); |
87 |
|
setToInput(toInput); |
88 |
|
setToIndex(toIndex); |
89 |
|
} |
90 |
|
|
91 |
|
/** |
92 |
|
* Construct a new <code>Consume</code> with the specified |
93 |
|
* destination performance, source and destination inputs, |
94 |
|
* along with the supplied index. |
95 |
|
* |
96 |
|
* @param fromInput the input on the composite process. |
97 |
|
* @param toPerformance the performance to send the input to. |
98 |
|
* @param toInput the input on the destination performance. |
99 |
|
* @param toIndex the index on the input on the destination performance. |
100 |
|
*/ |
101 |
|
public Consume(URI fromInput, URI toPerformance, URI toInput, |
102 |
|
int toIndex) |
103 |
|
{ |
104 |
|
setFromInput(fromInput); |
105 |
|
setToPerformance(toPerformance); |
106 |
|
setToInput(toInput); |
107 |
|
setToIndex(toIndex); |
108 |
|
} |
109 |
|
|
110 |
|
/** |
111 |
|
* Sets the source input on the composite process to that specified. |
112 |
|
* |
113 |
|
* @param fromInput the new source input on the composite process. |
114 |
|
* @throws URISyntaxException if the supplied input is not a valid URI. |
115 |
|
*/ |
116 |
|
public void setFromInput(String fromInput) |
117 |
|
throws URISyntaxException |
118 |
|
{ |
119 |
|
setFromInput(new URI(fromInput)); |
120 |
|
} |
121 |
|
|
122 |
|
/** |
123 |
|
* Sets the source input on the composite process to that specified. |
124 |
|
* |
125 |
|
* @param fromInput the new source input on the composite process. |
126 |
|
*/ |
127 |
|
public void setFromInput(URI fromInput) |
128 |
|
{ |
129 |
|
this.fromInput = fromInput; |
130 |
|
} |
131 |
|
|
132 |
|
/** |
133 |
|
* Sets the destination performance to that specified. |
134 |
|
* |
135 |
|
* @param toPerformance the new destination performance. |
136 |
|
* @throws URISyntaxException if the supplied performance is not a valid URI. |
137 |
|
*/ |
138 |
|
public void setToPerformance(String toPerformance) |
139 |
|
throws URISyntaxException |
140 |
|
{ |
141 |
|
setToPerformance(new URI(toPerformance)); |
142 |
|
} |
143 |
|
|
144 |
|
/** |
145 |
|
* Sets the destination performance to that specified. |
146 |
|
* |
147 |
|
* @param toPerformance the new destination performance. |
148 |
|
*/ |
149 |
|
public void setToPerformance(URI toPerformance) |
150 |
|
{ |
151 |
|
this.toPerformance = toPerformance; |
152 |
|
} |
153 |
|
|
154 |
|
/** |
155 |
|
* Sets the destination input on the performance to that specified. |
156 |
|
* |
157 |
|
* @param toInput the new destination input on the performance. |
158 |
|
* @throws URISyntaxException if the supplied input is not a valid URI. |
159 |
|
*/ |
160 |
|
public void setToInput(String toInput) |
161 |
|
throws URISyntaxException |
162 |
|
{ |
163 |
|
setToInput(new URI(toInput)); |
164 |
|
} |
165 |
|
|
166 |
|
/** |
167 |
|
* Sets the destination input on the performance to that specified. |
168 |
|
* |
169 |
|
* @param toInput the new destination input on the performance. |
170 |
|
*/ |
171 |
|
public void setToInput(URI toInput) |
172 |
|
{ |
173 |
|
this.toInput = toInput; |
174 |
|
} |
175 |
|
|
176 |
|
/** |
177 |
|
* Sets the index of the input on the performance to that specified. |
178 |
|
* |
179 |
|
* @param toIndex the new index of the input on the performance. |
180 |
|
*/ |
181 |
|
public void setToIndex(int toIndex) |
182 |
|
{ |
183 |
|
this.toIndex = toIndex; |
184 |
|
} |
185 |
|
|
186 |
|
/** |
187 |
|
* Returns a <code>String</code> representation of this performance. |
188 |
|
* |
189 |
|
* @return a textual representation. |
190 |
|
*/ |
191 |
|
public String toString() |
192 |
|
{ |
193 |
|
return getClass().getName() + |
194 |
|
"[fromInput=" + |
195 |
|
fromInput + |
196 |
|
",toPerformance=" + |
197 |
|
toPerformance + |
198 |
|
",toInput=" + |
199 |
|
toInput + |
200 |
|
",toIndex=" + |
201 |
|
toIndex + |
202 |
|
"]"; |
203 |
|
} |
204 |
|
|
205 |
} |
} |
206 |
|
|