本文整理匯總了Golang中doozer/vector.Vector.At方法的典型用法代碼示例。如果您正苦於以下問題:Golang Vector.At方法的具體用法?Golang Vector.At怎麽用?Golang Vector.At使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類doozer/vector.Vector
的用法示例。
在下文中一共展示了Vector.At方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestSchedTrigger
func TestSchedTrigger(t *testing.T) {
q := new(vector.Vector)
d := int64(15e8)
t0 := time.Nanoseconds()
ts := t0 + d
schedTrigger(q, 1, t0, d)
assert.Equal(t, 1, q.Len())
f, ok := q.At(0).(trigger)
assert.Tf(t, ok, "expected a trigger, got a %T", q.At(0))
assert.Equal(t, int64(1), f.n)
assert.T(t, f.t == ts)
}
示例2: applyTriggers
func applyTriggers(packets, ticks *vector.Vector, now int64, tpl *msg) (n int) {
for ticks.Len() > 0 {
tt := ticks.At(0).(trigger)
if tt.t > now {
break
}
heap.Pop(ticks)
p := new(packet)
p.msg = *tpl
p.msg.Seqn = &tt.n
log.Println("applying", *p.Seqn, msg_Cmd_name[int32(*p.Cmd)])
heap.Push(packets, p)
n++
}
return
}