aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactory.java
blob: e264ab3f0260db0c868f967618eb3c6880447aeb (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
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * 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.matchers.backend;

import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext;
import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery;

/**
 * A Query Backend Factory identifies a query evaluator implementation, and can create an evaluator instance (an {@link IQueryBackend}) tied to a specific VIATRA Query engine upon request. 
 * 
 * <p> The factory is used as a lookup key for the backend instance, 
 *   therefore implementors should either be singletons, or implement equals() / hashCode() accordingly. 
 * 
 * @author Bergmann Gabor
 *
 */
public interface IQueryBackendFactory {
    
    /**
     * Creates a new {@link IQueryBackend} instance tied to the given context elements. 
     * 
     * @return an instance of the class returned by {@link #getBackendClass()} that operates in the given context.
     * @since 1.5
     */
    public IQueryBackend 
        create(IQueryBackendContext context);
    
    
    /**
     * The backend instances created by this factory are guaranteed to conform to the returned class.
     */
    public Class<? extends IQueryBackend> getBackendClass();

    /**
     * Calculate the required capabilities, which are needed to execute the given pattern
     * 
     * @since 1.4
     */
    public IMatcherCapability calculateRequiredCapability(PQuery query, QueryEvaluationHint hint);
    
    /**
     * Returns whether the current backend is caching
     * @since 2.0
     */
    public boolean isCaching();
}