aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/CallWithAdornment.java
blob: 0cabeb97a3f016d8fe58a6c34b513e9d6723348a (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
53
54
55
/*******************************************************************************
 * Copyright (c) 2010-2018, Gabor Bergmann, IncQuery Labs Ltd.
 * 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.localsearch.matcher;

import java.util.HashSet;
import java.util.Set;

import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference;
import tools.refinery.viatra.runtime.matchers.psystem.PConstraint;
import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter;
import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery;

/**
 * Immutable data that represents the role of a pattern call within an LS query plan.
 *  
 * <p> The call is expressed as the {@link PConstraint} {@link #call} (implementing {@link IQueryReference}), 
 * while the stored {@link #adornment} records the way it will be used within a search plan (specifically, 
 * pattern parameters within the adornment will have their values known at the point of evaluating the constraint).
 * 
 * 
 * @author Gabor Bergmann
 * @since 2.1
 */
public class CallWithAdornment {
    private final IQueryReference call;
    private final Set<PParameter> adornment;

    public CallWithAdornment(IQueryReference call, Set<PParameter> adornment) {
        this.call = call;
        this.adornment = new HashSet<>(adornment);
    }

    public IQueryReference getCall() {
        return call;
    }

    public Set<PParameter> getAdornment() {
        return adornment;
    }
    
    
    public PQuery getReferredQuery() {
        return call.getReferredQuery();
    }
    
    public MatcherReference getMatcherReference() {
        return new MatcherReference(getReferredQuery(), adornment);
    }
}