import { TreeMap } from "../maps/treemap"; import { AttributeConstructor, AttributeTypes, DefinedAttributes } from "./attributes"; /** * This class is responsible for annotating an underlying tree (`tree`) with * attributes. For each attribute type, we first define the attribute by its * name and associated evaluation function. * * Each attribute is defined simply by a function that ultimately adds an * attribute to the `attributes` collection. Once the ArborGlyph class is closed * via the `done` method, all nodes in the tree are annotated with the additional * attributes as (getter properties). */ export declare class ArborGlyph { protected tree: TreeMap; protected attributes: DefinedAttributes; protected unique: Symbol; protected closed: boolean; /** * Manage a given tree with a set of attributes associated with it. Normally, * this constructor is invoked with only the first argument and additional * attributes are added via the methods in this class. Once each attribute * is added (or when the ArborGlyph is closed), a new ArborGlyph instance * (with updated attributes) is created. */ constructor(tree: TreeMap, attributes?: DefinedAttributes, unique?: Symbol, closed?: boolean); /** * This method is used to add attributes. This method is agnostic as to * the kind of attribute (inherited, synthetic, etc). This is because how * each attribute is evaluated is _external_ this this method and encapsulated * in the provided `AttributeConstructor` function. * * @param acon The function to construct a new `attributes` value. * @returns A new `ArborGlyph` with the additional attribute included. */ add(acon: AttributeConstructor): ArborGlyph>; /** The names of all attributes currently associated with this `ArborGlyph` */ get attrs(): Set; /** * This method is invoked once all attributes have been added * to the ArborGlyph. At that point, the tree is annotated with * the attributes defined here (by adding new getter properties * to each node). * * @returns A new, closed ArborGlyph */ done(): ArborGlyph; /** * Redo the steps normally performaed when the ArborGlyph is marked as `done`. * This is done in response to topology changes. **/ reannotate(from: T): void; /** * This method returns the "annotated" version of the given node. Assuming the * `ArborGlyph` is closed (which this method checks), the node has already been * annotated with all attributes. As a result, this method doesn't need to * actually do anything except a type cast. * * @param n The node to "annotate" * @returns Version of the node with attributes defined */ anno(n: T): T & A; /** * This method is the method that actually does the node annotation. It * does this be adding additional getter properties to the specified node. * @param n Node to annotate */ protected annotateNode(n: T): void; /** * This method is useful in trying to understand what is going on with evaluation. * It traverses the tree and evaluates a given attribute for every node. * @param attr The attribute to visualize * @param cur Where to start (default is root of tree) * @param indent0 Initial indentation string * @param indent Successive indentation string */ debug(attr: N, cur?: T, indent0?: string, indent?: string): void; }