Exemple #1
0
        //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);
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
 protected virtual void Clear()
 {
     Signal       = null;
     CurrentColor = null;
     Flowed       = false;
     Signalled    = false;
 }
Exemple #4
0
 protected override void NotifyBack(IColorable @from, SerialSignal signal)
 {
     if (SignalIfCan())
     {
         Signal = signal;
         base.NotifyBack(from, signal);
         InvokeOnNotifyBack();
         From.NotifyBack(this, signal);
     }
 }
Exemple #5
0
 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));
 }
Exemple #6
0
        //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);
        }
Exemple #7
0
        /* 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);
        }
Exemple #8
0
 protected abstract void NotifyBack(IColorable from, SerialSignal signal);
Exemple #9
0
        public override object Clone()
        {
            SerialSignal clone = new SerialSignal();

            return(clone);
        }