-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulation.go
More file actions
47 lines (38 loc) · 929 Bytes
/
simulation.go
File metadata and controls
47 lines (38 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package devsim
type EvtChan interface {
Evt() chan Event
}
type ObsChan interface {
Obs() chan Observations
}
type Observer interface{
Observe(chan Observations)
}
// We define an option type. It is a function that takes one argument, the Simulation we are operating on.
// Options are used to initialize simulation within a simulation
type Option func(Simulation)
// Simulation interface
type Simulation interface{
EvtChan
ObsChan
Observer
Run(chan int)
}
// Simulation implementation
//type BaseSimulation struct{
//evtChan chan Event
//obsChan chan Observations
//}
//func (s *BaseSimulation) Evt() chan Event {
//return s.evtChan
//}
//func (s *BaseSimulation) Obs() chan Observations {
//return s.obsChan
//}
// Observe whatch simulation obsChan to feed simulator writerChan
//func (s *DevsSimulation) Observe(writerChan chan Observations) {
//for {
//obs := <-s.Obs()
//writerChan <- obs
//}
//}