首页    期刊浏览 2024年12月04日 星期三
登录注册

文章基本信息

  • 标题:Using Java Enums to Implement Concurrent-Hierarchical State Machines
  • 本地全文:下载
  • 作者:Jauhar Ali
  • 期刊名称:Journal of Software Engineering
  • 印刷版ISSN:1819-4311
  • 电子版ISSN:2152-0941
  • 出版年度:2010
  • 卷号:4
  • 期号:3
  • 页码:215-230
  • DOI:10.3923/jse.2010.215.230
  • 出版社:Academic Journals Inc., USA
  • 摘要:The aim of this study is to find an easy way for implementing concurrent-hierarchical state machines into efficient and encapsulated Java code. State Machine is one of the important diagrams in Unified Modeling Language (UML). In UML, State Machine is used to represent reactive behavior of a class of objects. Implementing a state machine has been difficult for programmers because the commonly used Object-Oriented Programming languages do not provide any explicit support. We present a new approach to implement state machines using Java Enums. In our approach, each state is represented as an enum-value. Hierarchical states and concurrent orthogonal regions within state machines are implemented by linking the related enum-values to each other. Our approach offers several benefits. First, using Java enums makes the resulting code compact, efficient and easy to understand. Second, the structure of the state machine is obvious in the implementation code. Third, the whole state machine's behavior is encapsulated within a single class (called StateMachine). The proposed code can serve as a Java implementation pattern for state machines.
国家哲学社会科学文献中心版权所有