import { BaseDoEntity, Constructor, TreeVisitResult } from '../index'; export declare const dataObjectVisitors: { /** * Visits all nodes and calls on each element matching the given type the provided consumer. * If a node matches, child nodes of this node are not visited. */ forEach(root: any, type: Constructor, consumer: (node: T) => void): void; /** * Visits all nodes and calls on each element matching the given type the provided consumer. * If a node matches, child nodes of this node are also visited. */ forEachRec(root: any, type: Constructor, consumer: (node: T) => void): void; /** * Visits all nodes and calls on each element matching the given type the provided visitor. * If a node matches, the resulting {@link TreeVisitResult} of the given visitor determines how the visitor proceeds. */ forEachRecWhile(root: any, type: Constructor, visitor: DataObjectVisitor): void; /** * Visits all nodes and calls on each element matching the given type predicate the provided consumer. * If a node matches, child nodes of this node are not visited. */ forEachIf(root: any, typePredicate: (candidate: any) => candidate is T, consumer: (node: T) => void): void; /** * Visits all nodes and calls on each element matching the given type predicate the provided consumer. * If a node matches, child nodes of this node are also visited. */ forEachIfRec(root: any, typePredicate: (candidate: any) => candidate is T, consumer: (node: T) => void): void; /** * Visits all nodes and calls on each element matching the given type predicate the provided visitor. * If a node matches, the resulting {@link TreeVisitResult} of the given visitor determines how the visitor proceeds. */ forEachIfRecWhile(root: any, typePredicate: (candidate: any) => candidate is T, visitor: DataObjectVisitor): void; }; /** * Helper class to visit data objects (depth first, pre-order). *

* {@link dataObjectVisitors} will be in most cases sufficient. */ export declare class DataObjectVisitHelper { /** * Visits the given node and all of its children using the visitor. */ visit(node: any, visitor: DataObjectVisitor): void; protected _visit(node: any, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; /** * Visits the given node using the visitor. * If this results in {@link TreeVisitResult.TERMINATE} visiting is terminated. * If it does not result in {@link TreeVisitResult.SKIP_SUBTREE} the children of the given node are visited using the given chain. */ protected _visitNode(node: T, context: DataObjectVisitorContext, visitor: DataObjectVisitor, chain: (n: T, c: DataObjectVisitorContext, v: DataObjectVisitor) => TreeVisitResult): TreeVisitResult; /** * Visits all elements of a {@link Set} or an {@link Array} using the visitor. */ protected _visitSetOrArray(setOrArray: Set | Array, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; /** * Visits all keys and values of a {@link Map} using the visitor. */ protected _visitMap(map: Map, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; /** * Visits all values and all contributions of a {@link BaseDoEntity} using the visitor. */ protected _visitBaseDoEntity(baseDoEntity: BaseDoEntity, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; /** * Visits all values of an {@link object} using the visitor. */ protected _visitObject(obj: object, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; /** * Visits no child of the given element. Hook for subclasses. */ protected _visitAny(node: any, context: DataObjectVisitorContext, visitor: DataObjectVisitor): TreeVisitResult; } export type DataObjectVisitor = (node: T, context: DataObjectVisitorContext) => TreeVisitResult; export declare class DataObjectVisitorContext { protected _parents: any[]; get parents(): any[]; parent(index?: number): any; containsParent(parent: any): boolean; pushParent(parent: any): void; popParent(): any; } //# sourceMappingURL=dataObjectVisitors.d.ts.map