Skip to content
This repository was archived by the owner on Jan 24, 2026. It is now read-only.

Simplify RuleEngine API#18

Merged
rcahoon merged 4 commits into
mf3-devfrom
mf3-simplify-rule-engine-apis
Jan 13, 2025
Merged

Simplify RuleEngine API#18
rcahoon merged 4 commits into
mf3-devfrom
mf3-simplify-rule-engine-apis

Conversation

@rcahoon
Copy link
Copy Markdown
Member

@rcahoon rcahoon commented Jan 13, 2025

Description

Remove Rule.Builder. Callers still call RuleEngine.addRule(), with simplified syntax. Allow Rules to be modified, eg to specify a finishedTriggering action - but once RuleEngine.run() is called, "seal" the RuleEngine's Rules so they cannot be modified further.

Original PR in 2024: Team766/2024#151

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Be detailed so that your code reviewer can understand exactly how much and what kinds of testing were done, and which might still be worthwhile to do.

  • Unit tests: [Add your description here]
  • Simulator testing: [Add your description here]
  • On-robot bench testing: [Add your description here]
  • On-robot field testing: [Add your description here]

dejabot and others added 4 commits January 5, 2025 02:19
…urn a Rule that can be modified further, eg with a finishedTriggeringProcedure.
this prevents accidental modification of rules after the containing ruleengine starts getting used.

also switch to a LinkedHashMap for storing rules and tweak some of the methods used in unit tests.
@rcahoon
Copy link
Copy Markdown
Member Author

rcahoon commented Jan 13, 2025

@dejabot I opened this PR with your branch in the 2025 repo

@rcahoon rcahoon merged commit 0a546cd into mf3-dev Jan 13, 2025
@rcahoon rcahoon deleted the mf3-simplify-rule-engine-apis branch January 13, 2025 07:14
rajitzg pushed a commit that referenced this pull request Jan 16, 2025
* remove Rule.Builder and simplify RuleEngine.addRule(), letting it return a Rule that can be modified further, eg with a finishedTriggeringProcedure.

* "seal" rules after ruleengine using them is run() the first time.

this prevents accidental modification of rules after the containing ruleengine starts getting used.

also switch to a LinkedHashMap for storing rules and tweak some of the methods used in unit tests.

* Change "rules.add" to "addRule" in example code

---------

Co-authored-by: dejabot <dg@dejabotz.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants