PINE LIBRARY

datastructures

330
Library "datastructures"
Collection of complex data structures not generally present as part of pinescript and can be used for collection and transformation of the data

method init(this)
  initialise StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet to be initialised
  Returns: current object of StringSet

method add(this, value)
  add value to StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
value the key of stringset to be set
    value (string)
  Returns: current object of StringSet

method clear(this)
  clear StringSet contents
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
  Returns: current object of StringSet

method remove(this, value)
  remove value from StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
value the key of stringset to be removed
    value (string)
  Returns: current object of StringSet

method size(this)
  get size of the StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
  Returns: size of StringSet map

method isEmpty(this)
  check if stringset is empty
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
  Returns: true if empty else returns false

method iterator(this)
  get values of the StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
  Returns: values of StringSet

method contains(this, value)
  check if value is present in StringSet
  Namespace types: StringSet
  Parameters:
    this (StringSet): StringSet object
    value (string)
  Returns: true if Value is present. False otherwise

method initialiseCountMap(types, numberOfStates)
  Initialise a new map of string to Count
  Namespace types: array<string>
  Parameters:
    types (array<string>): array of string containing map keys
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, Count>() with empty initialisation

method initialiseCountMap(types, numberOfStates)
  Initialise a new map of string to Count
  Namespace types: map<string, bool>
  Parameters:
    types (map<string, bool>): map containing types and configurable boolean flag
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, Count>() with empty initialisation

method get(this, key, n)
  get count based on primary string key and secondary int key
  Namespace types: map<string, Count>
  Parameters:
    this (map<string, Count>): map of string to to Count
    key (string): primary key
    n (int): secondary key
  Returns: derived count from map of map

method get(this, key, n)
  get array of int associated with key and n
  Namespace types: map<string, MapToInts>
  Parameters:
    this (map<string, MapToInts>): map of string to to MapToInts
    key (string): primary string key
    n (int): secondary int key
  Returns: derived array of int for the given key combination

method get(this, key, n)
  get array of float associated with key and n
  Namespace types: map<string, MapToFloats>
  Parameters:
    this (map<string, MapToFloats>): map of string to to MapToFloats
    key (string): primary string key
    n (int): secondary int key
  Returns: derived array of float

method get(this, key)
  get values of Ints based on key
  Namespace types: map<string, Ints>
  Parameters:
    this (map<string, Ints>): map of string to Ints
    key (string): string key
  Returns: values inside Ints object associated in the map

method set(this, key, n, value)
  set count for specific primary and secondary key
  Namespace types: map<string, Count>
  Parameters:
    this (map<string, Count>): map of string to to Count
    key (string): primary string key
    n (int): secondary int key
    value (int): the new count value to be set
  Returns: updated value for key and n

method increment(this, key, n)
  increment count for specific primary and secondary key
  Namespace types: map<string, Count>
  Parameters:
    this (map<string, Count>): map of string to to Count
    key (string): primary string key
    n (int): secondary int key
  Returns: incremented value

method increment(this, key, n)
  intcrement the value of Ints based on key and n (secondary key)
  Namespace types: map<string, Ints>
  Parameters:
    this (map<string, Ints>): map of string to Ints
    key (string): string key
    n (int): secondary int key
  Returns: incremented nth object of Ints associated with key

method initialiseIntsMap(types, numberOfStates)
  Initialise a new map of string to Map to Ints
  Namespace types: array<string>
  Parameters:
    types (array<string>): array of string containing map keys
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, MapToInts>() with empty initialisation

method initialiseIntsMap(types, numberOfStates)
  Initialise a new map of string to Map to Ints
  Namespace types: map<string, bool>
  Parameters:
    types (map<string, bool>): map with boolean flag
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, MapToInts>() with empty initialisation

method initialiseFloatsMap(types, numberOfStates)
  Initialise a new map of string to Map to Floats
  Namespace types: array<string>
  Parameters:
    types (array<string>): array of string containing map keys
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, MapToFloats>() with empty initialisation

method initialiseFloatsMap(types, numberOfStates)
  Initialise a new map of string to Map to Floats
  Namespace types: map<string, bool>
  Parameters:
    types (map<string, bool>): map with boolean flag
    numberOfStates (int): number of items to be tracked for each type
  Returns: new map<string, MapToFloats>() with empty initialisation

method initialiseMapOfInts(types, numberOfStates)
  Initialise map of two dimentional Ints based on types and number of states
  Namespace types: array<string>
  Parameters:
    types (array<string>): types array for which a new Map to Ints to be created
    numberOfStates (int): number of states for which the Ints needs to be initialised
  Returns: new map of string to two dimension array of int (Ints)

method initialiseMapOfInts(types, numberOfStates)
  Initialise map of two dimentional Ints based on types and number of states
  Namespace types: map<string, bool>
  Parameters:
    types (map<string, bool>): types map for which a new Map to Ints to be created along with bool flag
    numberOfStates (int): number of states for which the Ints needs to be initialised
  Returns: new map of string to two dimension array of int (Ints)

StringSet
  Set implementation using map
  Fields:
    strSet (map<string, bool>): map of string to bool

Count
  type containing map of int to int
  Fields:
    count (map<int, int>): map of int to int used for counting

Ints
  custom type to enable array of array of int
  Fields:
    values (array<int>): int array

Floats
  custom type to enable array of array of float
  Fields:
    values (array<float>): float array

MapToInts
  type containing map of int to int array
  Fields:
    vmap (map<int, Ints>): map of int to Ints used as counting collection

MapToFloats
  type containing map of int to float array
  Fields:
    vmap (map<int, Floats>): map of int to Floats used as floating stat collection

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.