Examples of UntypedAnonymousAction


Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

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

    private static UntypedAnonymousAction storeEventAndFire(final UntypedStateMachine otherFsm, final Context otherCtx,
            final FSMEvent otherEvent) {
        return new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event, Object context, UntypedStateMachine stateMachine) {
                ((Context) context).lastEvent = (FSMEvent) event;
                otherFsm.fire(otherEvent, otherCtx);
            }
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

            }
        };
    }

    private static UntypedAnonymousAction storeState() {
        return new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event, Object context, UntypedStateMachine stateMachine) {
                ((Context) context).lastEvent = (FSMEvent) event;
            }
        };
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

    @SuppressWarnings("unused")
    public void testTimedState() {
        final StringBuilder logger = new StringBuilder();
        // timed state must be defined before transition
        builder.defineTimedState("A", 10, 100, "FIRST", null);
        builder.internalTransition().within("A").on("FIRST").perform(new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event,
                    Object context, UntypedStateMachine stateMachine) {
                if (logger.length() > 0) {
                    logger.append('.');
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

    }
   
    @Test(timeout=1000)
    public void testTimedoutActionCall() {
        builder.transition().from("A").to("B").on("FIRST")
                .perform(new UntypedAnonymousAction() {
                    @Override
                    public void execute(Object from, Object to, Object event,
                            Object context, UntypedStateMachine stateMachine) {
                        try {
                            Thread.sleep(100000);
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

    }
   
    @Test
    public void testAsyncActionException() {
        final String errMsg = "This exception is thrown on purpse.";
        builder.transition().from("A").to("B").on("FIRST").perform(new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event, Object context,
                    UntypedStateMachine stateMachine) {
                throw new IllegalArgumentException(errMsg);
            }
View Full Code Here

Examples of org.squirrelframework.foundation.fsm.UntypedAnonymousAction

        fail();
    }
   
    @Test
    public void testAsynActionExecOrder() {
        builder.onExit("AsyncA").perform(new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event,
                    Object context, UntypedStateMachine stateMachine) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
            }

            @Override
            public boolean isAsync() {
                return true;
            }
           
            @Override
            public String name() {
                return "Exit-AsyncA";
            }
        });

        builder.externalTransition().from("AsyncA").to("AsyncB")
                .on("AsyncFirst").perform(new UntypedAnonymousAction() {
                    @Override
                    public void execute(Object from, Object to, Object event,
                            Object context, UntypedStateMachine stateMachine) {
                        try {
                            Thread.sleep(300);
                        } catch (InterruptedException e) {
                        }
                    }

                    @Override
                    public boolean isAsync() {
                        return true;
                    }
                   
                    @Override
                    public String name() {
                        return "AsyncA-AsyncB";
                    }
                });

        builder.onEntry("AsyncB").perform(new UntypedAnonymousAction() {
            @Override
            public void execute(Object from, Object to, Object event,
                    Object context, UntypedStateMachine stateMachine) {
                try {
                    Thread.sleep(100);
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.