@bitbybit-dev/base
Version:
Bit By Bit Developers Base CAD Library to Program Geometry
288 lines (287 loc) • 9.41 kB
TypeScript
import * as Inputs from "../inputs";
/**
* Contains various list methods.
* <div>
* <img src="../assets/images/blockly-images/math/math.svg" alt="Blockly Image"/>
* </div>
*/
export declare class Lists {
/**
* Gets an item from the list by using a 0 based index
* @param inputs a list and an index
* @returns item
* @group get
* @shortname item by index
* @drawable false
*/
getItem<T>(inputs: Inputs.Lists.ListItemDto<T>): T;
/**
* Gets items randomly by using a threshold
* @param inputs a list and a threshold for randomization of items to remove
* @returns list with remaining items
* @group get
* @shortname random get threshold
* @drawable false
*/
randomGetThreshold<T>(inputs: Inputs.Lists.RandomThresholdDto<T>): T[];
/**
* Gets a sub list between start and end indexes
* @param inputs a list and start and end indexes
* @returns sub list
* @group get
* @shortname sublist
* @drawable false
*/
getSubList<T>(inputs: Inputs.Lists.SubListDto<T>): T[];
/**
* Gets nth item in the list
* @param inputs a list and index
* @returns list with filtered items
* @group get
* @shortname every n-th
* @drawable false
*/
getNthItem<T>(inputs: Inputs.Lists.GetNthItemDto<T>): T[];
/**
* Gets elements by pattern
* @param inputs a list and index
* @returns list with filtered items
* @group get
* @shortname by pattern
* @drawable false
*/
getByPattern<T>(inputs: Inputs.Lists.GetByPatternDto<T>): T[];
/**
* Merge elements of lists on a given level and flatten output if needed
* @param inputs lists, level and flatten data
* @returns list with merged lists and flattened lists
* @group get
* @shortname merge levels
* @drawable false
*/
mergeElementsOfLists<T>(inputs: Inputs.Lists.MergeElementsOfLists<T[]>): T[];
/**
* Gets the longest list length from the list of lists
* @param inputs a list of lists
* @returns number of max length
* @group get
* @shortname longest list length
* @drawable false
*/
getLongestListLength<T>(inputs: Inputs.Lists.GetLongestListLength<T[]>): number;
/**
* Reverse the list
* @param inputs a list and an index
* @returns item
* @group edit
* @shortname reverse
* @drawable false
*/
reverse<T>(inputs: Inputs.Lists.ListCloneDto<T>): T[];
/**
* Flip 2d lists - every nth element of each list will form a separate list
* @param inputs a list of lists to flip
* @returns item
* @group edit
* @shortname flip lists
* @drawable false
*/
flipLists<T>(inputs: Inputs.Lists.ListCloneDto<T[]>): T[][];
/**
* Group in lists of n elements
* @param inputs a list
* @returns items grouped in lists of n elements
* @group edit
* @shortname group elements
* @drawable false
*/
groupNth<T>(inputs: Inputs.Lists.GroupListDto<T>): T[][];
/**
* Get the depth of the list
* @param inputs a list
* @returns number of depth
* @group get
* @shortname max list depth
* @drawable false
*/
getListDepth(inputs: Inputs.Lists.ListCloneDto<[]>): number;
/**
* Gets the length of the list
* @param inputs a length list
* @returns a number
* @group get
* @shortname list length
* @drawable false
*/
listLength<T>(inputs: Inputs.Lists.ListCloneDto<T>): number;
/**
* Add item to the list
* @param inputs a list, item and an index
* @returns list with added item
* @group add
* @shortname add item
* @drawable false
*/
addItemAtIndex<T>(inputs: Inputs.Lists.AddItemAtIndexDto<T>): T[];
/**
* Adds item to the list of provided indexes
* @param inputs a list, item and an indexes
* @returns list with added item
* @group add
* @shortname add item at indexes
* @drawable false
*/
addItemAtIndexes<T>(inputs: Inputs.Lists.AddItemAtIndexesDto<T>): T[];
/**
* Adds items to the list of provided indexes matching 1:1, first item will go to first index provided, etc.
* @param inputs a list, items and an indexes
* @returns list with added items
* @group add
* @shortname add items
* @drawable false
*/
addItemsAtIndexes<T>(inputs: Inputs.Lists.AddItemsAtIndexesDto<T>): T[];
/**
* Remove item from the list
* @param inputs a list and index
* @returns list with removed item
* @group remove
* @shortname remove item
* @drawable false
*/
removeItemAtIndex<T>(inputs: Inputs.Lists.RemoveItemAtIndexDto<T>): T[];
/**
* Remove items from the list of provided indexes
* @param inputs a list and indexes
* @returns list with removed items
* @group remove
* @shortname remove items
* @drawable false
*/
removeItemsAtIndexes<T>(inputs: Inputs.Lists.RemoveItemsAtIndexesDto<T>): T[];
/**
* Remove all items from the list
* @param inputs a list
* @returns The length is set to 0 and same array memory object is returned
* @group remove
* @shortname remove all items
* @drawable false
*/
removeAllItems<T>(inputs: Inputs.Lists.ListDto<T>): T[];
/**
* Remove item from the list
* @param inputs a list and index
* @returns list with removed item
* @group remove
* @shortname every n-th
* @drawable false
*/
removeNthItem<T>(inputs: Inputs.Lists.RemoveNthItemDto<T>): T[];
/**
* Removes items randomly by using a threshold
* @param inputs a list and a threshold for randomization of items to remove
* @returns list with removed items
* @group remove
* @shortname random remove threshold
* @drawable false
*/
randomRemoveThreshold<T>(inputs: Inputs.Lists.RandomThresholdDto<T>): T[];
/**
* remove duplicate numbers from the list
* @param inputs a list of numbers
* @returns list with unique numbers
* @group remove
* @shortname remove duplicates
* @drawable false
*/
removeDuplicateNumbers(inputs: Inputs.Lists.RemoveDuplicatesDto<number>): number[];
/**
* remove duplicate numbers from the list with tolerance
* @param inputs a list of numbers and the tolerance
* @returns list with unique numbers
* @group remove
* @shortname remove duplicates tol
* @drawable false
*/
removeDuplicateNumbersTolerance(inputs: Inputs.Lists.RemoveDuplicatesToleranceDto<number>): number[];
/**
* Add item to the end of the list
* @param inputs a list and an item
* @returns list with added item
* @group add
* @shortname add item to list
* @drawable false
*/
addItem<T>(inputs: Inputs.Lists.AddItemDto<T>): T[];
/**
* Add item to the beginning of the list
* @param inputs a list and an item
* @returns list with added item
* @group add
* @shortname prepend item to list
* @drawable false
*/
prependItem<T>(inputs: Inputs.Lists.AddItemDto<T>): T[];
/**
* Add item to the beginning or the end of the list
* @param inputs a list, item and an option for first or last position
* @returns list with added item
* @group add
* @shortname item at first or last
* @drawable false
*/
addItemFirstLast<T>(inputs: Inputs.Lists.AddItemFirstLastDto<T>): T[];
/**
* Creates an empty list
* @returns an empty array list
* @group create
* @shortname empty list
* @drawable false
*/
createEmptyList(): [];
/**
* Repeat the item and add it in the new list
* @param inputs an item to multiply
* @returns list
* @group create
* @shortname repeat
* @drawable false
*/
repeat<T>(inputs: Inputs.Lists.MultiplyItemDto<T>): T[];
/**
* Repeat the list items by adding them in the new list till the certain length of the list is reached
* @param inputs a list to multiply and a length limit
* @returns list
* @group create
* @shortname repeat in pattern
* @drawable false
*/
repeatInPattern<T>(inputs: Inputs.Lists.RepeatInPatternDto<T>): T[];
/**
* Sort the list of numbers in ascending or descending order
* @param inputs a list of numbers to sort and an option for ascending or descending order
* @returns list
* @group sorting
* @shortname sort numbers
* @drawable false
*/
sortNumber(inputs: Inputs.Lists.SortDto<number>): number[];
/**
* Sort the list of texts in ascending or descending order alphabetically
* @param inputs a list of texts to sort and an option for ascending or descending order
* @returns list
* @group sorting
* @shortname sort texts
* @drawable false
*/
sortTexts(inputs: Inputs.Lists.SortDto<string>): string[];
/**
* Sort by numeric JSON property value
* @param inputs a list to sort, a property to sort by and an option for ascending or descending order
* @returns list
* @group sorting
* @shortname sort json objects
* @drawable false
*/
sortByPropValue(inputs: Inputs.Lists.SortJsonDto<any>): any[];
}