IFunctionCollection

Implements a list of functions.

Description

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

Methods

Add

Adds a new function to the collection.

(c *FunctionCollection) Add(function IFunction)

  • func: IFunction - array with function parameters.

Clear

Clears the collection.

(c *FunctionCollection) Clear()

FindByName

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

(c *FunctionCollection) FindByName(name string) IFunction

  • name: string - name of the function to be found.
  • returns: IFunction - function or nil if the function was not found.

FindIndexByName

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

(c *FunctionCollection) FindIndexByName(name string) int

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

Get

Gets a function by its index.

(c *FunctionCollection) Get(index int) IFunction

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

GetAll

Gets all functions stores in the collection.

(c *FunctionCollection) GetAll() []IFunction

Length

Gets the number of functions stored in the collection.

Length() int

  • retuns: int - number of stored functions.

remove

Removes a function by its index.

(c *FunctionCollection) Remove(index int)

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

RemoveByName

Removes a function by its name.

(c *FunctionCollection) RemoveByName(name string)

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