diff options
Diffstat (limited to 'subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/scopes/tables/ITableWriterUnary.java')
-rw-r--r-- | subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/scopes/tables/ITableWriterUnary.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/scopes/tables/ITableWriterUnary.java b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/scopes/tables/ITableWriterUnary.java new file mode 100644 index 00000000..f90d5362 --- /dev/null +++ b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/scopes/tables/ITableWriterUnary.java | |||
@@ -0,0 +1,52 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2018, Gabor Bergmann, IncQuery Labs Ltd. | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | |||
10 | package tools.refinery.viatra.runtime.matchers.scopes.tables; | ||
11 | |||
12 | import tools.refinery.viatra.runtime.matchers.util.Direction; | ||
13 | |||
14 | /** | ||
15 | * Modifies the contents of a unary {@link IIndexTable}. | ||
16 | * <p> | ||
17 | * <strong>EXPERIMENTAL</strong>. This class or interface has been added as | ||
18 | * part of a work in progress. There is no guarantee that this API will | ||
19 | * work or that it will remain the same. | ||
20 | * | ||
21 | * @since 2.0 | ||
22 | * @author Gabor Bergmann | ||
23 | * | ||
24 | */ | ||
25 | public interface ITableWriterUnary<Value> { | ||
26 | |||
27 | /** | ||
28 | * Adds/removes a row to/from the table. | ||
29 | * | ||
30 | * @param direction | ||
31 | * tells whether putting a row into the table or deleting TODO: store as multiset, return bool? | ||
32 | */ | ||
33 | void write(Direction direction, Value value); | ||
34 | |||
35 | /** | ||
36 | * Intersection type for writers that are also tables | ||
37 | */ | ||
38 | interface Table<Value> extends ITableWriterUnary<Value>, IIndexTable { | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * /dev/null implementation | ||
43 | * | ||
44 | * @author Gabor Bergmann | ||
45 | */ | ||
46 | static class Nop<Value> implements ITableWriterUnary<Value> { | ||
47 | @Override | ||
48 | public void write(Direction direction, Value value) { | ||
49 | // NO-OP | ||
50 | } | ||
51 | } | ||
52 | } | ||