Examples of externalTransition()


Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

    }

    @Test
    public void testIssue18() {
        final UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(Issue18StateMachine.class);
        builder.externalTransition(10).from(Issue18State.A).to(Issue18State.B).on(Issue18Event.GO).
                when(new CounterCondition(5, "Count_5_A")).callMethod("onA2B");
        builder.internalTransition(1).within(Issue18State.A).on(Issue18Event.GO).callMethod("onA2A");

        builder.externalTransition(10).from(Issue18State.B).to(Issue18State.A).on(Issue18Event.GO).
                when(new CounterCondition(5, "Count_5_B")).callMethod("onB2A");
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

        final UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(Issue18StateMachine.class);
        builder.externalTransition(10).from(Issue18State.A).to(Issue18State.B).on(Issue18Event.GO).
                when(new CounterCondition(5, "Count_5_A")).callMethod("onA2B");
        builder.internalTransition(1).within(Issue18State.A).on(Issue18Event.GO).callMethod("onA2A");

        builder.externalTransition(10).from(Issue18State.B).to(Issue18State.A).on(Issue18Event.GO).
                when(new CounterCondition(5, "Count_5_B")).callMethod("onB2A");
        builder.internalTransition(1).within(Issue18State.B).on(Issue18Event.GO).callMethod("onB2B");

        Issue18StateMachine fsm = builder.newUntypedStateMachine(Issue18State.A);
        fsm.start();
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

        UntypedStateMachineBuilder fsmAtoB_builder = StateMachineBuilderFactory.create(StateMachineSample.class);

        // In transitioning from A to B trigger other FSM (fsmBtoA) to
        // transition
        // to A...
        fsmAtoB_builder.externalTransition().from("A").to("B").on(FSMEvent.ToB)
                .perform(storeEventAndFire(fsmBtoA, ctxBtoA, FSMEvent.ToA));
        fsmAtoB_builder.externalTransition().from("B").to("A").on(FSMEvent.ToA).perform(storeState());

        fsmAtoB = fsmAtoB_builder.newStateMachine("A");
    }
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

        // In transitioning from A to B trigger other FSM (fsmBtoA) to
        // transition
        // to A...
        fsmAtoB_builder.externalTransition().from("A").to("B").on(FSMEvent.ToB)
                .perform(storeEventAndFire(fsmBtoA, ctxBtoA, FSMEvent.ToA));
        fsmAtoB_builder.externalTransition().from("B").to("A").on(FSMEvent.ToA).perform(storeState());

        fsmAtoB = fsmAtoB_builder.newStateMachine("A");
    }

    private void createFsmBtoA() {
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

        fsmAtoB = fsmAtoB_builder.newStateMachine("A");
    }

    private void createFsmBtoA() {
        UntypedStateMachineBuilder fsmBtoA_builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        fsmBtoA_builder.externalTransition().from("A").to("B").on(FSMEvent.ToB).perform(storeState());
        fsmBtoA_builder.externalTransition().from("B").to("A").on(FSMEvent.ToA).perform(storeState());

        fsmBtoA = fsmBtoA_builder.newStateMachine("B");
    }
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

    }

    private void createFsmBtoA() {
        UntypedStateMachineBuilder fsmBtoA_builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        fsmBtoA_builder.externalTransition().from("A").to("B").on(FSMEvent.ToB).perform(storeState());
        fsmBtoA_builder.externalTransition().from("B").to("A").on(FSMEvent.ToA).perform(storeState());

        fsmBtoA = fsmBtoA_builder.newStateMachine("B");
    }

    private static UntypedAnonymousAction storeEventAndFire(final UntypedStateMachine otherFsm, final Context otherCtx,
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

    }
   
    public static void main(String[] args) {
        // 3. Build State Transitions
        UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        builder.externalTransition().from("A").to("B").on(FSMEvent.ToB).callMethod("fromAToB");
        builder.onEntry("B").callMethod("ontoB");
       
        // 4. Use State Machine
        UntypedStateMachine fsm = builder.newStateMachine("A");
        fsm.fire(FSMEvent.ToB, 10);
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

   
    @Test
    public void testMultipleEvents() {
        System.out.println("Test run on thread "+Thread.currentThread().getName());
        UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        builder.externalTransition().from("D").to("A").on(FSMEvent.ToA);
        builder.externalTransition().from("A").to("B").on(FSMEvent.ToB);
        builder.externalTransition().from("B").to("C").on(FSMEvent.ToC);
        builder.externalTransition().from("C").to("D").on(FSMEvent.ToD);
       
        final StateMachineSample fsm = builder.newUntypedStateMachine("D");
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

    @Test
    public void testMultipleEvents() {
        System.out.println("Test run on thread "+Thread.currentThread().getName());
        UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        builder.externalTransition().from("D").to("A").on(FSMEvent.ToA);
        builder.externalTransition().from("A").to("B").on(FSMEvent.ToB);
        builder.externalTransition().from("B").to("C").on(FSMEvent.ToC);
        builder.externalTransition().from("C").to("D").on(FSMEvent.ToD);
       
        final StateMachineSample fsm = builder.newUntypedStateMachine("D");
        fsm.addDeclarativeListener(new TestListener());
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachineBuilder.externalTransition()

    public void testMultipleEvents() {
        System.out.println("Test run on thread "+Thread.currentThread().getName());
        UntypedStateMachineBuilder builder = StateMachineBuilderFactory.create(StateMachineSample.class);
        builder.externalTransition().from("D").to("A").on(FSMEvent.ToA);
        builder.externalTransition().from("A").to("B").on(FSMEvent.ToB);
        builder.externalTransition().from("B").to("C").on(FSMEvent.ToC);
        builder.externalTransition().from("C").to("D").on(FSMEvent.ToD);
       
        final StateMachineSample fsm = builder.newUntypedStateMachine("D");
        fsm.addDeclarativeListener(new TestListener());
        String expected1 = (String) fsm.test(FSMEvent.ToA, 5);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.