getClonedEmptyTree
Short summary
prepares a new empty tree object with the same internal state as THIS^
- Return type: CNM_ReturnTypes.CloneResult
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| deepCloned | BOOL | indicates if tree should be cloned or deepcloned | input |
| newBalancedBinarySearchTree | POINTER TO BalancedBinarySearchTree | - | output |
Code
Declaration
METHOD PROTECTED getClonedEmptyTree :CNM_ReturnTypes.CloneResult;
VAR_INPUT
(*indicates if tree should be cloned or deepcloned*)
deepCloned :BOOL;
END_VAR
VAR_OUTPUT
newBalancedBinarySearchTree :POINTER TO BalancedBinarySearchTree;
END_VAR
VAR
comparator : CNM_AbstractObject.IComparator;
END_VAR
VAR CONSTANT
OBJECT_NOT_REFERENCED :__XWORD := 0;
END_VAR
Implementation
getClonedEmptyTree := CNM_ReturnTypes.CloneResult.SUCCESS;
IF THIS^.isObjectValid(THIS^.nodeComparator) THEN
getClonedEmptyTree := getClonedComparator(deepCloned := deepCloned, newComparator => comparator);
END_IF;
IF getClonedEmptyTree = CNM_ReturnTypes.CloneResult.SUCCESS THEN
newBalancedBinarySearchTree := __NEW(
BalancedBinarySearchTree(nodeComparator := comparator)
);
getClonedEmptyTree := CNM_AbstractObject.CNM_ReturnTypes.CloneResult.SUCCESS;
END_IF