/** * Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { ISlot } from "./ISlot"; /** * The SlotList class represents an immutable list of Slot objects. * * @author Joa Ebert * @author Robert Penner */ export declare class SlotList { /** * Represents an empty list. Used as the list terminator. */ static NIL: SlotList; head: ISlot; tail: SlotList; nonEmpty: boolean; /** * Creates and returns a new SlotList object. * *
A user never has to create a SlotList manually.
* Use the NIL element to represent an empty list.
* NIL.prepend(value) would create a list containing value
ArgumentError: Parameters head and tail are null. Use the NIL element instead.
* @throws ArgumentError ArgumentError: Parameter head cannot be null.
*/
constructor(head: ISlot, tail?: SlotList);
/**
* The number of slots in the list.
*/
get length(): number;
/**
* Prepends a slot to this list.
*
* @param slot The item to be prepended.
* @return A list consisting of slot followed by all elements of this list.
*
* @throws ArgumentError ArgumentError: Parameter head cannot be null.
*/
prepend(slot: ISlot): SlotList;
/**
* Appends a slot to this list.
* Note: appending is O(n). Where possible, prepend which is O(1).
* In some cases, many list items must be cloned to
* avoid changing existing lists.
*
* @param slot The item to be appended.
* @return A list consisting of all elements of this list followed by slot.
*/
append(slot: ISlot): SlotList;
/**
* Insert a slot into the list in a position according to its priority.
* The higher the priority, the closer the item will be inserted to the list head.
*
* @params slot The item to be inserted.
*
* @throws ArgumentError ArgumentError: Parameters head and tail are null. Use the NIL element instead.
* @throws ArgumentError ArgumentError: Parameter head cannot be null.
*/
insertWithPriority(slot: ISlot): SlotList;
/**
* Returns the slots in this list that do not contain the supplied listener.
* Note: assumes the listener is not repeated within the list.
*
* @param listener The function to remove.
* @return A list consisting of all elements of this list that do not have listener.
*/
filterNot(listener: Function): SlotList;
/**
* Determines whether the supplied listener Function is contained within this list
*/
contains(listener: Function): boolean;
/**
* Retrieves the ISlot associated with a supplied listener within the SlotList.
*
* @param listener The Function being searched for
* @return The ISlot in this list associated with the listener parameter through the ISlot.listener property.
* Returns null if no such ISlot instance exists or the list is empty.
*/
find(listener: Function): ISlot;
toString(): string;
}