| 1 | |
|
| 2 | |
|
| 3 | |
package org.galagosearch.tupleflow; |
| 4 | |
|
| 5 | |
import java.io.IOException; |
| 6 | |
import org.galagosearch.tupleflow.execution.Verified; |
| 7 | |
import org.galagosearch.tupleflow.types.XMLFragment; |
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
@InputClass(className="org.galagosearch.tupleflow.types.XMLFragment") |
| 15 | |
@OutputClass(className="org.galagosearch.tupleflow.types.XMLFragment", order={"+nodePath"}) |
| 16 | |
@Verified |
| 17 | 0 | public class XMLMinimum extends StandardStep<XMLFragment, XMLFragment> { |
| 18 | 0 | double minimum = 0; |
| 19 | 0 | String key = ""; |
| 20 | |
|
| 21 | |
public void process(XMLFragment fragment) { |
| 22 | 0 | if(key == null) |
| 23 | 0 | key = fragment.nodePath; |
| 24 | 0 | minimum = Math.min(minimum, Double.parseDouble(fragment.innerText)); |
| 25 | 0 | System.err.println("XMLMinimum: " + minimum); |
| 26 | 0 | } |
| 27 | |
|
| 28 | |
public void close() throws IOException { |
| 29 | 0 | processor.process(new XMLFragment(key, Double.toString(minimum))); |
| 30 | 0 | super.close(); |
| 31 | 0 | } |
| 32 | |
} |