PINE LIBRARY

garbage_collection_and_utilities

تم تحديثه
Garbage Collection and Utilities is a library that offers a set of functions designed for efficient management of various types of arrays. This library provides garbage collection utilities to remove and delete excess elements, and also includes utilities for checking the size of arrays. It's particularly useful for developers who want to manage labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings efficiently within their scripts.

Both dump and trim act on the array backwards. This means that for trim, the elements that will be left start from 0. If you want the most recent element to be left after trim, you must use unshift().

Garbage Collection:
  • Functions to remove and delete excess elements from various types of arrays.
  • Useful for freeing up memory and keeping the arrays within desired size limits.

Size Checking:
  • Functions to check if arrays are larger than a specified size.
  • Helps in ensuring that arrays have enough elements before performing operations.

Supported Types:
Compatible with a wide range of array types, including labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings.

Usage:
The dump methods are ideal for clearing out unwanted elements from arrays, while the trim methods allow for more refined control over the size of arrays.
The ready methods enable you to verify if arrays have the required number of elements before proceeding with further operations.

Library "garbage_collection_and_utilities"
Provides garbage collection utilities for managing and trimming various types of arrays, and utilities to check if an array is of a specific size. Included types are: labels, lines, polylines, boxes, linefills, chart points, floats, integers, booleans, and strings.

