diff options
Diffstat (limited to 'subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/registry/impl/FilteringRegistryView.java')
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/registry/impl/FilteringRegistryView.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/registry/impl/FilteringRegistryView.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/registry/impl/FilteringRegistryView.java new file mode 100644 index 00000000..164a30d3 --- /dev/null +++ b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/registry/impl/FilteringRegistryView.java | |||
@@ -0,0 +1,43 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2016, Abel Hegedus, 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 | package tools.refinery.viatra.runtime.registry.impl; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.registry.IQuerySpecificationRegistry; | ||
12 | import tools.refinery.viatra.runtime.registry.IRegistryViewFilter; | ||
13 | import tools.refinery.viatra.runtime.registry.view.AbstractRegistryView; | ||
14 | import tools.refinery.viatra.runtime.registry.IQuerySpecificationRegistryEntry; | ||
15 | |||
16 | /** | ||
17 | * Registry view implementation that uses a filter to delegate the decision on whether | ||
18 | * a given specification is relevant to the view. | ||
19 | * | ||
20 | * @author Abel Hegedus | ||
21 | * | ||
22 | */ | ||
23 | public class FilteringRegistryView extends AbstractRegistryView { | ||
24 | |||
25 | private IRegistryViewFilter filter; | ||
26 | |||
27 | /** | ||
28 | * Creates a new filtering view instance. | ||
29 | * | ||
30 | * @param registry that defines the view | ||
31 | * @param filter that is used for deciding relevancy | ||
32 | */ | ||
33 | public FilteringRegistryView(IQuerySpecificationRegistry registry, IRegistryViewFilter filter, boolean allowDuplicateFQNs) { | ||
34 | super(registry, allowDuplicateFQNs); | ||
35 | this.filter = filter; | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | protected boolean isEntryRelevant(IQuerySpecificationRegistryEntry entry) { | ||
40 | return filter.isEntryRelevant(entry); | ||
41 | } | ||
42 | |||
43 | } | ||