AbstractIterator
Short summary
An abstract class to implement most basic iterator functions for use in custom Iterators.
Users still need to implement iterate and hasNext, as these depend on the data-stucture.
Iterate should take care to assign THIS^.current in their iterate implementation.
| Access | Abstract | Final | Extends | Implements |
|---|---|---|---|---|
| Yes | No | CNM_AbstractObject.Object | CNM_CollectionInterfaces.IIterator |
UML Diagram
Parameters
none
Properties
current
Type: CNM_AbstractObject.IObject
This property returns the current element which the iterator points to.…
Methods
getNext
- Return type: CNM_AbstractObject.IObject
This method returns the next object from the iterator and move the iterator to it.…
moveNext
- Return type:
BOOL
This method returns true if there exists another element to iterate to and fetches the next element to THIS^.current.…
reset
- Return type:
VOID
This method resets the iterator.…
Abstract methods
hasNext
- Return type:
BOOL
This method returns if there exists another element to iterate to.…
iterate
- Parameters:
execute(BOOL): control bit to start or abort the iterate (see SingleExecutionState)
- Return type: CNM_ReturnTypes.SingleExecutionState
This method delivers the next object from the collection and returns the current state of iteration.…
Code
Declaration
FUNCTION_BLOCK ABSTRACT AbstractIterator EXTENDS CNM_AbstractObject.Object IMPLEMENTS CNM_CollectionInterfaces.IIterator
VAR
{attribute 'no_copy'}
currentObject :CNM_AbstractObject.IObject;
END_VAR