]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/planning/PrePlanItem.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / chr / planning / PrePlanItem.java
1 package org.simantics.scl.compiler.elaboration.chr.planning;
2
3 public abstract class PrePlanItem {
4     int queuePos;
5     /* Primary priorities:
6      *     0 = check
7      *     1 = functional calculation
8      *     2 = almost completely bound relation
9      *     3 = completely inbound relation
10      */
11     public double primaryPriority = Double.POSITIVE_INFINITY;
12     public int secondaryPriority;
13     public long location;
14         
15     public PrePlanItem(int secondaryPriority) {
16         this.secondaryPriority = secondaryPriority;
17     }
18
19     public int compare(PrePlanItem other) {
20         if(primaryPriority < other.primaryPriority)
21             return -1;
22         if(primaryPriority > other.primaryPriority)
23             return 1;
24         return Integer.compare(secondaryPriority, other.secondaryPriority);    
25     }
26
27     public abstract void initializeListeners(QueryPlanningContext context);
28     public abstract void variableSolved(QueryPlanningContext context, int variableId);
29
30     public abstract void generate(QueryPlanningContext context);
31 }