{"id":17349081,"url":"https://github.com/arturwincenciak/root-nodes-workflow-pattern","last_synced_at":"2026-04-28T11:35:10.136Z","repository":{"id":21690566,"uuid":"25011866","full_name":"ArturWincenciak/Root-Nodes-Workflow-Pattern","owner":"ArturWincenciak","description":"This is a framework for implementing a tree-like structure in C#. It consists of two main classes: Root and Node.","archived":false,"fork":false,"pushed_at":"2022-12-28T20:20:36.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-24T10:50:26.936Z","etag":null,"topics":["csharp","dotnet","state-machine","state-machine-pattern"],"latest_commit_sha":null,"homepage":"","language":"C#","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/ArturWincenciak.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":"2014-10-09T22:53:43.000Z","updated_at":"2023-08-14T14:56:16.000Z","dependencies_parsed_at":"2023-01-11T21:19:14.233Z","dependency_job_id":null,"html_url":"https://github.com/ArturWincenciak/Root-Nodes-Workflow-Pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ArturWincenciak/Root-Nodes-Workflow-Pattern","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturWincenciak%2FRoot-Nodes-Workflow-Pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturWincenciak%2FRoot-Nodes-Workflow-Pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturWincenciak%2FRoot-Nodes-Workflow-Pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturWincenciak%2FRoot-Nodes-Workflow-Pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArturWincenciak","download_url":"https://codeload.github.com/ArturWincenciak/Root-Nodes-Workflow-Pattern/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturWincenciak%2FRoot-Nodes-Workflow-Pattern/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","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":["csharp","dotnet","state-machine","state-machine-pattern"],"created_at":"2024-10-15T16:54:37.901Z","updated_at":"2026-04-28T11:35:10.120Z","avatar_url":"https://github.com/ArturWincenciak.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Root and Nodes library\n\nThis is a framework for implementing a tree-like structure in C#. It consists of two main classes: Root and Node.\n\n## Root\n\nThe `Root` class represents the root of the tree. It has the following responsibilities:\n\n- Keeping a list of nodes that are owned by the root.\n- Keeping track of the currently active node.\n- Setting the start node for the tree.\n- Running the tree by setting the active node to the start node and calling the `Entry` method on the start node.\n- Passing input to the `OnKeyboard` method of the active node.\n- Setting the active node to the next node in the tree, as determined by the output of the current node.\n\n## Node\n\nThe `Node` class represents a node in the tree. It has the following responsibilities:\n\n- Being able to connect to a child node.\n- Keeping a list of possible outputs.\n- Returning the child node corresponding to a given output.\n- Implementing an `OnEntry` method that is called when the node is entered.\n- Implementing an `OnKeyboard` method that is called when input is received.\n\n## Usage\n\nTo use the framework, you will need to create your own classes that inherit from `Root` and `Node` and implement their abstract methods. You can then create an instance of your `Root` class and use the `SetStartNode` and `Run` methods to start the tree. Input can be passed to the `Root` instance using the `OnKeyboard` method.\n\n## Root and Nodes Console Example\n\nThis is a console application demonstrating the usage of the `RootAndNodesPattern` library. The application displays a message, asks the user a question, and based on their answer, either prints a series of asterisks or displays another message. The user can then exit the application by pressing any key.\n\nSee full implementation in [Root-Nodes-Workflow-Pattern/RootAndNodesPattern/RootAndNodesConsoleExample](https://github.com/ArturWincenciak/Root-Nodes-Workflow-Pattern/tree/master/RootAndNodesPattern/RootAndNodesConsoleExample) directory. Here you can only see a snippet of the main code:\n\n```csharp\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tConsole.WriteLine(\"OGNIA...\");\n\n\t\tvar root = new ExampleTree(\"teo\");\n\t\tNode showMessage = new MessageNode(root, \"Welcome\", \"This is start node...\");\n\t\tNode asterisks = new AsteriskPrinterkNode(root, \"Asterisks\", 50);\n\t\tNode question = new YesOrNoMenuNode(root, \"Question about asterisk\", \"Do you want to write asterisks?\");\n\t\tNode notAsterisksMessage = new MessageNode(root, \"Not asterisk\", \"You didn't want to asterisks.\");\n\t\tNode wrongChoiceMessage = new MessageNode(root, \"Bad choice.\", \"Bad choice. Try once again.\");\n\t\tNode endMessage = new MessageNode(root, \"End\", \"Fine.\");\n\n\t\tshowMessage.JoinChildNode(question);\n\t\tquestion.JoinChildNode(YesOrNoMenuNode.YES_OUTPUT, asterisks);\n\t\tquestion.JoinChildNode(YesOrNoMenuNode.NO_OUTPUT, notAsterisksMessage);\n\t\tquestion.JoinChildNode(wrongChoiceMessage);\n\t\twrongChoiceMessage.JoinChildNode(question);\n\t\tasterisks.JoinChildNode(endMessage);\n\t\tnotAsterisksMessage.JoinChildNode(endMessage);\n\n\t\troot.SetStartNode(showMessage);\n\t\troot.Run();\n\n\t\twhile (true)\n\t\t\troot.OnKeyboard(Console.ReadKey().KeyChar);\n\t}\n}\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturwincenciak%2Froot-nodes-workflow-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farturwincenciak%2Froot-nodes-workflow-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturwincenciak%2Froot-nodes-workflow-pattern/lists"}