Each Typir instance has one single type graph. Each type exists only once and is stored inside this type graph.

Edges with different meaning/purpose will exist in parallel inside the same graph, otherwise nodes/types need to be duplicated or would be used in multiple graphs. Graph algorithms will need to filter the required edges regarding $relation.

Constructors

Properties

edges: TypeEdge[] = []
listeners: TypeGraphListener[] = []
nodes: Map<string, Type> = ...

Methods

  • Usually this method is called by kinds after creating a corresponding type. Therefore it is usually not needed to call this method in an other context.

    Parameters

    • type: Type

      the new type

    • Optionalkey: string

      an optional key to register the type, since it is allowed to register the same type with different keys in the graph

    Returns void

  • When removing a type/node, all its edges (incoming and outgoing) are removed as well. Design decision: This is the central API call to remove a type from the type system in case that it is no longer valid/existing/needed. It is not required to directly inform the kind of the removed type yourself, since the kind itself will take care of removed types.

    Parameters

    • typeToRemove: Type

      the type to remove

    • Optionalkey: string

      an optional key to register the type, since it is allowed to register the same type with different keys in the graph

    Returns void