def add_sequence_fields( self, event, sequence_id, sequence_number ):
        """
        If sequence_id and sequence_number are non-None then this method will automatically add the following
        fields:

        'si' set to the value of sequence_id if it is different from the previously seen sequence_id
        'sn' set to the value of sequence_number if we haven't previously seen a sequence number
        'sd' set to the delta of the sequence_number and the previously seen sequence_number

        The 'sn' and 'sd' fields are mutually exclusive.  Only one or the other will be used

        @param event: The event to update
        @param sequence_id: The sequence id
        @param sequence_number: The sequence number

        @type event: Event
        @type sequence_id: long
        @type sequence_number: long
        """

        # only add sequence information if both the sequence fields are valid
        if sequence_id is not None and sequence_number is not None:

            # add the 'si' field if necessary
            if sequence_id != self.__previous_sequence_id:
                event.set_sequence_id(sequence_id)
                self.__previous_sequence_id = sequence_id
                # a new sequence id means we should also send the full sequence number
                # so make sure that __previous_sequence_number is None
                self.__previous_sequence_number = None

            # if we don't have a previous sequence number then send the full number
            # otherwise send the delta
            if self.__previous_sequence_number is None:
                event.set_sequence_number(sequence_number)
            else:
                event.set_sequence_number_delta(self.__previous_sequence_number - sequence_number)

            self.__previous_sequence_number = sequence_number
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/scalyr_client.py/EventSequencer.add_sequence_fields/swapped operands of `-`