diff options
Diffstat (limited to 'subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java')
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java new file mode 100644 index 00000000..da8bf87e --- /dev/null +++ b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java | |||
@@ -0,0 +1,55 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2013, Abel Hegedus, Istvan Rath and Daniel Varro | ||
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 | package tools.refinery.viatra.runtime.api; | ||
10 | |||
11 | |||
12 | |||
13 | /** | ||
14 | * Listener interface for model changes affecting different levels of the VIATRA Query architecture. | ||
15 | * | ||
16 | * @author Abel Hegedus | ||
17 | * | ||
18 | */ | ||
19 | public interface ViatraQueryModelUpdateListener { | ||
20 | |||
21 | /** | ||
22 | * Possible notification levels for changes | ||
23 | * | ||
24 | * @author Abel Hegedus | ||
25 | * | ||
26 | */ | ||
27 | enum ChangeLevel { | ||
28 | NO_CHANGE, MODEL, INDEX, MATCHSET; | ||
29 | |||
30 | public ChangeLevel changeOccured(ChangeLevel occuredLevel) { | ||
31 | if(this.compareTo(occuredLevel) < 0) { | ||
32 | return occuredLevel; | ||
33 | } else { | ||
34 | return this; | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | /** | ||
39 | * Called after each change with also sending the level of change. | ||
40 | * Only called if the change level is at least at the level returned by getLevel(). | ||
41 | * | ||
42 | * @param changeLevel | ||
43 | */ | ||
44 | void notifyChanged(ChangeLevel changeLevel); | ||
45 | |||
46 | /** | ||
47 | * This may be queried only ONCE (!!!) at the registration of the listener. | ||
48 | * | ||
49 | * NOTE: this allows us to only create engine level change providers if there is someone who needs it. | ||
50 | * | ||
51 | * @return the change level where you want notifications | ||
52 | */ | ||
53 | ChangeLevel getLevel(); | ||
54 | |||
55 | } | ||