From b7668dc589dae1fee677c41c4e6ee69636fe79d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Ho=C3=9F?= Date: Wed, 7 Apr 2021 07:12:56 +0200 Subject: [PATCH] extend docs --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2ddea3d..798fff5 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ engine.analyze(rules, context); engine.infer(rules, context); ``` +Note that the order of the collection dictates the evaluation order of your rules - if order does matter, use `List` rather than `Set`. + ### Creating rules A [rule](https://github.com/metio/reguloj/blob/main/src/main/java/wtf/metio/reguloj/Rule.java) has a (unique) name and runs in a given context. Additionally, it can be checked whether a rule fires in a given context. @@ -64,6 +66,10 @@ Rule rule = Rule.called(name) An inference [context](https://github.com/metio/reguloj/blob/main/src/main/java/wtf/metio/reguloj/Context.java) contains information needed by predicates and/or consumers. This project supplies a simple implementation of the Context interface called `SimpleContext` which just wraps a given topic. The `BaseContext` abstract class can be used to create subclasses in case your rules need extra information. The API acknowledges this by using > as type parameter for all methods which expect a Context, thus allowing all context implementations to be used. See item 28 in Effective Java for more details. +```java +CONTEXT context = Context.of("some object"); +``` + ### Integration ```xml -- 2.11.4.GIT