Class: When::TM::Duration::Enumerator

Inherits:
Parts::Enumerator show all
Defined in:
lib/when_exe/tmobjects.rb

Overview

Duration 用の Enumerator

Instance Attribute Summary

Attributes inherited from Parts::Enumerator

#count, #count_limit, #current, #direction, #exdate, #first, #index, #last, #object, #options, #parent, #processed

Instance Method Summary collapse

Methods inherited from Parts::Enumerator

_options, #_rewind, #each, #has_next?, #initialize, #next, #with_index, #with_object

Constructor Details

This class inherits a constructor from When::Parts::Enumerator

Instance Method Details

#succWhen::TM::TemporalPosition

次の時間位置を取得する

Returns:



568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/when_exe/tmobjects.rb', line 568

def succ
  value    = @current
  @current = (@count_limit.kind_of?(Numeric) && @count >= @count_limit) ? nil :
             (@current==:first) ? @first :
             (@direction==:reverse) ? @first - @parent * @count : @first + @parent * @count
  if @last
    sign     = @parent.sign
    sign     = -sign if @direction==:reverse
    @current = nil if (sign * (@current <=> @last)) > 0
  end
  @count  += 1
  return value
end