IVariableCollection

Defines a list of variables.

Description

The IVariableCollection interface defines a list of variables.

Properties

length

Gets the number of variables stored in the collection.

length(): number

  • returns: number - number of stored variables.

Instance methods

add

Adds a new variable to the collection.

add(variable: IVariable): void

  • variable: IVariable - variable to be added.

clear

Clears the collection.

clear(): void

clearValues

Clears all stored variables (assigns null values).

clearValues(): void

findByName

Finds variable in the list by it’s name.

findByName(name: string): IVariable

  • name: string - The variable name to be found.
  • returns: IVariable - Variable or null if function was not found.

findIndexByName

Finds a variable index in the list by the variable’s name.

findIndexByName(name: string): number

  • name: string - name of the variable to be found.
  • returns: number - variable index in the list or -1 if variable was not found.

get

Gets a variable by its index.

get(index: number): IVariable

  • index: string - variable index.
  • returns: IVariable - retrieved variable.

getAll

Gets all the variables stored in the collection.

getAll(): IVariable[]

locate

Finds a variable in the list or creates a new one if the variable was not found.

locate(name: string): IVariable

  • name: string - name of the variable to be found.
  • returns: IVariable - found or created variable.

remove

Removes a variable by its index.

remove(index: number): void

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

removeByName

Removes a variable by it’s name.

removeByName(name: string): void

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