{"id":13565359,"url":"https://github.com/j-easy/easy-states","last_synced_at":"2026-01-14T01:52:10.852Z","repository":{"id":56303870,"uuid":"91724482","full_name":"j-easy/easy-states","owner":"j-easy","description":"The simple, stupid state machine for Java","archived":true,"fork":false,"pushed_at":"2020-11-15T22:46:26.000Z","size":204,"stargazers_count":220,"open_issues_count":0,"forks_count":91,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-07-07T01:17:10.509Z","etag":null,"topics":["finite-state-machine","java","state-machine"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j-easy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-18T18:15:57.000Z","updated_at":"2025-04-01T00:26:46.000Z","dependencies_parsed_at":"2022-08-15T16:20:26.163Z","dependency_job_id":null,"html_url":"https://github.com/j-easy/easy-states","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/j-easy/easy-states","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-states","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-states/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-states/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-states/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-easy","download_url":"https://codeload.github.com/j-easy/easy-states/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-states/sbom","scorecard":{"id":499520,"data":{"date":"2025-08-11","repo":{"name":"github.com/j-easy/easy-states","commit":"8229c22a1c41fec429f4e9c6915bf3e32a9a3793"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/j-easy/easy-states/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/j-easy/easy-states/build.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T21:26:57.562Z","repository_id":56303870,"created_at":"2025-08-19T21:26:57.562Z","updated_at":"2025-08-19T21:26:57.562Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finite-state-machine","java","state-machine"],"created_at":"2024-08-01T13:01:45.365Z","updated_at":"2026-01-14T01:52:10.835Z","avatar_url":"https://github.com/j-easy.png","language":"Java","funding_links":[],"categories":["Libraries","Java"],"sub_categories":["Java"],"readme":"***\n\n\u003cdiv align=\"center\"\u003e\n    \u003cb\u003e\u003cem\u003eEasy States\u003c/em\u003e\u003c/b\u003e\u003cbr\u003e\n    The simple, stupid finite state machine for Java\u0026trade;\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/j-easy/easy-states/workflows/Java%20CI/badge.svg)](https://github.com/j-easy/easy-states/actions)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jeasy/easy-states/badge.svg?style=flat)](http://search.maven.org/#artifactdetails|org.jeasy|easy-states|2.0.0|)\n[![Javadoc](https://www.javadoc.io/badge/org.jeasy/easy-states.svg)](http://www.javadoc.io/doc/org.jeasy/easy-states)\n\n\u003c/div\u003e\n\n***\n\n## Latest news\n\n* 13/03/2020: Version 2.0.0 is now released! This version is based on Java 8 and comes with a number of enhancements. Take a look at the [release notes](https://github.com/j-easy/easy-states/releases) for all details.\n\n## What is Easy States?\n\nEasy States is an event-driven [Deterministic Finite Automaton](http://en.wikipedia.org/wiki/Deterministic_finite_state_machine) implementation in Java.\n\nIt is inspired by [Erlang](http://www.erlang.org/documentation/doc-5.9.3/doc/design_principles/fsm.html) design principles which describe a Finite State Machine as a set of relations of the form:\n\n`State(S) x Event(E) -\u003e Actions(A), State(S')`\n\nThese relations are interpreted like follows:\n\nIf we are in state `S` and the event `E` occurs, we should perform action(s) `A` and make a transition to the state `S'`.\n\n## How does it work?\n\nEasy States provides APIs for key concepts of state machines:\n\n* `State`: a particular state on which the machine can be at a given point in time\n* `Event`: represents an event that may trigger an action and change the state of the machine\n* `Transition`: represents a transition between two states of the machine when an event occurs\n* `FiniteStateMachine`: core abstraction of a finite state machine\n\nUsing Easy States, you can define FSM transitions with an intuitive fluent API:\n\n```java\nTransition t = new TransitionBuilder()\n        .sourceState(s0) //if we are in state s0\n        .eventType(Event.class) // and the event E occurs\n        .eventHandler(myActionA) // we should perform the actions A\n        .targetState(s1) // and make a transition to the state s1\n        .build();\n```\n\n## How to use it?\n\nEasy States has no dependencies. You can [download](https://repo.maven.apache.org/maven2/org/jeasy/easy-states/) the `easy-states-2.0.0.jar` file and add it to your application's classpath.\nIf you use maven, add the following dependency to your `pom.xml`:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.jeasy\u003c/groupId\u003e\n    \u003cartifactId\u003eeasy-states\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nEasy States requires a Java 8+ runtime.\n\n## Two minutes tutorial\n\nThis tutorial is an implementation of the turnstile example described in \u003ca href=\"http://en.wikipedia.org/wiki/Finite-state_machine\"\u003ewikipedia\u003c/a\u003e:\n\nA turnstile has two states: `Locked` and `Unlocked`. There are two inputs that affect its state: putting a coin in the slot (coin) and pushing the arm (push).\nIn the locked state, pushing on the arm has no effect; no matter how many times the input push is given it stays in the locked state.\nPutting a coin in, that is giving the machine a coin input, shifts the state from `Locked` to `Unlocked`.\nIn the unlocked state, putting additional coins in has no effect; that is, giving additional coin inputs does not change the state.\n\n\u003cdiv align=\"center\"\u003e\n\n![turnsitle](https://raw.githubusercontent.com/j-easy/easy-states/master/src/test/java/org/jeasy/states/samples/turnstile/turnstile.png)\n\n\u003c/div\u003e\n\nFor this example, we define:\n\n* two states: `Locked` and `Unlocked`\n* two events: `PushEvent` and `CoinEvent`\n* two actions: `Lock` and `Unlock`\n* and four transitions: `pushLocked`, `unlock`, `coinUnlocked` and `lock`\n\n#### 1. First, let's define states\n\n```java\nState locked = new State(\"locked\");\nState unlocked = new State(\"unlocked\");\n\nSet\u003cState\u003e states = new HashSet\u003c\u003e();\nstates.add(locked);\nstates.add(unlocked);\n```\n\n#### 2. Then, define events\n\n```java\nclass PushEvent extends AbstractEvent { }\nclass CoinEvent extends AbstractEvent { }\n```\n\n#### 3. Then transitions\n\n```java\nTransition unlock = new TransitionBuilder()\n        .name(\"unlock\")\n        .sourceState(locked)\n        .eventType(CoinEvent.class)\n        .eventHandler(new Unlock())\n        .targetState(unlocked)\n        .build();\n\nTransition pushLocked = new TransitionBuilder()\n        .name(\"pushLocked\")\n        .sourceState(locked)\n        .eventType(PushEvent.class)\n        .targetState(locked)\n        .build();\n\nTransition lock = new TransitionBuilder()\n        .name(\"lock\")\n        .sourceState(unlocked)\n        .eventType(PushEvent.class)\n        .eventHandler(new Lock())\n        .targetState(locked)\n        .build();\n\nTransition coinUnlocked = new TransitionBuilder()\n        .name(\"coinUnlocked\")\n        .sourceState(unlocked)\n        .eventType(CoinEvent.class)\n        .targetState(unlocked)\n        .build();\n```\n\n#### 4. And finally the finite state machine\n\n```java\nFiniteStateMachine turnstileStateMachine = new FiniteStateMachineBuilder(states, locked)\n        .registerTransition(lock)\n        .registerTransition(pushLocked)\n        .registerTransition(unlock)\n        .registerTransition(coinUnlocked)\n        .build();\n```\n\nThe complete code of this tutorial can be found [here](https://github.com/j-easy/easy-states/tree/master/src/test/java/org/jeasy/states/samples/turnstile).\n\nTo run the tutorial, please follow these instructions:\n\n```bash\n$\u003egit clone https://github.com/j-easy/easy-states.git\n$\u003ecd easy-states\n$\u003emvn install\n$\u003emvn exec:java -P runTurnstileTutorial\n```\n\nYou will be able to fire events interactively from the console and check the evolution of the machine's state.\n\n## License\n\nEasy States is released under the terms of the MIT License:\n\n```\nThe MIT License\n\n   Copyright (c) 2020, Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)\n\n   Permission is hereby granted, free of charge, to any person obtaining a copy\n   of this software and associated documentation files (the \"Software\"), to deal\n   in the Software without restriction, including without limitation the rights\n   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n   copies of the Software, and to permit persons to whom the Software is\n   furnished to do so, subject to the following conditions:\n\n   The above copyright notice and this permission notice shall be included in\n   all copies or substantial portions of the Software.\n\n   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n   THE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-easy%2Feasy-states","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-easy%2Feasy-states","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-easy%2Feasy-states/lists"}