Book a Demo

Author Topic: State Machine Code Generation  (Read 3927 times)

Welcome

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
State Machine Code Generation
« on: November 18, 2015, 07:24:23 pm »
I have generated codes by state machine.

The code starts as follows.
How/Where could I get the java library for StateMachineContext?

Thanks
----------------------------------------------------------------------------
public class CentSwitch implements StateMachineContext {

      private int input_num;

      /* Begin - EA generated code for  Activities and Interactions */
      public void printCurrentState()
      {
            // behavior is a Activity
            System.out.println(m_onoffswitch.toString());
      }

      public void readNumber()
      {
            // behavior is a Activity
            Scanner in = new Scanner(System.in);
            input_num = in.nextInt();
      }

      /* End - EA generated code for  Activities and Interactions */
      /* Begin - EA generated code for StateMachine */


      enum StateMachineEnum
      {
            NOSTATEMACHINE,
            CentSwitch_ENUM_ONOFFSWITCH
      };
« Last Edit: November 19, 2015, 11:01:07 am by seungk.park »

MMA

  • EA User
  • **
  • Posts: 63
  • Karma: +3/-0
    • View Profile
Re: State Machine Code Generation
« Reply #1 on: November 20, 2015, 09:00:49 am »
I believe you generated this file from the class element.

go through these steps and you will have a bunch of files which can pass compile and you can execute/simulate.

http://www.sparxsystems.com.au/enterprise_architect_user_guide/11/software_engineering/code_state_machine.html

Hope that helps  ;)

Welcome

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: State Machine Code Generation
« Reply #2 on: November 23, 2015, 12:08:04 pm »
HI MMA,

It really helps me, and I am finally able to execute the codes from state machine.

Thanks so much. ;)