CollectionsArray plugin

Плагин для работы с коллекцией - список (массивы)

Версия: 1.0

Дата релиза: July 30, 2023

new_list_collection

Действие создаёт новый пустой экземпляр коллекции.

new_list_collection()

Описание возврата: Новый список

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('new_list_collection');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "pig");

echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('new_list_collection')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")

echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('new_list_collection')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")

print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

add_value_to_list

Добавляет указанное значение в конец выбранной коллекции

add_value_to_list(List collection, string valueToAdd)
collection Коллекция
valueToAdd Значение для добавления

Описание возврата: Список с добавленным значением

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('add_value_to_list');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "pig");
echo $collectionsarray->list_to_string($array)."\n";

$array = $collectionsarray->add_value_to_list($array, "dog");
$array = $collectionsarray->add_value_to_list($array, "lag");
echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('add_value_to_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")
echo(`${collectionsarray.list_to_string(array)}\n`)

array = collectionsarray.add_value_to_list(array, "dog")
array = collectionsarray.add_value_to_list(array, "lag")
echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('add_value_to_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")
print(collectionsarray.list_to_string(array))

array = collectionsarray.add_value_to_list(array, "dog")
array = collectionsarray.add_value_to_list(array, "lag")
print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

copy_part_list

Действие копирует часть списка обозначенной длины, начиная с указанного индекса, исключая крайнее значение в этих рамках, и возвращает ее как новый список

copy_part_list(List collection, int startIndex, int length)
collection Коллекция
startIndex Индекс, с которого начинается действие
length Длина списка

Описание возврата: Новый список

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('copy_part_list');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "grape");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
echo $collectionsarray->list_to_string($array)."\n";

$new_array = $collectionsarray->copy_part_list($array, 1, 3);
echo $collectionsarray->list_to_string($new_array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('copy_part_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "grape")
array = collectionsarray.add_value_to_list(array, "kiwi")
echo(`${collectionsarray.list_to_string(array)}\n`)

new_array = collectionsarray.copy_part_list(array, 1, 3)
echo(`${collectionsarray.list_to_string(new_array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('copy_part_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "grape")
array = collectionsarray.add_value_to_list(array, "kiwi")
print(collectionsarray.list_to_string(array))

new_array = collectionsarray.copy_part_list(array, 1, 3)
print(collectionsarray.list_to_string(new_array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

insert_collection_at_index

Действие вставляет коллекцию в список по индексу

insert_collection_at_index(List collection, int index, List insertCollection)
collection Коллекция
index Индекс списка
insertCollection Интегрируемая коллекция

Описание возврата: Результирующий список

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('insert_collection_at_index');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");

$array1 = $collectionsarray->new_list_collection();
$array1 = $collectionsarray->add_value_to_list($array1, "kiwi");
$array1 = $collectionsarray->add_value_to_list($array1, "12");

$new_array = $collectionsarray->insert_collection_at_index($array, 1, $array1);

echo $collectionsarray->list_to_string($new_array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('insert_collection_at_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "kiwi")
array1 = collectionsarray.add_value_to_list(array1, "12")

new_array = collectionsarray.insert_collection_at_index(array, 1, array1)

echo(`${collectionsarray.list_to_string(new_array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('insert_collection_at_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "kiwi")
array1 = collectionsarray.add_value_to_list(array1, "12")

new_array = collectionsarray.insert_collection_at_index(array, 1, array1)

print(collectionsarray.list_to_string(new_array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

merge_collections

Действие соединяет две коллекции в установленном порядке.

merge_collections(List firstCollection, List secondCollection)
firstCollection Первая коллекция
secondCollection Вторая коллекция

Описание возврата: Новый список созданный из двух

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('merge_collections');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");

$array1 = $collectionsarray->new_list_collection();
$array1 = $collectionsarray->add_value_to_list($array1, "kiwi");
$array1 = $collectionsarray->add_value_to_list($array1, "12");

$new_array = $collectionsarray->merge_collections($array, $array1);

echo $collectionsarray->list_to_string($new_array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('merge_collections')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "kiwi")
array1 = collectionsarray.add_value_to_list(array1, "12")

new_array = collectionsarray.merge_collections(array, array1)

echo(`${collectionsarray.list_to_string(new_array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('merge_collections')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "kiwi")
array1 = collectionsarray.add_value_to_list(array1, "12")

new_array = collectionsarray.merge_collections(array, array1)

print(collectionsarray.list_to_string(new_array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

remove_elements

Действие удаляет из списка элементы указанной коллекции

remove_elements(List firstCollection, List secondCollection)
firstCollection Первая коллекция
secondCollection Вторая коллекция

Описание возврата: Пустое значение

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('remove_elements');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
$array = $collectionsarray->add_value_to_list($array, "12");

$array1 = $collectionsarray->new_list_collection();
$array1 = $collectionsarray->add_value_to_list($array1, "apple");
$array1 = $collectionsarray->add_value_to_list($array1, "orange");
$array1 = $collectionsarray->add_value_to_list($array1, "12");

$collectionsarray->remove_elements($array, $array1);

echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('remove_elements')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "apple")
array1 = collectionsarray.add_value_to_list(array1, "orange")
array1 = collectionsarray.add_value_to_list(array1, "12")

collectionsarray.remove_elements(array, array1)

echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('remove_elements')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "apple")
array1 = collectionsarray.add_value_to_list(array1, "orange")
array1 = collectionsarray.add_value_to_list(array1, "12")

collectionsarray.remove_elements(array, array1)

print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

remove_range

Действие удаляет элементы коллекции в заданном диапазоне

remove_range(List collection, int startIndex=0, int endIndex=-1)
collection Коллекция
startIndex Индекс, с которого начинается действие
endIndex Последний индекс списка

Описание возврата: Новый список, из которого удалены соответствующие элементы

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('remove_range');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
$array = $collectionsarray->add_value_to_list($array, "12");

$new_array = $collectionsarray->remove_range($array, 1, 4);

echo $collectionsarray->list_to_string($new_array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('remove_range')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

new_array = collectionsarray.remove_range(array, 1, 4)

echo(`${collectionsarray.list_to_string(new_array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('remove_range')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

new_array = collectionsarray.remove_range(array, 1, 4)

print(collectionsarray.list_to_string(new_array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

reverse

Действие меняет порядок элементов в указанном списке на противоположный

reverse(List collection)
collection Коллекция

Описание возврата: Пустое значение

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('reverse');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
$array = $collectionsarray->add_value_to_list($array, "12");

$collectionsarray->reverse($array);

echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('reverse')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

collectionsarray.reverse(array)

echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('reverse')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

collectionsarray.reverse(array)

print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

replace_at_index

Действие заменяет значение в списке по индексу

replace_at_index(List collection, int index, string newValue)
collection Коллекция
index Индекс списка
newValue Новое значение

Описание возврата: Пустое значение

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('replace_at_index');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
$array = $collectionsarray->add_value_to_list($array, "12");

$collectionsarray->replace_at_index($array, 1, "new");

echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('replace_at_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

collectionsarray.replace_at_index(array, 1, "new")

echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('replace_at_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

collectionsarray.replace_at_index(array, 1, "new")

print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

sort

Сортирует коллекцию в указанном порядке

sort(List collection, bool ascendingOrder=true)
collection Коллекция
ascendingOrder Флаг, указывающий порядок сортировки (true - по возрастанию, false - по убыванию)

Описание возврата: Новый отсортированный список

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('sort');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "kiwi");
$array = $collectionsarray->add_value_to_list($array, "12");

$sort_list = $collectionsarray->sort($array);
echo $collectionsarray->list_to_string($array)."\n";

$sort_list = $collectionsarray->sort($array, $false);
echo $collectionsarray->list_to_string($array)."\n";

$array1 = $collectionsarray->new_list_collection();
$array1 = $collectionsarray->add_value_to_list($array1, "254");
$array1 = $collectionsarray->add_value_to_list($array1, "11");
$array1 = $collectionsarray->add_value_to_list($array1, "1456");
$array1 = $collectionsarray->add_value_to_list($array1, "75");
$array1 = $collectionsarray->add_value_to_list($array1, "16");
   
$sort_list = $collectionsarray->sort($array1);
echo $collectionsarray->list_to_string($array1)."\n";

$sort_list = $collectionsarray->sort($array1, $false);
echo $collectionsarray->list_to_string($array1)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('sort')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

sort_list = collectionsarray.sort(array)
echo(`${collectionsarray.list_to_string(array)}\n`)

sort_list = collectionsarray.sort(array, false)
echo(`${collectionsarray.list_to_string(array)}\n`)

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "254")
array1 = collectionsarray.add_value_to_list(array1, "11")
array1 = collectionsarray.add_value_to_list(array1, "1456")
array1 = collectionsarray.add_value_to_list(array1, "75")
array1 = collectionsarray.add_value_to_list(array1, "16")
   
sort_list = collectionsarray.sort(array1)
echo(`${collectionsarray.list_to_string(array1)}\n`)

sort_list = collectionsarray.sort(array1, false)
echo(`${collectionsarray.list_to_string(array1)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('sort')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "kiwi")
array = collectionsarray.add_value_to_list(array, "12")

sort_list = collectionsarray.sort(array)
print(collectionsarray.list_to_string(array))

sort_list = collectionsarray.sort(array, false)
print(collectionsarray.list_to_string(array))

array1 = collectionsarray.new_list_collection()
array1 = collectionsarray.add_value_to_list(array1, "254")
array1 = collectionsarray.add_value_to_list(array1, "11")
array1 = collectionsarray.add_value_to_list(array1, "1456")
array1 = collectionsarray.add_value_to_list(array1, "75")
array1 = collectionsarray.add_value_to_list(array1, "16")
   
sort_list = collectionsarray.sort(array1)
print(collectionsarray.list_to_string(array1))

sort_list = collectionsarray.sort(array1, false)
print(collectionsarray.list_to_string(array1))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

get_length_of_list

Действие получает количество элементов в коллекции или массиве

get_length_of_list(List collection)
collection Коллекция

Описание возврата: Количество элементов в списке

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('get_length_of_list');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");

echo $collectionsarray->get_length_of_list($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('get_length_of_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

echo(`${collectionsarray.get_length_of_list(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('get_length_of_list')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

print(collectionsarray.get_length_of_list(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

contains_value

Действие проверяет, содержит ли выбранная коллекция указанный объект

contains_value(List collection, string valueToCheck)
collection Коллекция
valueToCheck Значение для проверки

Описание возврата: Булевое значение (true - содержит, false - не содержит)

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('contains_value');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "pig");
$array = $collectionsarray->add_value_to_list($array, "dog");
$array = $collectionsarray->add_value_to_list($array, "lag");

echo $collectionsarray->list_to_string($array)."\n";

echo $collectionsarray->contains_value($array,"dog")."\n";

echo $collectionsarray->contains_value($array,"1")."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('contains_value')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")
array = collectionsarray.add_value_to_list(array, "dog")
array = collectionsarray.add_value_to_list(array, "lag")

echo(`${collectionsarray.list_to_string(array)}\n`)

echo(`${collectionsarray.contains_value(array,"dog")}\n`)

echo(`${collectionsarray.contains_value(array,"1")}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('contains_value')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "pig")
array = collectionsarray.add_value_to_list(array, "dog")
array = collectionsarray.add_value_to_list(array, "lag")

print(collectionsarray.list_to_string(array))

print(collectionsarray.contains_value(array,"dog"))

print(collectionsarray.contains_value(array,"1"))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

find_first_index

Действие возвращает отсчитываемый от нуля индекс первого вхождения значения в списке

find_first_index(List collection, string value)
collection Коллекция
value Значение элемента

Описание возврата: Числовая переменная, содержащая индекс элемента с указанным значением или -1, если элемент не найден

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('find_first_index');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");

echo $collectionsarray->find_first_index($array, "orange")."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('find_first_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

echo(`${collectionsarray.find_first_index(array, "orange")}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('find_first_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

print(collectionsarray.find_first_index(array, "orange"))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

find_last_index

Действие возвращает индекс последнего вхождения элемента в списке

find_last_index(List collection, string value)
collection Коллекция
value Значение элемента

Описание возврата: Числовая переменная, содержащая индекс элемента с указанным значением или -1, если элемент не найден

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('find_last_index');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");

echo $collectionsarray->find_last_index($array, "orange")."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('find_last_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

echo(`${collectionsarray.find_last_index(array, "orange")}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('find_last_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

print(collectionsarray.find_last_index(array, "orange"))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

get_value_by_index

Действие возвращает значение элемента, порядковый номер позиции которого равен указанному.

get_value_by_index(List collection, int index)
collection Коллекция
index Индекс списка

Описание возврата: Значение соответствующего индекса

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('get_value_by_index');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");
$array = $collectionsarray->add_value_to_list($array, "orange");

echo $collectionsarray->get_value_by_index($array, 1)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('get_value_by_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

echo(`${collectionsarray.get_value_by_index(array, 1)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('get_value_by_index')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")
array = collectionsarray.add_value_to_list(array, "orange")

print(collectionsarray.get_value_by_index(array, 1))

# конец теста
print('\n<hr><br>')

# выход
app.quit()

list_to_string

Действие для перевода списка в строку (для теста фенкционала плагина)

list_to_string(List collection)
collection Коллекция

Описание возврата: Строка из элментов списка

Примеры использования
<?php
// инициализация
$xhe_host = '127.0.0.1:7010';
$relative_app_dir = '..\\..\\..\\';
require($relative_app_dir.'Templates/init.php');
include($relative_app_dir.'Templates/_for_tests_.php');

$bUTF8Ver = true;
$PHP_Use_Trought_Shell = true;

// рабочая папка
$script_folder = $debug->get_cur_script_folder();
// отсносительный путь
$app_dir = realpath($script_folder.$relative_app_dir);
// тестовые данные
$test = new _for_tests_($script_folder, $collectionsarray);

// начало теста
$test->echo_header('list_to_string');

$array = $collectionsarray->new_list_collection();
$array = $collectionsarray->add_value_to_list($array, "apple");
$array = $collectionsarray->add_value_to_list($array, "banana");
$array = $collectionsarray->add_value_to_list($array, "orange");

echo $collectionsarray->list_to_string($array)."\n";

// конец теста
echo "\n<hr><br>";

// выход
$app->quit();
?>
// связь с платформой
xhe_host = '127.0.0.1:7014'
_path = require('path')
relative_app_dir = '..\\..\\..\\'
echo = require(_path.join(relative_app_dir, 'Templates JS', 'init.js'))
_for_tests_ = require(_path.join(relative_app_dir, 'Templates JS', '_for_tests_.js'))

// рабочая папка
script_folder = debug.get_cur_script_folder()
// отсносительны йпуть
app_dir = _path.resolve(_path.join(script_folder, relative_app_dir))
// тестовые данные
test = new _for_tests_(script_folder, collectionsarray)

// начало теста
test.echo_header('list_to_string')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

echo(`${collectionsarray.list_to_string(array)}\n`)

// конец теста
echo('\n<hr><br>')

// выход
app.quit()
# дополнительные пути
import sys, os
relative_app_dir = '..\\..\\..\\'
sys.path.append(os.path.join(relative_app_dir, 'Templates PY'))

# связь с платофрмой
xhe_host = '127.0.0.1:7010'
from xweb_human_emulator import *
from _for_tests_ import _for_tests_

# рабочая папка
script_folder = debug.get_cur_script_folder()
# относительный путь
app_dir = os.path.abspath(os.path.join(script_folder, relative_app_dir))

# тестовые данные
test = _for_tests_(script_folder, collectionsarray)

# начало теста
test.echo_header('list_to_string')

array = collectionsarray.new_list_collection()
array = collectionsarray.add_value_to_list(array, "apple")
array = collectionsarray.add_value_to_list(array, "banana")
array = collectionsarray.add_value_to_list(array, "orange")

print(collectionsarray.list_to_string(array))

# конец теста
print('\n<hr><br>')

# выход
app.quit()