Esempio n. 1
0
func (m *Mkt) extractFromMsg(mg *sim.Message, qty float64) *sim.Message {
	extracted := mg.Clone()
	extracted.Trans.Resource().SetQty(qty)

	remainder := mg.Trans.Resource().Qty() - qty
	mg.Trans.Resource().SetQty(remainder)

	return extracted
}
Esempio n. 2
0
func (f *Fac) Receive(m *sim.Message) {
	if m.Sender() == f {
		f.queuedOrders = append(f.queuedOrders, m)
	}
}