Package com.tomgibara.pronto.state

Examples of com.tomgibara.pronto.state.StateFactory


    return editor.getGraph();
  }


  static StateEngine<State, Label, Object> createEngine() {
    StateFactory factory = StateFactory.getInstance();
    StateEngine<State, Label, Object> engine = factory.newEngine(graph, new Activator());
    engine.setState(State.constructed);
    return engine;
  }
View Full Code Here


    assertFalse( ControlFactory.getInstance().isSettingsIfaceSupported(DudSettings.class) );
  }
 
  public void testBadIface() {
    DudSettings settings = new DudSettings() {};
    StateFactory factory = StateFactory.getInstance();
    StateGraph graph = factory.emptyStateGraph();
    StateActivator activator = new StateActivator() {
      public void changeState(Object arg0) throws com.tomgibara.pronto.state.ProntoStateException ,RuntimeException {};
      public void transitionState(com.tomgibara.pronto.state.StateTransition arg0, Object arg1) throws com.tomgibara.pronto.state.ProntoStateException ,RuntimeException {};
    };
    StateEngine engine = factory.newEngine(graph, activator);
    EngineControlAdapter adapter = new EngineControlAdapter() {
      public Object labelFromName(String name) { return null; };
      public String nameFromLabel(Object label) { return null; };
      public Object parseParameter(String string) { return null; };
    };
View Full Code Here

        new Example().run();
    }

    StateGraph<State, Label> createGraph() {
        // create the editor
        StateFactory factory = StateFactory.getInstance();
        StateGraph<State, Label> empty = factory.emptyStateGraph();
        StateGraphEditor<State, Label> editor = empty.newEditor();
        // define the graph
        editor.addTransition(State.constructed, Label.init, State.initialized);
        editor.addTransition(State.initialized, Label.start, State.started);
        editor.addTransition(State.started, Label.stop, State.initialized);
View Full Code Here

        return editor.getGraph();
    }

    StateEngine<State, Label, Object> createEngine() {
        StateGraph<State, Label> graph = createGraph();
        StateFactory factory = StateFactory.getInstance();
        StateActivator<State, Label, Object> activator = new StateActivator<State, Label, Object>() {
            public void changeState(State state) {
                System.out.println(state);
            }

            public void transitionState(StateTransition<State, Label> transition, Object parameter) {
                System.out.println(transition);
            }
        };
        return factory.newEngine(graph, activator);
    }
View Full Code Here

TOP

Related Classes of com.tomgibara.pronto.state.StateFactory

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.