Added NewBaseSignal

graph-rework
noah metz 2023-06-19 15:03:17 -06:00
parent 416c47f147
commit db4cec8f13
1 changed files with 7 additions and 15 deletions

@ -118,34 +118,26 @@ type TimeSignal struct {
time time.Time time time.Time
} }
func NewDownSignal(source GraphNode, _type string) (BaseSignal) { func NewBaseSignal(source GraphNode, _type string, downwards bool) BaseSignal {
source_id := "" source_id := ""
if source != nil { if source != nil {
source_id = source.ID() source_id = source.ID()
} }
signal := BaseSignal{ signal := BaseSignal{
downwards: true, downwards: downwards,
source: source_id, source: source_id,
_type: _type, _type: _type,
} }
return signal return signal
} }
func NewSignal(source GraphNode, _type string) (BaseSignal) { func NewDownSignal(source GraphNode, _type string) BaseSignal {
source_id := "" return NewBaseSignal(source, _type, true)
if source != nil { }
source_id = source.ID()
}
signal := BaseSignal{
downwards: false,
source: source_id,
_type: _type,
}
return signal func NewSignal(source GraphNode, _type string) BaseSignal {
return NewBaseSignal(source, _type, false)
} }
// GraphNode is the interface common to both DAG nodes and Event tree nodes // GraphNode is the interface common to both DAG nodes and Event tree nodes