Class RecipeRecognizer
java.lang.Object
tools.refinery.interpreter.rete.recipes.helper.RecipeRecognizer
Stores a set of known canonical recipes, each representing a disjoint equivalence class of recipes, modulo
isEquivalentRecipe(ReteNodeRecipe, ReteNodeRecipe)
.- Since:
- 1.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanonicalizeRecipe
(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.peekCanonicalRecipe
(ReteNodeRecipe recipe) Recognizes when an equivalent canonical recipe is already known.
-
Constructor Details
-
RecipeRecognizer
- Parameters:
runtimeContext
- can be null; if provided, further equivalences can be detected based onIQueryRuntimeContext.wrapElement(Object)
- Since:
- 1.6
-
RecipeRecognizer
public RecipeRecognizer()
-
-
Method Details
-
peekCanonicalRecipe
Recognizes when an equivalent canonical recipe is already known.- Returns:
- an equivalent canonical recipe, or the null if no known equivalent found
-
makeCanonical
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
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
- Returns:
- true iff recipe is a canonical recipe
-