containsEqualObject
Short summary
This method checks if a given object is contained in the collection. The object is inside if the collection contains an object where the compareTo returns EQUAL.
Return: FALSE: collection does not contain an equal object
TRUE: collection does contain an equal object
- Return type:
BOOL
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| object | CNM_AbstractObject.IObject | the object to be checked if it exists inside the collection | input |
Code
Declaration
METHOD containsEqualObject :BOOL
VAR_INPUT
(*the object to be checked if it exists inside the collection*)
object :CNM_AbstractObject.IObject;
END_VAR
VAR
currentObj :CNM_AbstractObject.IObject;
END_VAR
Implementation
containsEqualObject := FALSE;
RETURN(NOT THIS^.isObjectValid(object));
THIS^.iterate(execute := FALSE);
WHILE (THIS^.iterate(execute := TRUE, object => currentObj) = CNM_ReturnTypes.SingleExecutionState.BUSY) DO
IF (object.compareTo(currentObj) = CNM_ReturnTypes.ComparationResult.EQUAL) THEN
containsEqualObject := TRUE;
RETURN;
END_IF
END_WHILE