From db4cec8f13263f596f6847a6b4c7c332edb1d9ea Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 19 Jun 2023 15:03:17 -0600 Subject: [PATCH] Added NewBaseSignal --- graph.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/graph.go b/graph.go index 80b6615..3649320 100644 --- a/graph.go +++ b/graph.go @@ -118,34 +118,26 @@ type TimeSignal struct { time time.Time } -func NewDownSignal(source GraphNode, _type string) (BaseSignal) { +func NewBaseSignal(source GraphNode, _type string, downwards bool) BaseSignal { source_id := "" if source != nil { source_id = source.ID() } signal := BaseSignal{ - downwards: true, + downwards: downwards, source: source_id, _type: _type, } - return signal } -func NewSignal(source GraphNode, _type string) (BaseSignal) { - source_id := "" - if source != nil { - source_id = source.ID() - } - - signal := BaseSignal{ - downwards: false, - source: source_id, - _type: _type, - } +func NewDownSignal(source GraphNode, _type string) BaseSignal { + return NewBaseSignal(source, _type, true) +} - 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