aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/actions/PartialActionLiterals.java
blob: e8e6880af1816cd885fb541abe37668afc9bed08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.actions;

import tools.refinery.logic.AbstractValue;
import tools.refinery.logic.term.NodeVariable;
import tools.refinery.store.reasoning.representation.PartialRelation;
import tools.refinery.store.reasoning.representation.PartialSymbol;
import tools.refinery.logic.term.truthvalue.TruthValue;

import java.util.List;

public final class PartialActionLiterals {
	private PartialActionLiterals() {
		throw new IllegalStateException("This is a static utility class and should not be instantiated directly");
	}

	public static <A extends AbstractValue<A, C>, C> MergeActionLiteral<A, C> merge(
			PartialSymbol<A, C> partialSymbol, A value, NodeVariable... parameters) {
		return new MergeActionLiteral<>(partialSymbol, value, List.of(parameters));
	}

	public static MergeActionLiteral<TruthValue, Boolean> add(PartialRelation partialRelation,
															  NodeVariable... parameters) {
		return merge(partialRelation, TruthValue.TRUE, parameters);
	}

	public static MergeActionLiteral<TruthValue, Boolean> remove(PartialRelation partialRelation,
																 NodeVariable... parameters) {
		return merge(partialRelation, TruthValue.FALSE, parameters);
	}

	public static FocusActionLiteral focus(NodeVariable parent, NodeVariable child) {
		return new FocusActionLiteral(parent, child);
	}

	public static CleanupActionLiteral cleanup(NodeVariable node) {
		return new CleanupActionLiteral(node);
	}
}