Inhalte

Alarm Message Service: Collection Interfaces

Table of Contents

Introduction

As we are dealing with abstract factories here, the implementation is not yet important in the first step. We define the interfaces for the collections so that we can define the interfaces for factories. This will be the basis for a factory provider so that the software becomes independent of concrete implementations because that is what it is essentially about.

Interfaces

Interface IDoublyLinkedElement
INTERFACE IDoublyLinkedElement EXTENDS IObject
PROPERTY previous :IDoublyLinkedElement
GET
SET
PROPERTY object :IObject
GET
PROPERTY next :IDoublyLinkedElement
GET
SET

In this example, we use just the easy-to-understand insertion sort algorithm, but it has a poor 0(n²), so we should provide the possibility to inject an efficient sort algorithm. For example, the linked-list-merge-sort from here: https://ekv-app-git-p01.ekvip.de/CNMTC3/cnm-collections-lib.

Interface IListSorter
INTERFACE IListSorter EXTENDS IObject, ISortable
PROPERTY head :IDoublyLinkedElement
GET
SET
PROPERTY last :IDoublyLinkedElement
GET
SET
Interface IList
INTERFACE IList EXTENDS IObject, ISortable, IClearable, IIterable
METHOD append
VAR_INPUT
	object	:IObject;
END_VAR
METHOD prepend
VAR_INPUT
	object	:IObject;
END_VAR
METHOD isListContainsObject :BOOL
VAR_INPUT
	object	:IObject;
END_VAR
METHOD remove
VAR_INPUT
	object	:IObject;
END_VAR
METHOD setComperator :IList
VAR_INPUT
	comparator	:IComparator;
END_VAR
METHOD setSorter :IList
VAR_INPUT
	sorter	:IListSorter;
END_VAR
PROPERTY dequeue :IObject
GET
PROPERTY hasElement :BOOL
GET
PROPERTY isEmpty :BOOL
GET
PROPERTY pop :IObject
GET
PROPERTY size :__XWORD
GET
Interface IAlarmMessageQueue
INTERFACE IAlarmMessageQueue EXTENDS IObject
METHOD append
VAR_INPUT
	alarmMessage		:IAlarmMessageDto;
END_VAR
PROPERTY dequeue :IAlarmMessageDto
GET
PROPERTY hasElement :BOOL
GET
PROPERTY isEmpty :BOOL
GET
METHOD prepend
VAR_INPUT
	alarmMessage :IAlarmMessageDto;
END_VAR
METHOD remove
VAR_INPUT
	alarmMessage :IAlarmMessageDto;
END_VAR
PROPERTY size :__XWORD
GET
Interface IAlarmMessageServiceSubscriberList
INTERFACE IAlarmMessageServiceSubscriberList EXTENDS IObject, ISortable, IClearable, IIterable

METHOD append
VAR_INPUT
	subscriber :IAlarmMessageService;
END_VAR
PROPERTY hasMessageService :BOOL
GET
PROPERTY isEmpty :BOOL
GET
METHOD iterateSubscriber :ExecutionState
VAR_INPUT
	execute	:BOOL;
END_VAR
VAR_OUTPUT
	subscriber		:IAlarmMessageService;
END_VAR
METHOD prepend
VAR_INPUT
	subscriber	:IAlarmMessageService;
END_VAR
METHOD remove
VAR_INPUT
	subscriber	:IAlarmMessageService;
END_VAR
METHOD setComperator :IAlarmMessageServiceSubscriberList
VAR_INPUT
	comparator	:IComparator;
END_VAR
METHOD setSorter :IAlarmMessageServiceSubscriberList
VAR_INPUT
	sorter	:IListSorter;
END_VAR
PROPERTY size :__XWORD
GET