package edu.rice.comp322; import edu.rice.hj.Module0; import edu.rice.hj.runtime.actors.Actor; import static edu.rice.hj.Module0.launchHabaneroApp; /** *
SimplePipeline class.
* * @author Shams Imam (shams@rice.edu) */ public final class Lec29Slide6Pipeline { /** * Disallow instance creation of utility class. */ private Lec29Slide6Pipeline() { super(); } /** *main.
* * @param args an array of {@link String} objects. */ public static void main(final String[] args) { launchHabaneroApp(() -> { // chain the actors final EchoStage echoStage = new EchoStage(); final LowerCaseFilter lowerCaseFilterStage = new LowerCaseFilter(echoStage); final EvenLengthFilter evenLengthFilterStage = new EvenLengthFilter(lowerCaseFilterStage); evenLengthFilterStage.start(); evenLengthFilterStage.send("A"); evenLengthFilterStage.send("Simple"); evenLengthFilterStage.send("pipeline"); evenLengthFilterStage.send("with"); evenLengthFilterStage.send("3"); evenLengthFilterStage.send("stages"); evenLengthFilterStage.send(new StopMessage()); }); } private static class StopMessage { } /** * Only forwards inputs with even length strings */ private static class EvenLengthFilter extends Actor