LinkedListMergeSorter
Short summary
Implementation of an Inplace Mergesorter for the LinkedList
| Access | Abstract | Final | Extends | Implements |
|---|---|---|---|---|
| - | No | No | AbstractLinkedListSorter | - |
UML Diagram
Properties
className
Type: CNM_AbstractObject.ClassName
This abstract property returns the class name of the concrete object, …
Methods
clone
- Return type: CNM_AbstractObject.CNM_ReturnTypes.CloneResult
This method is used to create a new instance…
instantSort
- Parameters:
size(UDINT): The size of the list to be sortedcomparator(CNM_CollectionInterfaces.CNM_AbstractObject.IComparator): Optional: the comparator that should be used for the sort. Must not be changed while sort is in processhead(CNM_CollectionInterfaces.IDoublyLinkedElement): The first element in the list, must be set on every call to current head of list.last(CNM_CollectionInterfaces.IDoublyLinkedElement): The last element of the list after sorting, may be useful for doublelinked structurescurrentListVersion(__XWORD): the current version of the list, must change when the data in the list changes
- Return type: CNM_CollectionInterfaces.CNM_ReturnTypes.SingleExecutionResult
This method sorts the data structure instantly within one call. …
merge
- Parameters:
mergeSizeLeft(__XWORD): how many elements are in the left sectionmergeSizeRight(__XWORD): how many elements are in the right sectionmergeHead(CNM_CollectionInterfaces.IDoublyLinkedElement): The updated head of the list that is beeing mergedmergeLast(CNM_CollectionInterfaces.IDoublyLinkedElement): The updated last of the list that is beeing mergedleftElement(CNM_CollectionInterfaces.IDoublyLinkedElement): the first element of the left sectionrightElement(CNM_CollectionInterfaces.IDoublyLinkedElement): the first element of the right sectioncomparesThisCycle(__XWORD): The amount of already performed compares this cycle
- Return type:
VOID
Does an inplace ordered Merge of two list sections, that are defined by their first object and the length of the section.…
moveRemainingElements
- Parameters:
remainingElements(__XWORD)lastRemainder(CNM_CollectionInterfaces.IDoublyLinkedElement)elementToMerge(CNM_CollectionInterfaces.IDoublyLinkedElement)mergeHead(CNM_CollectionInterfaces.IDoublyLinkedElement)mergeLast(CNM_CollectionInterfaces.IDoublyLinkedElement)operationsCount(__XWORD)
- Return type:
BOOL
sort
- Parameters:
execute(BOOL): control bit to start or abort the sorting, needs to be active until the ExecutionState is SUCCESSsize(UDINT): The size of the list to be sortedcomparator(CNM_AbstractObject.IComparator): the comparator that should be used for the sort. Must not be changed while sort is in processhead(CNM_CollectionInterfaces.IDoublyLinkedElement): The first element in the list, must be set on every call to current head of list.last(CNM_CollectionInterfaces.IDoublyLinkedElement): The last element of the list after sorting, may be useful for doublelinked structurescurrentListVersion(__XWORD): the current version of the list, must change when the data in the list changes
- Return type: CNM_ReturnTypes.SingleExecutionState
This method sorts the data structure. …
Code
Declaration
{attribute 'enable_dynamic_creation'}
FUNCTION_BLOCK LinkedListMergeSorter EXTENDS AbstractLinkedListSorter