EntityLog

struct EntityLog : Codable, Equatable

A struct that is used to model EntityLog JSON data.

The struct models data from an instance of EntityLogService injected into its initialiser by the MessageCollator initialiser. EntityLogService is modelled directly from the JSON data. EntityLog reorganises this data into a dictionary of messages keyed by print number. It embeds a nested Message struct that contains a flattened representation of all data associated with a print number.

The initialiser also identifies any duplicate print numbers that exist in the EntityLog data and stores them in a static dictionary property on MessageCollator.

  • A dictionary of Message instances keyed by print number.

    This dictionary is merged into a dictionary of messages for all EntityLogs by the MessageCollator initialiser.

    Declaration

    Swift

    var messages: [Int : EntityLog.Message]
  • An array of Ints representing the print numbers contained in the EntityLog.

    The sole purpose of the array is for the identification of any duplicate print numbers.

    Note

    The array is not used for assigning keys or values to the messages dictionary.

    Declaration

    Swift

    var printNumbers: [Int]
  • A string representing the entity code of the EntityLog.

    It is referenced by UsedPrintNumberIdentifiable to list all used print numbers in each EntityLog and by MessageCollator to set the maximum entity code character count of the entity codes used in all EntityLogs.

    Note

    The property is not used to assign the entityCode property in each Message instance and exists as a convenience for referencing instances.

    Declaration

    Swift

    var entityCode: String
  • A struct embedded inside an EntityLog struct that is used as a flattened representation of all data associated with each individual print number contained in an EntityLog.

    See more

    Declaration

    Swift

    struct Message : Codable, Equatable
  • An initialiser for EntityLog that takes an instance of EntityLogService and uses it to create a dictionary of Message structs that contain a flattened representation of all data associated with each print number.

    The initialiser also identifies any duplicate print numbers that exist in the EntityLog data and stores them in a static dictionary property on MessageCollator.

    Declaration

    Swift

    init(from service: EntityLogService)