variables

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IVariable

type IVariable interface {
	// The variable name.
	Name() string

	// Gets the variable value.
	Value() *variants.Variant

	// Sets the variable value.
	SetValue(value *variants.Variant)
}

Defines a variable interface.

type IVariableCollection

type IVariableCollection interface {
	// Adds a new variable to the collection.
	//
	// Parameters:
	//   - variable: a variable to be added.
	Add(variable IVariable)

	// A number of variables stored in the collection.
	Length() int

	// Get a variable by its index.
	//
	// Parameters:
	//   - index: a variable index.
	// Returns: a retrieved variable.
	Get(index int) IVariable

	// Get all variables stores in the collection
	// Returns: a list with variables.
	GetAll() []IVariable

	// Finds variable index in the list by it's name.
	//
	// Parameters:
	//   - name: The variable name to be found.
	// Returns: Variable index in the list or <code>-1</code> if variable was not found.
	FindIndexByName(name string) int

	// Finds variable in the list by it's name.
	//
	// Parameters:
	//   - name: The variable name to be found.
	// Returns: Variable or <code>null</code> if function was not found.
	FindByName(name string) IVariable

	// Finds variable in the list or create a new one if variable was not found.
	//
	// Parameters:
	//   - name: The variable name to be found.
	// Returns: Found or created variable.
	Locate(name string) IVariable

	// Removes a variable by its index.
	//
	// Parameters:
	//   - index: a index of the variable to be removed.
	Remove(index int)

	// Removes variable by it's name.
	//
	// Parameters:
	//   - name: The variable name to be removed.
	RemoveByName(name string)

	// Clears the collection.
	Clear()

	// Clears all stored variables (assigns null values).
	ClearValues()
}

Defines a variables list.

type Variable

type Variable struct {
	// contains filtered or unexported fields
}

Implements a variable holder object.

func EmptyVariable

func EmptyVariable(name string) *Variable

Constructs a new empty variable.

Parameters:

  • name: The name of this variable.

func NewVariable

func NewVariable(name string, value *variants.Variant) *Variable

Constructs this variable with name and value.

Parameters:

  • name: The name of this variable.
  • value: The variable value.

func (*Variable) Name

func (c *Variable) Name() string

The variable name.

func (*Variable) SetValue

func (c *Variable) SetValue(value *variants.Variant)

Sets the variable value.

func (*Variable) Value

func (c *Variable) Value() *variants.Variant

Gets the variable value.

type VariableCollection

type VariableCollection struct {
	// contains filtered or unexported fields
}

Implements a variables list.

func NewVariableCollection

func NewVariableCollection() *VariableCollection

func (*VariableCollection) Add

func (c *VariableCollection) Add(variable IVariable)

Adds a new variable to the collection.

Parameters:

  • variable: a variable to be added.

func (*VariableCollection) Clear

func (c *VariableCollection) Clear()

Clears the collection.

func (*VariableCollection) ClearValues

func (c *VariableCollection) ClearValues()

Clears all stored variables (assigns null values).

func (*VariableCollection) FindByName

func (c *VariableCollection) FindByName(name string) IVariable

Finds variable in the list by it's name.

Parameters:

  • name: The variable name to be found.

Returns: Variable or <code>null</code> if function was not found.

func (*VariableCollection) FindIndexByName

func (c *VariableCollection) FindIndexByName(name string) int

Finds variable index in the list by it's name.

Parameters:

  • name: The variable name to be found.

Returns: Variable index in the list or <code>-1</code> if variable was not found.

func (*VariableCollection) Get

func (c *VariableCollection) Get(index int) IVariable

Get a variable by its index.

Parameters:

  • index: a variable index.

Returns: a retrieved variable.

func (*VariableCollection) GetAll

func (c *VariableCollection) GetAll() []IVariable

Get all variables stores in the collection

Returns: a list with variables.

func (*VariableCollection) Length

func (c *VariableCollection) Length() int

A number of variables stored in the collection.

func (*VariableCollection) Locate

func (c *VariableCollection) Locate(name string) IVariable

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

Parameters:

  • name: The variable name to be found.

Returns: Found or created variable.

func (*VariableCollection) Remove

func (c *VariableCollection) Remove(index int)

Removes a variable by its index.

Parameters:

  • index: a index of the variable to be removed.

func (*VariableCollection) RemoveByName

func (c *VariableCollection) RemoveByName(name string)

Removes variable by it's name.

Parameters:

  • name: The variable name to be removed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL