aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/Options.java
blob: 96cc445f15d3bdc171775c03b64e5f36cea3e722 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*******************************************************************************
 * Copyright (c) 2004-2008 Gabor Bergmann 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.rete.util;

import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider;
import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext;
import tools.refinery.viatra.runtime.matchers.planning.IQueryPlannerStrategy;
import tools.refinery.viatra.runtime.rete.construction.basiclinear.BasicLinearLayout;
import tools.refinery.viatra.runtime.rete.construction.quasitree.QuasiTreeLayout;
import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyCommunicationGroup;

/**
 * Feature switches.
 * @author Gabor Bergmann
 * @noreference
 */
public class Options {

    public enum NodeSharingOption {
        NEVER, // not recommended, patternmatcher leaks possible
        INDEXER_AND_REMOTEPROXY, ALL
    }

    public static final NodeSharingOption nodeSharingOption = NodeSharingOption.ALL;
    public static final boolean releaseOnetimeIndexers = true; // effective only
                                                               // with
                                                               // nodesharing
                                                               // ==NEVER

    public enum InjectivityStrategy {
        EAGER, LAZY
    }

    public static final InjectivityStrategy injectivityStrategy = InjectivityStrategy.EAGER;

    public static final boolean enableInheritance = true;

    // public final static boolean useComplementerMask = true;

    public static final boolean employTrivialIndexers = true;

    // public final static boolean synchronous = false;

    public static final int numberOfLocalContainers = 1;
    public static final int firstFreeContainer = 0; // 0 if head container is
                                                    // free to contain pattern
                                                    // bodies, 1 otherwise

    /**
     * Enable for internal debugging of Rete communication scheme; 
     *  catches cases where the topological sort is violated by a message sent "backwards"
     * @since 1.6
     */
    public static final boolean MONITOR_VIOLATION_OF_RETE_NODEGROUP_TOPOLOGICAL_SORTING = false;
    
    /**
     * Enable for internal debugging of message delivery in {@link TimelyCommunicationGroup}s;
     * catches cases when there is a violation of increasing timestamps during message delivery within a group.  
     * @since 2.3
     */
    public static final boolean MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS = false;
    
    /**
     * 
     * @author Gabor Bergmann
     * @noreference
     */
    public enum BuilderMethod {
        LEGACY, // ONLY with GTASM
        PSYSTEM_BASIC_LINEAR, PSYSTEM_QUASITREE;
        /**
         * @since 1.5
         */
        public IQueryPlannerStrategy layoutStrategy(IQueryBackendContext bContext, IQueryBackendHintProvider hintProvider) {
            switch (this) {
            case PSYSTEM_BASIC_LINEAR:
                return new BasicLinearLayout(bContext);
            case PSYSTEM_QUASITREE:
                return new QuasiTreeLayout(bContext, hintProvider);
            default:
                throw new UnsupportedOperationException();
            }
        }
    }

    public static final BuilderMethod builderMethod =
    // BuilderMethod.PSYSTEM_BASIC_LINEAR;
    BuilderMethod.PSYSTEM_QUASITREE;
    
    public enum FunctionalDependencyOption {
        OFF,
        OPPORTUNISTIC
    }
    public static final FunctionalDependencyOption functionalDependencyOption = 
            FunctionalDependencyOption.OPPORTUNISTIC;
    
    public enum PlanTrimOption {
        OFF,
        OPPORTUNISTIC
    }
    public static final PlanTrimOption planTrimOption = 
            PlanTrimOption.OPPORTUNISTIC;

}