IFunctionCollection

Implements a list of functions.

Description

The IFunctionCollection class allows you to create a list of functions.

Properties

length

Gets the number of functions stored in the collection.

length(): int

  • retuns: int - number of stored functions.

Instance methods

add

Adds a new function to the collection.

add(func: IFunction)

  • func: IFunction - an array with function parameters.

clear

Clears the collection.

clear()

find_by_name

Finds a function in the list by it’s name.

find_by_name(name: str): IFunction

  • name: str - function name to be found.
  • returns: IFunction - function or None if no function was not found.

find_index_by_name

Finds a function’s index in the list by it’s name.

find_index_by_name(name: str): int

  • name: str - function name to be found.
  • returns: int - function’s index in the list or -1 if nofunction was not found.

get

Gets a function by its index.

get(index: int): IFunction

  • index: int - function’s index.
  • returns: IFunction - retrieved function.

get_all

Gets all functions stored in the collection.

get_all(): IFunction[]

remove

Removes a function by its index.

remove(index: number): void

  • index: number - index of the function to be removed.

remove_by_name

Removes a function by its name.

remove_by_name(name: str): void

  • name: str - name of the function to be removed.