Class: Ariblib::EventInformationTable::SelfWeeklyMultiSchedule

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

Instance Method Summary collapse

Constructor Details

#initializeSelfWeeklyMultiSchedule

Returns a new instance of SelfWeeklyMultiSchedule.



61
62
63
# File 'lib/ariblib/EventInformationTable.rb', line 61

def initialize
	refresh
end

Instance Method Details

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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/ariblib/EventInformationTable.rb', line 75

def check(uid,tid,last_tid,seg_last,list)
		#if tid < 0x4800 #違法
		if tid ==0x4e00 && list.size >0#自ストリーム現在地
			seg=@table[uid][0]
			#過去セグメントを埋める。
			hour=list[0][1].hour
			#p 'uid=%08x tid=%04x,last=%02x,hour=%02x' % [uid,tid,seg_last,hour]
			(hour/3).floor.times{|v|seg[v]=0xff}
		#elsif tid <0x4900 #自ストリームnext
		#elsif tid ==0x4900 #他ストリーム現在地
		elsif tid < 0x5000 #他ストリームnext
		elsif tid < 0x5200 #自ストリームtable 0x1ff -> 3f
			ind=(tid-0x5000)>>3
			seg=@table[uid][0]
			tmp =seg[ind]
			if tmp !=0xff
				tmp4=((tid&0x00ff)==seg_last)?0xff : 1
				tmp5=tmp | ((tmp4<<(tid&0x0007))&0xff)
				seg[ind]=tmp5
				if tmp5==0xff
					t=seg[0,512/8].inject{|x,y|x&y}
					@table[uid][1]=true if t==0xff
				end
			end
		#elsif tid <0x6000 #自ストリーム詳細
		#elsif tid <0x7000 #他ストリームtable
		else #違法
		end
end

#finishObject



70
71
72
73
# File 'lib/ariblib/EventInformationTable.rb', line 70

def finish
	return false if table.size==0
	@table.values.inject(true){|ret,v|ret && v[1]}
end

#refreshObject

8*8*8=512=64byte=16word 512/8=64 64/8=8



67
68
69
# File 'lib/ariblib/EventInformationTable.rb', line 67

def refresh
	@table=Hash.new(){|k,v|k[v]=[Array.new(512/8,0),false]}
end