blob: e71cf2174fa5ae4c591f0f3841c0ec1da11a9828 (
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.planning.operations;
import java.util.Set;
import tools.refinery.viatra.runtime.matchers.planning.SubPlan;
import tools.refinery.viatra.runtime.matchers.psystem.PConstraint;
import tools.refinery.viatra.runtime.matchers.util.Preconditions;
/**
* Abstract superclass for representing a high-level query evaluation operation.
*
* <p> Subclasses correspond to various POperations modeled after relational algebra.
*
* @author Bergmann Gabor
*
*/
public abstract class POperation {
/**
* Newly enforced constraints
*/
public abstract Set<? extends PConstraint> getDeltaConstraints();
public abstract String getShortName();
/**
* @return the number of SubPlans that must be specified as parents
*/
public abstract int numParentSubPlans();
/**
* Checks whether this constraint can be properly applied at the given SubPlan.
*/
public void checkConsistency(SubPlan subPlan) {
Preconditions.checkArgument(this == subPlan.getOperation(), "POperation misalignment");
Preconditions.checkArgument(subPlan.getParentPlans().size() == numParentSubPlans(), "Incorrect number of parent SubPlans");
}
@Override
public String toString() {
return getShortName();
}
}
|