aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQueryGroup.java
blob: a783f8235a9b0e7f60d3866c6b80eab9a2498a94 (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
/*******************************************************************************
 * Copyright (c) 2010-2012, Mark Czotter, 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;

import java.util.Set;

/**
 * Generic interface for group of query specifications.
 * 
 * <p>It handles more than one patterns as a group, and provides functionality to initialize the matchers together (which
 * has performance benefits).
 * 
 * @author Mark Czotter
 * 
 */
public interface IQueryGroup {

    /**
     * Initializes matchers for the group of patterns within an {@link ViatraQueryEngine}. If some of the pattern matchers are already
     * constructed in the engine, no task is performed for them.
     * 
     * <p>
     * This preparation step has the advantage that it prepares pattern matchers for an arbitrary number of patterns in a
     * single-pass traversal of the model. 
     * This is typically more efficient than traversing the model each time an individual pattern matcher is initialized on demand. 
     * The performance benefit only manifests itself if the engine is not in wildcard mode.
     * 
     * @param engine
     *            the existing VIATRA Query engine in which the matchers will be created.
     * @throws ViatraQueryRuntimeException
     *             if there was an error in preparing the engine
     */
    public void prepare(ViatraQueryEngine engine);

    /**
     * Returns the currently assigned {@link IQuerySpecification}s.
     */
    public Set<IQuerySpecification<?>> getSpecifications();

}