Class RecipeRecognizer
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.rete.recipes.helper.RecipeRecognizer
-
public class RecipeRecognizer extends java.lang.Object
Stores a set of known canonical recipes, each representing a disjoint equivalence class of recipes, moduloisEquivalentRecipe(ReteNodeRecipe, ReteNodeRecipe)
.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor Description RecipeRecognizer()
RecipeRecognizer(IQueryRuntimeContext runtimeContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReteNodeRecipe
canonicalizeRecipe(ReteNodeRecipe recipe)
Ensures that there is an equivalent canonical recipe; if none is known yet, this recipe will be remembered as canonical.boolean
isKnownCanonicalRecipe(ReteNodeRecipe recipe)
void
makeCanonical(ReteNodeRecipe recipe)
This recipe will be remembered as a canonical recipe.ReteNodeRecipe
peekCanonicalRecipe(ReteNodeRecipe recipe)
Recognizes when an equivalent canonical recipe is already known.
-
-
-
Constructor Detail
-
RecipeRecognizer
public RecipeRecognizer(IQueryRuntimeContext runtimeContext)
- Parameters:
can
- be null; if provided, further equivalences can be detected based onIQueryRuntimeContext.wrapElement(Object)
- Since:
- 1.6
-
RecipeRecognizer
public RecipeRecognizer()
-
-
Method Detail
-
peekCanonicalRecipe
public ReteNodeRecipe peekCanonicalRecipe(ReteNodeRecipe recipe)
Recognizes when an equivalent canonical recipe is already known.- Returns:
- an equivalent canonical recipe, or the null if no known equivalent found
-
makeCanonical
public void makeCanonical(ReteNodeRecipe recipe)
This recipe will be remembered as a canonical recipe. Method maintains both internal data structures and the equivalence class attribute of the recipe. PRECONDITION:peekCanonicalRecipe(ReteNodeRecipe)
must return null or the recipe itself
-
canonicalizeRecipe
public ReteNodeRecipe canonicalizeRecipe(ReteNodeRecipe recipe)
Ensures that there is an equivalent canonical recipe; if none is known yet, this recipe will be remembered as canonical.- Returns:
- an equivalent canonical recipe; the argument recipe itself (which is made canonical) if no known equivalent found
-
isKnownCanonicalRecipe
public boolean isKnownCanonicalRecipe(ReteNodeRecipe recipe)
- Returns:
- true iff recipe is a canonical recipe
-
-