Kairos Automat

Kairos Automat is a finite-state machine library

License

License

Categories

Categories

Net Auto Application Layer Libs Code Generators
GroupId

GroupId

net.pechorina.kairos.automat
ArtifactId

ArtifactId

kairos-automat
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Kairos Automat
Kairos Automat is a finite-state machine library
Project URL

Project URL

https://github.com/vpechorin/kairos-automat
Source Code Management

Source Code Management

https://github.com/vpechorin/kairos-automat

Download kairos-automat

How to add to project

<!-- https://jarcasting.com/artifacts/net.pechorina.kairos.automat/kairos-automat/ -->
<dependency>
    <groupId>net.pechorina.kairos.automat</groupId>
    <artifactId>kairos-automat</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.pechorina.kairos.automat/kairos-automat/
implementation 'net.pechorina.kairos.automat:kairos-automat:0.3.0'
// https://jarcasting.com/artifacts/net.pechorina.kairos.automat/kairos-automat/
implementation ("net.pechorina.kairos.automat:kairos-automat:0.3.0")
'net.pechorina.kairos.automat:kairos-automat:jar:0.3.0'
<dependency org="net.pechorina.kairos.automat" name="kairos-automat" rev="0.3.0">
  <artifact name="kairos-automat" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.pechorina.kairos.automat', module='kairos-automat', version='0.3.0')
)
libraryDependencies += "net.pechorina.kairos.automat" % "kairos-automat" % "0.3.0"
[net.pechorina.kairos.automat/kairos-automat "0.3.0"]

Dependencies

runtime (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.50
io.github.microutils : kotlin-logging jar 1.6.26

Project Modules

There are no modules declared in this project.

Kairos Automat

==== Build Status codecov

Kairos Automat is a finite-state machine (FSM) library

Kairos Automat aims to provide following features:

  • Easy to use flat one level state machine for simple use cases
  • Hierarchical state machine structure to ease complex state configuration
  • Builder pattern for easy instantiation
  • State entry/exit actions
  • Extended state
  • Transition actions
  • State machine event listeners

Getting Started

enum class States {
    S1, S2, S3
}

enum class Events {
    E1, E2
}

val configurer = AutomatBuilder<States, Events>()
        .withConfig()
        .enableLogging()

configurer
        .configureStates()
            .initial(States.S1)
            .states(States.values().toList())
            .end(States.S3)
            
configurer
    .configureTransitions()
        .withExternal()
            .event(Events.E1).source(States.S1).target(States.S2)
            .and()
        .withExternal()
            .event(Events.E2).source(States.S2).target(States.S3)

val machine = configurer.build()

machine.start()

a.sendEvent(Events.E1)
a.sendEvent(Events.E2)

machine.stop()

Installing

Maven

<dependency>
  <groupId>net.pechorina.kairos.automat</groupId>
  <artifactId>kairos-automat</artifactId>
  <version>0.2.0</version>
</dependency>

Gradle

compile 'net.pechorina.kairos.automat:kairos-automat:0.2.0'

Built With

  • gradle - Dependency Management
  • kotlin - Programming language for JVM
  • kotlin-logging - A convenient and performant logging library wrapping slf4

Contributing

Pull requests are welcome!

Authors

  • Victor Pechorin - Initial work - GitHub

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details

Acknowledgments

Versions

Version
0.3.0
0.2.0
0.1.0