ItemList
The ItemList
class collects items and then arranges them into an array
by priority.
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
Add an item to the list. |
|
public |
Get the content of an item. |
|
public |
Check whether an item is present in the list. |
|
public |
Merge another list's items into this one. |
|
public |
Remove an item from the list. |
|
public |
Replace an item in the list, only if it is already present. |
|
public |
Convert the list into an array of item content arranged by priority. |
Public Constructors
public constructor() source
Public Methods
public add(key: String, content: *, priority: Integer) source
Add an item to the list.
Params:
Name | Type | Attribute | Description |
key | String | A unique key for the item. |
|
content | * | The item's content. |
|
priority | Integer |
|
The priority of the item. Items with a higher priority will be positioned before items with a lower priority. |
public get(key: String): * source
Get the content of an item.
Params:
Name | Type | Attribute | Description |
key | String |
Return:
* |
public has(key: *): boolean source
Check whether an item is present in the list.
Params:
Name | Type | Attribute | Description |
key | * |
public merge(items: ItemList) source
Merge another list's items into this one.
Params:
Name | Type | Attribute | Description |
items | ItemList |
public remove(key: String) source
Remove an item from the list.
Params:
Name | Type | Attribute | Description |
key | String |