aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/QueryScope.java
blob: 5456b9eaa5f7c6e46f5d85f3eeda1f3474a465ac (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
/*******************************************************************************
 * Copyright (c) 2010-2014, Bergmann Gabor, Istvan Rath and Daniel Varro
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-v20.html.
 * 
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package tools.refinery.viatra.runtime.api.scope;

import tools.refinery.viatra.runtime.api.IQuerySpecification;
import tools.refinery.viatra.runtime.api.ViatraQueryEngine;
import tools.refinery.viatra.runtime.internal.apiimpl.EngineContextFactory;

/**
 * Defines a scope for a VIATRA Query engine, which determines the set of model elements that query evaluation operates on.
 * 
 * @author Bergmann Gabor
 *
 */
public abstract class QueryScope extends EngineContextFactory {
    
    /**
     * Determines whether a query engine initialized on this scope can evaluate queries formulated against the given scope type.
     * <p> Every query scope class is compatible with a query engine initialized on a scope of the same class or a subclass.
     * @param queryScopeClass the scope class returned by invoking {@link IQuerySpecification#getPreferredScopeClass()} on a query specification
     * @return true if an {@link ViatraQueryEngine} initialized on this scope can consume an {@link IQuerySpecification}
     */
    public boolean isCompatibleWithQueryScope(Class<? extends QueryScope> queryScopeClass) {
        return queryScopeClass.isAssignableFrom(this.getClass());
    }

}