//step back protected override void NotifyBack(IColorable from, SerialSignal signal) { if (!(from is OutPoint) && from != this) { // return; } lock (this) { if (Output.IsFiltered(from)) { return; } } //Signal == true; signal.StopSending(); Output.Filter(from); //if signal==true - we have to signal, otherwise we just need to find other output; if (from == CurrentPath) { FlowResult(); } if (!SignalIfCan()) { return; } Signal = signal; Output.Filter(from); base.NotifyBack(this, signal); InvokeOnNotifyBack(); Input.NotifyBack(this, signal); }
/// <summary> /// We finished or failed - send result to all preceding colorables. But current have to be last. /// </summary> /// <param name="from"></param> /// <param name="signal"></param> protected override void NotifyBack(IColorable from, SerialSignal signal) { if (!SignalIfCan()) { return; } Signal = signal; base.NotifyBack(from, signal); List <IColorable> currentColor = new List <IColorable>(); List <IColorable> otherColor = new List <IColorable>(); foreach (var connection in Connections.NotFiltered) { if (connection == null) { continue; } if (connection.GetCurrentColor() == CurrentColor) { currentColor.Add(connection); } else { otherColor.Add(connection); } } SplitNotify(otherColor, signal); SplitNotify(currentColor, signal); InvokeOnNotifyBack(); }
protected virtual void Clear() { Signal = null; CurrentColor = null; Flowed = false; Signalled = false; }
protected override void NotifyBack(IColorable @from, SerialSignal signal) { if (SignalIfCan()) { Signal = signal; base.NotifyBack(from, signal); InvokeOnNotifyBack(); From.NotifyBack(this, signal); } }
public SignalGroup Split(int count) { if (count < 1) { return(new SignalGroup()); } SerialSignal[] array = new SerialSignal[count]; for (int i = 0; i < count; i++) { array[i] = (SerialSignal)Clone(); } return(new SignalGroup(array)); }
//step back protected override void NotifyBack(IColorable from, SerialSignal signal) { if (from != Output && from != this) { return; } if (!SignalIfCan()) { return; } Signal = signal; base.NotifyBack(this, signal); InvokeOnNotifyBack(); SplitNotify(Input, signal); }
/* public override IEnumerable<KeyValuePair<GraphNode, int>> GetNextNodes() * { * * var connections = GetAllConnections(); * return connections.Select(connection => * { * if (connection == null || connection.To == null || connection.To.Parent == null) * return new KeyValuePair<GraphNode, int>(null,0); * return new KeyValuePair<GraphNode, int>(connection.To.Parent,connection.Length); * }).Where(graphNode => graphNode.Key != null); * * }*/ // private readonly List<IColorable> _zeroSignalConnections = new List<IColorable>(); protected override void NotifyBack(IColorable from, SerialSignal signal) { signal.StopSending(); Connections.Filter(from); }
protected abstract void NotifyBack(IColorable from, SerialSignal signal);
public override object Clone() { SerialSignal clone = new SerialSignal(); return(clone); }