Update parent to latest version
[reguloj.git] / src / main / java / wtf / metio / reguloj / Context.java
blob6b1b28e474d9c8ef819ff772577eb60fac20cea4
1 /*
2 * SPDX-FileCopyrightText: The reguloj Authors
3 * SPDX-License-Identifier: 0BSD
4 */
5 package wtf.metio.reguloj;
7 /**
8 * <p>
9 * A {@link Context} is used by a {@link RuleEngine} to evaluate a collection of {@link Rule rules}.
10 * </p>
12 * @param <TOPIC> The topic of the context.
13 * @see RuleEngine
14 * @see Rule
16 public interface Context<TOPIC> {
18 /**
19 * Creates an immutable context that just contains the given topic.
21 * @param topic The topic value of the context.
22 * @param <TOPIC> The topic type of the context.
23 * @return A new context with the given value.
25 static <TOPIC> Context<TOPIC> of(final TOPIC topic) {
26 return new SimpleContext<>(topic);
29 /**
30 * @return The topic of this inference context.
32 TOPIC topic();