Class: Ariblib::EventInformationTable::SelfWeeklyMultiEventSchedule

Inherits:
Object
  • Object
show all
Defined in:
lib/ariblib/EventInformationTable.rb

Instance Method Summary collapse

Constructor Details

#initializeSelfWeeklyMultiEventSchedule

Returns a new instance of SelfWeeklyMultiEventSchedule.



11
12
13
# File 'lib/ariblib/EventInformationTable.rb', line 11

def initialize
  refresh
end

Instance Method Details

#binary_insert(a, e) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ariblib/EventInformationTable.rb', line 29

def binary_insert(a,e)
  if a.size > 0
    index = [*a.each_with_index].bsearch{|x, _| x[1] > e[1]}.last
    a.insert(index, e) if a[index][1]!=e[1]
    while a[@cur][2]==a[@cur+1][1]
      @cur+=1
    end
  else
    a.insert(0, e)
    @cur=0
  end
end

#check(uid, tid, last_tid, seg_last, list) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ariblib/EventInformationTable.rb', line 41

def check(uid,tid,last_tid,seg_last,list)
  if tid ==0x4e00 && list.size >0#自ストリーム現在地
    unless @cur
      tmp=list[0][1]
      @cur=0 if @table.bsearch{|v|v[1]>=tmp}
    end
  elsif tid < 0x5000 #他ストリームnext
  elsif tid < 0x5200 #自ストリームtable 0x1ff -> 3f
    @end=list.last if @end==nil and tid==last_tid #and list.size >0
    tmp=@table && @start[2]
    list.each do |v|
      next unless v[3][:title]
      @table << v
    end
  end
end

#finishObject



20
21
# File 'lib/ariblib/EventInformationTable.rb', line 20

def finish
end

#incObject



22
23
24
25
26
27
28
# File 'lib/ariblib/EventInformationTable.rb', line 22

def inc
  while @cur < @table.size
    cur =@table[@cur  ][2]
    nxt =@table[@cur+1][1]
    @cur+=1 if cur==nxt
  end
end

#refreshObject



14
15
16
17
18
19
# File 'lib/ariblib/EventInformationTable.rb', line 14

def refresh
  @table=[]
  @start=nil
  @end=nil
  @cur=nil
end