Skip to main content

AbstractListSorter

Short summary

Abstract base class for list sorters. Provides functionality to set the execution limits, size and list changes.

AccessAbstractFinalExtendsImplements
INTERNALYesNoAbstractDisposableContainerCNM_CollectionInterfaces.IListSorter

UML Diagram

Parameters

none

Properties

className

Type: CNM_AbstractObject.ClassName

This abstract property returns the class name of the concrete object,

maxCycleCompares

Type: UDINT

This property defines the maximum amount of compares that should be done per Cycle. Is optional as default should be set by class.

Methods

clearContents

  • Return type: VOID

This method is called in the destruct method and is intended to zero all references and interfaces that should not be destructed.

compareElements

Compares two objects, if set uses the comparator, else uses the built in comparator of object1.

deepClone

This method is used to create a new instance

FB_Exit

  • Parameters:
    • bInCopyCode (BOOL): TRUE: the exit method is called in order to leave the instance which will be copied afterwards (online change).
  • Return type: BOOL

Mark the object as deleted, as it staiys in the memory.

prepareClonedSorter

Does the basic initialization for a new sorter that was cloned from THIS^

setComparator

This method can replace the default comperator for custom one.

Abstract methods

clone

This method is used to create a new instance

Code

Declaration

FUNCTION_BLOCK INTERNAL ABSTRACT AbstractListSorter EXTENDS AbstractDisposableContainer IMPLEMENTS CNM_CollectionInterfaces.IListSorter
VAR
(*The comparator used to sort, set by the List when setting sorter*)
elementComparator :CNM_AbstractObject.IComparator;
(*The maximum of comparisons that the sorter allows, may be overwruled by the bounds*)
maxOperationsPerCycle :UDINT;
(*The maximum of compares done per cycle to prevent very long lists to take up to much time*)
upperCompareBound :UDINT := GeneralParameters.DEFAULT_OPERATIONS_PER_CYCLE;
(* Comparator used for inverse Sort *)
reverseComparator :InvertComparator;
(* the current change index of the list *)
listChangeIndex :REFERENCE TO __XWORD;
END_VAR