Package chapter3

Examples of chapter3.AddStatusListenerApp


    //
    // We will let the XML file to teach the Joran interpreter about new rules
    ruleMap.put(
      new Pattern("/computation/new-rule"), new NewRuleAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
      }
View Full Code Here


    // Associate "hello-world" pattern with  HelloWorldAction
    ruleMap.put(new Pattern("hello-world"), new HelloWorldAction());

    // Joran needs to work within a context.
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
      }
View Full Code Here

    ruleMap.put(new Pattern("*/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("*/computation/add"), new AddAction());
    ruleMap.put(new Pattern("*/computation/multiply"), new MultiplyAction());
   
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
  }
View Full Code Here

    // --------------------------+
    // Add an implicit action.   |
    // --------------------------+
    iaList.add(new PrintMeImplicitAction());
   
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap, iaList);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
   
View Full Code Here

    // Other associations
    ruleMap.put(new Pattern("/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("/computation/add"), new AddAction());
    ruleMap.put(new Pattern("/computation/multiply"), new MultiplyAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
  }
View Full Code Here

 
   
    Map<Pattern, Action> ruleMap = new HashMap<Pattern, Action>();

    // we start with the rule for the top-most (root) element
    ruleMap.put(new Pattern("*/computation"), new ComputationAction2());

    // Associate "/new-rule" pattern with NewRuleAction from the
    // org.apache.joran.action package.
    //
    // We will let the XML file to teach the Joran interpreter about new rules
View Full Code Here

        Fill fi = new Fill(inputs.eClearSale.map(u -> Unit.UNIT),
                           inputs.eFuelPulses, inputs.calibration,
                           inputs.price1, inputs.price2, inputs.price3,
                           eStart);
        NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.eNozzle1,
                              inputs.eNozzle2,
                              inputs.eNozzle3),
                inputs.eClearSale,
                fi);
        eStart.loop(np.eStart);
View Full Code Here

import sodium.*;
import java.util.Optional;

public class AccumulatePulsesPump implements Pump {
    public Outputs create(Inputs inputs) {
        LifeCycle lc = new LifeCycle(inputs.eNozzle1,
                                     inputs.eNozzle2,
                                     inputs.eNozzle3);
        Behavior<Double> litersDelivered =
                accumulate(lc.eStart.map(u -> Unit.UNIT),
                           inputs.eFuelPulses,
View Full Code Here

                          inputs.eClearSale.map(u -> Unit.UNIT),
                          inputs.eFuelPulses, inputs.calibration,
                          inputs.price1, inputs.price2, inputs.price3,
                          eStart);
        NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.eNozzle1,
                              inputs.eNozzle2,
                              inputs.eNozzle3),
                inputs.eClearSale,
                fi);
        eStart.loop(np.eStart);
View Full Code Here

import sodium.*;
import java.util.Optional;

public class ShowDollarsPump implements Pump {
    public Outputs create(Inputs inputs) {
        LifeCycle lc = new LifeCycle(inputs.eNozzle1,
                                     inputs.eNozzle2,
                                     inputs.eNozzle3);
        Fill fi = new Fill(lc.eStart.map(u -> Unit.UNIT),
                           inputs.eFuelPulses, inputs.calibration,
                           inputs.price1, inputs.price2, inputs.price3,
View Full Code Here

TOP

Related Classes of chapter3.AddStatusListenerApp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.