UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

101 lines (100 loc) 2.27 kB
/** * Represents a collection which is bidirectional. * * @template TParent * The type of the parent of the collection. * * @template TChild * The type of the children of the collection. */ export declare abstract class BidirectionalCollection<TParent, TChild> extends Array<TChild> { /** * The owner of the collection. */ private owner; /** * Initializes a new instance of the {@link BidirectionalCollection `BidirectionalCollection<TParent, TChild>`} class. * * @param owner * The owner of the collection. */ constructor(owner: TParent); /** * Gets the owner of the collection. */ get Owner(): TParent; /** * @inheritdoc * * @param items * The new elements of the Array. * * @returns * The new length of the array. */ push(...items: TChild[]): number; /** * @inheritdoc * * @returns * The removed item. */ pop(): TChild; /** * @inheritdoc * * @returns * The removed element. */ shift(): TChild; /** * @inheritdoc * * @param items * Elements to insert at the start of the array. * * @returns * The new length of the array. */ unshift(...items: TChild[]): number; /** * Gets the parent of a child. * * @param child * The child whose parent to return. * * @returns * The parent of the {@link child `child`}. */ protected abstract GetParent(child: TChild): TParent; /** * Sets the parent of a child. * * @param child * The child whose parent is to be set. * * @param parent * The parent to set. */ protected abstract SetParent(child: TChild, parent: TParent): void; /** * Securely adds an item. * * @param item * The item to add. * * @returns * A value indicating whether the item could be added. */ protected Add(item: TChild): boolean; /** * Securely removes an item. * * @param index * The index of the item to remove. * * @returns * A value indicating whether the element could be removed. */ protected Remove(index: number): boolean; }