code: def _CalculateDOWDelta(self, wd, wkdy, offset, style, currentDayStyle):
          
          diffBase = wkdy - wd
          origOffset = offset
  
          if offset == 2:
              # no modifier is present.
              # i.e. string to be parsed is just DOW
              if wkdy * style > wd * style or \
                      currentDayStyle and wkdy == wd:
                  # wkdy located in current week
                  offset = 0
              elif style in (-1, 1):
                  # wkdy located in last (-1) or next (1) week
                  offset = style
              else:
                  # invalid style, or should raise error?
                  offset = 0
  
          # offset = -1 means last week
          # offset = 0 means current week
          # offset = 1 means next week
          diff = diffBase + 7 * offset
          if style == 1 and diff < -7:
              diff += 7
          elif style == -1 and diff > 7:
              diff -= 7
  
          debug and log.debug("wd %s, wkdy %s, offset %d, "
                              "style %d, currentDayStyle %d",
                              wd, wkdy, origOffset, style, currentDayStyle)
  
          return diff
docs: Based on the C{style} and C{currentDayStyle} determine what
          day-of-week value is to be returned.
  
          @type  wd:              integer
          @param wd:              day-of-week value for the current day
          @type  wkdy:            integer
          @param wkdy:            day-of-week value for the parsed day
          @type  offset:          integer
          @param offset:          offset direction for any modifiers (-1, 0, 1)
          @type  style:           integer
          @param style:           normally the value
                                  set in C{Constants.DOWParseStyle}
          @type  currentDayStyle: integer
          @param currentDayStyle: normally the value
                                  set in C{Constants.CurrentDOWParseStyle}
  
          @rtype:  integer
          @return: calculated day-of-week