UsedPrintNumberIdentifiable

protocol UsedPrintNumberIdentifiable

A protocol that groups methods involved in the compilation of lists of the print numbers being used as arguments to Clarity print statements in a client application.

Default versions of the methods are implemented in a protocol extension.

  • A helper method that takes an array of EntityLogs and returns an array containing the keys for each EntityLog Message dictionary instance.

    It is used as a convenience to list print numbers used by client application JSON files and to detect duplicate print numbers across EntityLog instances.

    The individual keys in the returned array represent the print number used to key each Message referenced in the client application.

    Note

    Note The keys compiled from each EntityLog have been previously uniqued by virtue of being stored in the EntityLog messages dictionary property. Appending the keys arrays for all EntityLogs allows the returned array to contain any duplicates that might exist across files.

    Declaration

    Swift

    static func allEntityLogMessagesKeys(for entityLogs: [EntityLog]) -> [Int]

    Parameters

    entityLogs

    An array of EntityLog instances.

    Return Value

    An array of integers representing all the print numbers used by a client application JSON files including duplicates across files but not including duplicates within files.

  • A method that takes an array of EntityLogs and returns a dictionary of all print numbers used by a client application JSON files keyed by EntityLog EntityCode.

    The method sorts the keys for each EntityLog Message dictionary instance in ascending order into a uniqued set and then assigns it to a dictionary keyed by EntityCode as an array of integers.

    The dictionary is sorted ascending alphabetically by (EntityCode) key into an array of key, value tuples that are printed to the console (according to user preferences).

    The array of tuples is then reassembled into a dictionary for the return value.

    Note

    Note The method only prints an alert if specified to do so in the user settings file. Therefore there is no requirement for a convenience parameter to suppress the alert for unit tests (unlike those contained in the obligatory duplicate print number alert methods).

    The method is prefixed with the word ‘print’ in keeping with all alert methods in the framework code. The related user settings JSON key is prefixed with the word ‘list’ to distinguish its advisory purpose from other settings that control functionality.

    Declaration

    Swift

    @discardableResult
    static func printAllUsedPrintNumbersByEntityCode(for entityLogs: [EntityLog]) -> [String : [Int]]

    Parameters

    entityLogs

    An array of EntityLog instances.

    Return Value

    A dictionary of print numbers keyed by EntityLog EntityCode.

  • A method that takes an array of EntityLogs and returns an array of all print numbers used by a client application JSON files.

    The method sorts the keys for each EntityLog Message dictionary instance in ascending order into a uniqued set and prints them to the console (according to user preferences).

    Note

    Note The method only prints an alert if specified to do so in the user settings file. Therefore there is no requirement for a convenience parameter to suppress the alert for unit tests (unlike those contained in the obligatory duplicate print number alert methods).

    The method is prefixed with the word ‘print’ in keeping with all alert methods in the framework code. The related user settings JSON key is prefixed with the word ‘list’ to distinguish its advisory purpose from other settings that control functionality.

    Declaration

    Swift

    @discardableResult
    static func printAllUsedPrintNumbers(for entityLogs: [EntityLog]) -> [Int]

    Parameters

    entityLogs

    An array of EntityLog instances.

    Return Value

    An array of all print numbers used by a client application JSON files sorted in ascending order.

  • A method that takes an array of EntityLogs and returns an Int representing the highest print number used by a client application JSON files.

    The method sorts the keys for each EntityLog Message dictionary instance in ascending order into a uniqued set and gets the maximum value.

    It then prints the value to the console (according to user preferences).

    Note

    Note The method only prints an alert if specified to do so in the user settings file. Therefore there is no requirement for a convenience parameter to suppress the alert for unit tests (unlike those contained in the obligatory duplicate print number alert methods).

    The method is prefixed with the word ‘print’ in keeping with all alert methods in the framework code. The related user settings JSON key is prefixed with the word ‘list’ to distinguish its advisory purpose from other settings that control functionality.

    Declaration

    Swift

    @discardableResult
    static func printHighestUsedPrintNumber(for entityLogs: [EntityLog]) -> Int

    Parameters

    entityLogs

    An array of EntityLog instances.

    Return Value

    An Int representing the highest print number used by a client application JSON files.