Skip to main content

AbstractCollection

Short summary

An abstract class to implement the basic datastructure independend collection functionality for use in other Collections.

AccessAbstractFinalExtendsImplements
YesNoAbstractDisposableContainerCNM_CollectionInterfaces.ICollection

UML Diagram

Parameters

none

Properties

forEach

Type: CNM_CollectionInterfaces.IForEachStrategy

This property returns strategies to loop through the collection and apply actions to all objects contained.

hasElement

Type: BOOL

This property returns TRUE if the collection has any element.

isEmpty

Type: BOOL

This property returns TRUE if the collection is empty.

size

Type: UDINT

This property returns the number of elements inside this collection.

Methods

compareTo

This method compares a foreign object with the own one, this is needed for sort orders.

containsEqualObject

This method checks if a given object is contained in the collection.

containsObject

This method checks if a given object is contained in the collection.

Abstract methods

clear

  • Return type: VOID

This method clears/deletes all clearable data from this object.

createNewIterator

This method returns a NEW Iterator instance which can iterate the collection.

iterate

This method returns the next object in the iteration and returns an execution state.

Code

Declaration

FUNCTION_BLOCK ABSTRACT AbstractCollection EXTENDS AbstractDisposableContainer IMPLEMENTS CNM_CollectionInterfaces.ICollection
VAR
(*the amount of objects in the collection*)
collectionSize :UDINT;
(*counter that increases on every collection change*)
changesToCollection :__XWORD;
END_VAR
VAR_STAT
collectionFactory :CollectionFactory();
END_VAR