/** * Represents an object which exists as part of a diagram model. * @public * @see DiagramModel */ export interface DiagramEntity { /** * Identifier that uniquely identifies this entity within its diagram model. * @public */ get id(): string; } /** * Represents a collection of diagram entities of a type that exists as part of a diagram model. * @public * @see DiagramEntity * @see DiagramModel */ export declare class DiagramEntitySet implements Iterable { /** * The list of entities contained in this set. * @private */ protected readonly entities: E[]; /** * A mapping of entity ids to their corresponding entity in this set for quickly fetching entities based on their id. * @private */ protected readonly entityMap: { [id: string]: E; }; /** * The number of entities in this set. * @public */ get length(): number; /** * Gets all of the entities of this set. * @public * @returns An array containing all of the entities of this set. */ all(): E[]; /** * Adds an entity to this set if there are no entities with the same id. Has no effect if there already exists an entity with the same id as the given entity. * For creating entities with relationships with other entities, the new() method should be used instead. The add() method adds an entity but doesn't take care of setting that entity's relationships with other entities. * @private * @param entity An entity to be added to this set. */ add(entity: E): void; /** * Removes all the entities in this set. * @public */ clear(): void; /** * Checks if this set contains an entity with the given id. * @public * @param id An id. * @returns `true` if this set contains an entity with the given id, `false` otherwise. */ contains(id: string): boolean; /** * Counts the number of entities of this set following the given criteria. * @public * @returns The number of entities of this set following the given criteria. */ count(predicate: (value: E, index: number, array: E[]) => unknown): number; /** * Gets all of the entities of this set filtered following given criteria. * @public * @returns An array containing the entities of this set that meet the given criteria. */ filter(predicate: (value: E, index: number, array: E[]) => unknown): E[]; /** * Gets an entity of this set matching specific criteria. * @public * @returns An entity of this set. */ find(predicate: (value: E, index: number, array: E[]) => unknown): E | undefined; /** * Gets an entity from this set. * @public * @param id An id. * @returns An entity with the given id, or `undefined` if there are no entities with the given id. */ get(id: string): E | undefined; /** * Gets all of the entities of this set mapped to the result of the given function applied to them. * @public * @returns An array containing the entities of this set that meet the given criteria. */ map(callback: (value: E, index: number, array: E[]) => R): R[]; /** * Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id. * @public * @param id An id. */ remove(id: string): void; /** * Gets the number of entities in this set. * @public */ size(): number; /** * Iterator to iterate over the entities of this set. * @public */ [Symbol.iterator](): Iterator; }