InternalLookupTree

A LookupTree representing an incomplete search. To further the search, its decisionStep performs some sort of dynamic test, producing the next subtree to visit.

Author

Mark van Gulik

Parameters

Element

The kind of elements in the lookup tree, such as method definitions.

Result

What we expect to produce from a lookup activity, such as the tuple of most-specific matching method definitions for some arguments.

Functions

Link copied to clipboard
fun castForGenerator(): LookupTree<A_Definition, A_Tuple>

Strengthen the type to a lookup tree suitable for method lookups.

Link copied to clipboard
open override fun <AdaptorMemento> expandIfNecessary(    signatureExtrasExtractor: (Element) -> Pair<A_Type?, List<A_Type>>,     adaptor: LookupTreeAdaptor<Element, Result, AdaptorMemento>,     numNaturalArgs: Int,     memento: AdaptorMemento): DecisionStep<Element, Result>

If it has not already been computed, compute and cache the decisionStep to use for making progress at this InternalLookupTree.

Link copied to clipboard
open override fun toString(): String

open override fun toString(indent: Int): String

Describe this LookupTree at a given indent level.

Properties

Link copied to clipboard
val alreadyEnumerationOfNontypeTested: A_Number

An Avail integer coding which arguments (and extras that may have been generated during traversal of ancestors) were known to contain at least one enumeration of non-types. Those actual values can be used to look up subtrees for which that value is a possible instance of an actual provided type. See TestForEnumerationOfNontypeDecisionStep. The flag for argument #n is indicated by a set bit in the n-1st bit position, and serves to suppress subsequent attempts to dispatch this way on this argument in subtrees.

Link copied to clipboard
val alreadyExtractedFields: A_Map

An A_Map from Avail integer to Avail integer. They key integer is the one-based argument (or extras) subscript of the source object, and the value integer is an encoding of which fields have been extracted, where bit 2^(N-1) indicates the Nth field (one-based) has been extracted already. Since objects and object types are disjoint, this same map is used for both purposes without ambiguity.

Link copied to clipboard
val alreadyMetaInstanceExtractArguments: A_Number

An Avail integer coding which arguments (and extras that may have been generated during traversal of ancestors) were known to be metatypes, and have had their instance (a type) extracted already into another field via an ExtractMetaInstanceDecisionStep in an ancestor. Argument #n is indicated by a set bit in the n-1st bit position, the one whose value in the integer is 2^(n-1).

Link copied to clipboard
val alreadyPhraseTypeExtractArguments: A_Number

An Avail integer coding which arguments (and extras that may have been generated during traversal of ancestors) were known to be phrase types, and have had their yield type extracted already into another field via an ExtractPhraseTypeDecisionStep in an ancestor. Argument #n is indicated by a set bit in the n-1st bit position, the one whose value in the integer is 2^(n-1).

Link copied to clipboard
val alreadyTagTestedArguments: A_Number

An Avail integer coding whether the arguments (and extras that may have been generated during traversal of ancestors) have had their TypeTag extracted and dispatched on by an ancestor. Argument #n is indicated by a set bit in the n-1st bit position, the one whose value in the integer is 2^(n-1).

Link copied to clipboard
val alreadyTestedConstants: A_Number
Link copied to clipboard
val decisionStepOrNull: DecisionStep<Element, Result>?

Access the decisionStep if available, otherwise answer null.

Link copied to clipboard
val knownArgumentRestrictions: List<TypeRestriction>

The list of argument TypeRestrictions known to hold at this position in the decision tree. Each element corresponds with an argument position for the method.

Link copied to clipboard
val positiveElements: List<Element>

The elements which definitely apply to the supplied arguments at this point in the decision tree.

Link copied to clipboard
open override val solutionOrNull: Result?

Answer the lookup solution (List of A_Definition at this leaf node, or null if this is not a leaf node.

Link copied to clipboard
val undecidedElements: List<Element>

The elements for which a decision about whether they apply to the supplied arguments has not yet been made at this point in the decision tree.