Skip to main content

AbstractBalancedBinarySearchTreeIterator

Short summary

This class provides the basic methods and functionalities for Balanced Binary Tree iterators.

AccessAbstractFinalExtendsImplements
YesNoAbstractIteratorIBBSTIterator

UML Diagram

Parameters

none

Properties

changes

Type: __XWORD

root

Type: CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode

Methods

attachTree

This method attaches an binary balances search tree to the iterator.

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.

FB_init

  • Parameters:
    • bInitRetains (BOOL): if TRUE, the retain variables are initialized (warm start / cold start)
    • bInCopyCode (BOOL): if TRUE, the instance afterwards gets moved into the copy code (online change)
    • tree (REFERENCE TO BalancedBinarySearchTree): The tree that should be iterated, can be 0
  • Return type: BOOL

The constructor FB_init is needed to create an unique hash code.

getStartNode

This method is called to retrive the first node of the iteration.

hasNext

  • Return type: BOOL

This method returns if there exists another element to iterate to.

iterate

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

processStartNode

This method is called in the initphase on the rootnode of the tree.

reset

  • Return type: VOID

This method resets the iterator.

Abstract methods

getNextTreeNode

  • Return type: BOOL

Gets the next Node that iterate should process.

processNode

This method is called when the node is taken from the nodelist.

Code

Declaration

FUNCTION_BLOCK ABSTRACT AbstractBalancedBinarySearchTreeIterator EXTENDS AbstractIterator IMPLEMENTS IBBSTIterator
VAR
{attribute 'hide'}
tree :REFERENCE TO BalancedBinarySearchTree;
nodeList :LinkedList();
currentNode :CNM_CollectionInterfaces.IBinaryTreeNode;
END_VAR