method ready(self, size)
  Checks if an array of labels is larger than a specified size
  Namespace types: array<label>
  Parameters:
    self (array<label>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of lines is larger than a specified size
  Namespace types: array<line>
  Parameters:
    self (array<line>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of polylines is larger than a specified size
  Namespace types: array<polyline>
  Parameters:
    self (array<polyline>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of boxes is larger than a specified size
  Namespace types: array<box>
  Parameters:
    self (array<box>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of linefills is larger than a specified size
  Namespace types: array<linefill>
  Parameters:
    self (array<linefill>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of chart points is larger than a specified size
  Namespace types: array<chart.point>
  Parameters:
    self (array<chart.point>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of floats is larger than a specified size
  Namespace types: array<float>
  Parameters:
    self (array<float>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of integers is larger than a specified size
  Namespace types: array<int>
  Parameters:
    self (array<int>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of booleans is larger than a specified size
  Namespace types: array<bool>
  Parameters:
    self (array<bool>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method ready(self, size)
  Checks if an array of strings is larger than a specified size
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    size (int): The minimum size of the array
  Returns: A boolean indicating whether the array is ready

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of labels
  Namespace types: array<label>
  Parameters:
    self (array<label>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of lines
  Namespace types: array<line>
  Parameters:
    self (array<line>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of polylines
  Namespace types: array<polyline>
  Parameters:
    self (array<polyline>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of boxes
  Namespace types: array<box>
  Parameters:
    self (array<box>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of linefills
  Namespace types: array<linefill>
  Parameters:
    self (array<linefill>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of chart points
  Namespace types: array<chart.point>
  Parameters:
    self (array<chart.point>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of floats
  Namespace types: array<float>
  Parameters:
    self (array<float>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of integers
  Namespace types: array<int>
  Parameters:
    self (array<int>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of booleans
  Namespace types: array<bool>
  Parameters:
    self (array<bool>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method dump(self, max_size, trigger)
  Removes and deletes excess elements from an array of strings
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the dumping process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of labels
  Namespace types: array<label>
  Parameters:
    self (array<label>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of lines
  Namespace types: array<line>
  Parameters:
    self (array<line>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of polylines
  Namespace types: array<polyline>
  Parameters:
    self (array<polyline>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of boxes
  Namespace types: array<box>
  Parameters:
    self (array<box>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of linefills
  Namespace types: array<linefill>
  Parameters:
    self (array<linefill>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of chart points
  Namespace types: array<chart.point>
  Parameters:
    self (array<chart.point>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of floats
  Namespace types: array<float>
  Parameters:
    self (array<float>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of integers
  Namespace types: array<int>
  Parameters:
    self (array<int>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of booleans
  Namespace types: array<bool>
  Parameters:
    self (array<bool>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void

method trim(self, max_size, min_size, trigger)
  Removes excess elements and trims an array of strings
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void
ملاحظات الأخبار
v2

Changed the order of arguments for trim so that min_size comes before max_size. Added pop_at() and shift_at() functions. shift_at and pop_at, pop/shift when the array is a specified size.

Added:
method pop_at(self, max_size)
  Removes the last element from an array of strings if the array is larger than a specified size
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    max_size (int): The maximum size of the array
  Returns: void

method shift_at(self, max_size)
  Removes the first element from an array of strings if the array is larger than a specified size
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    max_size (int): The maximum size of the array
  Returns: void

Updated:
method trim(self, min_size, max_size, trigger)
  Removes excess elements and trims an array of strings
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the trimming process
  Returns: void
ملاحظات الأخبار
v3

Added array.length() which allows you to get a 0 indexed array size.
Added pop_for() and shift_for() which is like trim but it uses pop and shift. This is handy if you want to order your arrays arbitrarily.

Added:
method length(self)
  Returns the length of an array of strings, adjusted for zero-based indexing
  Namespace types: array<string>
  Parameters:
    self (array<string>)
  Returns: The length of the array, or -1 if the array is empty

method pop_for(self, min_size, max_size, trigger)
  Removes excess elements from the end of an array of strings using the pop method
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the popping process
  Returns: void

method shift_for(self, min_size, max_size, trigger)
  Removes excess elements from the start of an array of strings using the shift method
  Namespace types: array<string>
  Parameters:
    self (array<string>)
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void
ملاحظات الأخبار
v4

Changed the array.size() - 1 to array.length() in the functions. lol
ملاحظات الأخبار
v5

Added:
pop_label_at(max_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of labels
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_line_at(max_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of lines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_polyline_at(max_size, trigger)
  Removes and deletes excess polylines if the global array of polylines is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of polylines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_box_at(max_size, trigger)
  Removes and deletes excess boxes if the global array of boxes is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of boxes
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_linefill_at(max_size, trigger, remove_line)
  Removes and deletes excess linefills if the global array of linefills is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of linefills
    trigger (bool): A condition to trigger the popping process
    remove_line (bool): A condition to remove the associated lines when popping linefills
  Returns: void

pop_all_drawings_at(max_size, trigger)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global drawing arrays
    trigger (bool): A condition to trigger the popping process
  Returns: void

shift_label_at(max_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of labels
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_line_at(max_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of lines
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_polyline_at(max_size, trigger)
  Removes and deletes excess polylines if the global array of polylines is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of polylines
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_box_at(max_size, trigger)
  Removes and deletes excess boxes if the global array of boxes is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of boxes
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_linefill_at(max_size, trigger, remove_line)
  Removes and deletes excess linefills if the global array of linefills is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global array of linefills
    trigger (bool): A condition to trigger the shifting process
    remove_line (bool): A condition to remove the associated lines when shifting linefills
  Returns: void

shift_all_drawings_at(max_size, trigger)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global drawing arrays
    trigger (bool): A condition to trigger the shifting process
  Returns: void
ملاحظات الأخبار
v6
pop_label_for(max_size, min_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global array of labels
    min_size (int): The minimum size of the global array of labels
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_line_for(max_size, min_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global array of lines
    min_size (int): The minimum size of the global array of lines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_polyline_for(max_size, min_size, trigger)
  Removes and deletes excess polylines if the global array of polylines is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global array of polylines
    min_size (int): The minimum size of the global array of polylines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_box_for(max_size, min_size, trigger)
  Removes and deletes excess boxes if the global array of boxes is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global array of boxes
    min_size (int): The minimum size of the global array of boxes
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_linefill_for(max_size, min_size, trigger, remove_line)
  Removes and deletes excess linefills if the global array of linefills is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global array of linefills
    min_size (int): The minimum size of the global array of linefills
    trigger (bool): A condition to trigger the popping process
    remove_line (bool): A condition to remove the associated lines when popping linefills
  Returns: void

pop_all_drawings_for(max_size, min_size, trigger)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size using the pop method
  Parameters:
    max_size (int): The maximum size of the global drawing arrays
    min_size (int): The minimum size of the global drawing arrays
    trigger (bool): A condition to trigger the popping process
  Returns: void

shift_label_for(max_size, min_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size using the shift method
  Parameters:
    max_size (int): The maximum size of the global array of labels
    min_size (int): The minimum size of the global array of labels
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_line_for(max_size, min_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size using the shift method
  Parameters:
    max_size (int): The maximum size of the global array of lines
    min_size (int): The minimum size of the global array of lines
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_polyline_for(max_size, min_size, trigger)
  Removes and deletes excess elements from the start of an array of polylines using the shift method
  Parameters:
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_box_for(max_size, min_size, trigger)
  Removes and deletes excess elements from the start of an array of boxes using the shift method
  Parameters:
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_linefill_for(max_size, min_size, trigger, remove_line)
  Removes excess elements from the start of an array of linefills using the shift method
  Parameters:
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the shifting process
    remove_line (bool): A condition to remove the associated lines when shifting linefills
  Returns: void

shift_all_drawings_for(max_size, min_size, trigger)
  Removes excess elements from the start of all drawing objects using the shift method
  Parameters:
    max_size (int): The maximum size of the array
    min_size (int): The minimum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void
ملاحظات الأخبار
v7

fixed order of arguments for x_for() functions and added the remove_line argument.

Updated:
pop_all_drawings_at(max_size, trigger, remove_line)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global drawing arrays
    trigger (bool): A condition to trigger the popping process
    remove_line (bool)
  Returns: void

shift_all_drawings_at(max_size, trigger, remove_line)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size
  Parameters:
    max_size (int): The maximum size of the global drawing arrays
    trigger (bool): A condition to trigger the shifting process
    remove_line (bool)
  Returns: void

pop_label_for(min_size, max_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global array of labels
    max_size (int): The maximum size of the global array of labels
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_line_for(min_size, max_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global array of lines
    max_size (int): The maximum size of the global array of lines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_polyline_for(min_size, max_size, trigger)
  Removes and deletes excess polylines if the global array of polylines is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global array of polylines
    max_size (int): The maximum size of the global array of polylines
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_box_for(min_size, max_size, trigger)
  Removes and deletes excess boxes if the global array of boxes is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global array of boxes
    max_size (int): The maximum size of the global array of boxes
    trigger (bool): A condition to trigger the popping process
  Returns: void

pop_linefill_for(min_size, max_size, trigger, remove_line)
  Removes and deletes excess linefills if the global array of linefills is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global array of linefills
    max_size (int): The maximum size of the global array of linefills
    trigger (bool): A condition to trigger the popping process
    remove_line (bool): A condition to remove the associated lines when popping linefills
  Returns: void

pop_all_drawings_for(min_size, max_size, trigger, remove_line)
  Removes and deletes excess drawings if any global drawing array is larger than a specified size using the pop method
  Parameters:
    min_size (int): The minimum size of the global drawing arrays
    max_size (int): The maximum size of the global drawing arrays
    trigger (bool): A condition to trigger the popping process
    remove_line (bool)
  Returns: void

shift_label_for(min_size, max_size, trigger)
  Removes and deletes excess labels if the global array of labels is larger than a specified size using the shift method
  Parameters:
    min_size (int): The minimum size of the global array of labels
    max_size (int): The maximum size of the global array of labels
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_line_for(min_size, max_size, trigger)
  Removes and deletes excess lines if the global array of lines is larger than a specified size using the shift method
  Parameters:
    min_size (int): The minimum size of the global array of lines
    max_size (int): The maximum size of the global array of lines
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_polyline_for(min_size, max_size, trigger)
  Removes and deletes excess elements from the start of an array of polylines using the shift method
  Parameters:
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_box_for(min_size, max_size, trigger)
  Removes and deletes excess elements from the start of an array of boxes using the shift method
  Parameters:
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the shifting process
  Returns: void

shift_linefill_for(min_size, max_size, trigger, remove_line)
  Removes excess elements from the start of an array of linefills using the shift method
  Parameters:
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the shifting process
    remove_line (bool): A condition to remove the associated lines when shifting linefills
  Returns: void

shift_all_drawings_for(min_size, max_size, trigger, remove_line)
  Removes excess elements from the start of all drawing objects using the shift method
  Parameters:
    min_size (int): The minimum size of the array
    max_size (int): The maximum size of the array
    trigger (bool): A condition to trigger the shifting process
    remove_line (bool)
  Returns: void
arraysdisplayutilities

مكتبة باين

كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشور تحكمه قوانين الموقع.


يعمل أيضًا:

إخلاء المسؤولية