LookupTreeAdaptor

abstract class LookupTreeAdaptor<Element : A_BasicObject, Result : A_BasicObject, Memento>

LookupTreeAdaptor is instantiated to construct and interpret a family of type-dispatch trees.

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.

Memento

A memento to supply arbitrary additional information.

Constructors

Link copied to clipboard
fun LookupTreeAdaptor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun compareTypes(argumentRestrictions: List<TypeRestriction>, signatureType: A_Type): TypeComparison

Compare two types to produce a TypeComparison.

Link copied to clipboard
abstract fun constructResult(elements: List<Element>, memento: Memento): Result

Construct a Result from a List of Elements.

Link copied to clipboard
fun createRoot(    allElements: Collection<Element>,     knownArgumentRestrictions: List<TypeRestriction>,     memento: Memento): LookupTree<Element, Result>

Create a LookupTree, using the provided collection of Elements, and the list of initial argument types.

Link copied to clipboard
fun extractBoundingType(argumentRestrictions: List<TypeRestriction>): A_Type

Compute the bounding signature from the given List of TypeRestrictions.

Link copied to clipboard
abstract fun extractSignature(element: Element): A_Type

Convert from an Element to a suitable A_Type for organizing the tree.

Link copied to clipboard
fun lookupByTypes(    root: LookupTree<Element, Result>,     argumentTypesTuple: A_Tuple,     memento: Memento,     lookupStats: LookupStatistics): Result

Use the tuple of types to traverse the tree. Answer the solution, a Result. Uses iteration rather than recursion to limit stack depth.

Link copied to clipboard
fun lookupByValue(    root: LookupTree<Element, Result>,     argValue: A_BasicObject,     memento: Memento,     lookupStats: LookupStatistics): Result

Use the given singular value to traverse the tree. Answer the solution, a Result. Uses iteration rather than recursion to limit stack depth.

Link copied to clipboard
fun lookupByValues(    root: LookupTree<Element, Result>,     argValues: List<A_BasicObject>,     memento: Memento,     lookupStats: LookupStatistics): Result

Given a List of A_BasicObjects, use their types to traverse the LookupTree. Answer the solution, a Result. Uses iteration rather than recursion to limit stack depth.

Link copied to clipboard
fun restrictedSignature(    element: Element,     signatureExtrasExtractor: (Element) -> Pair<A_Type?, List<A_Type>>,     signatureBound: A_Type): A_Type

Extract the signature of the element, then intersect it with the given tuple type.

Link copied to clipboard
abstract fun subtypesHideSupertypes(): Boolean

true if Elements with more specific signatures exclude those with strictly more general signatures, false otherwise.

Link copied to clipboard
abstract fun testsArgumentPositions(): Boolean

true if the tree uses whole type testing, or false if the tree tests individual elements of a tuple type.

Properties

Link copied to clipboard
abstract val emptyLeaf: LeafLookupTree<Element, Result>

A lightweight leaf node that can be used to indicate a negative search (i.e., no elements were applicable).

Inheritors

Link copied to clipboard