UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

46 lines 1.93 kB
import { SchemaContext } from "../Context"; import { Constant } from "../Metadata/Constant"; import { Schema } from "../Metadata/Schema"; import { Unit } from "../Metadata/Unit"; import { UnitConversion } from "./UnitConversion"; import { Graph } from "./Graph"; /** @internal */ export declare class GraphUtils { /** * DFS traversal - Post order * @param _graph Graph to traverse * @param start Starting node * @param keyFrom Get key from label * @param op Reducing function * @param initial Initial label */ static dfsReduce<T>(_graph: Graph<Unit | Constant>, key: string, op: (previous: T, current: string) => T, initial: T, baseUnitsMap: Map<string, number>, accumulatedExponent: number): T; } /** @internal */ export declare class UnitGraph { private _context; private _graph; private _unitsInProgress; constructor(_context: SchemaContext); /** * Tries to find the unit/constant given by name in currentSchema * @param name SchemaItem name or parsed definition to find unit of; Could be {schemaName}:{schemaItemName} or {alias}:{schemaItemName} or {schemaItemName} * @param currentSchema schema to find name in; name could also be in a referenced schema of current schema */ resolveUnit(name: string, currentSchema: Schema): Promise<Unit | Constant>; /** * Adds unit and corresponding children to graph as well as edges between units * @param unit Current unit to be added to graph */ addUnit(unit: Unit | Constant): Promise<void>; private addUnitToGraph; private isIdentity; /** * Reduce the tree to produce a single map * @param unit Unit to be processed * @param stopNodes The tree exploration should stop here */ reduce(unit: Unit | Constant, baseUnitsMap: Map<string, number>): Map<string, UnitConversion>; private reducingFunction; } //# sourceMappingURL=UnitTree.d.ts.map