コード例 #1
0
ファイル: SerialOutPoint.cs プロジェクト: Zelenov/ColorGraph
        //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);
        }
コード例 #2
0
ファイル: InPoint.cs プロジェクト: Zelenov/ColorGraph
        /// <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();
        }
コード例 #3
0
 protected virtual void Clear()
 {
     Signal       = null;
     CurrentColor = null;
     Flowed       = false;
     Signalled    = false;
 }
コード例 #4
0
 protected override void NotifyBack(IColorable @from, SerialSignal signal)
 {
     if (SignalIfCan())
     {
         Signal = signal;
         base.NotifyBack(from, signal);
         InvokeOnNotifyBack();
         From.NotifyBack(this, signal);
     }
 }
コード例 #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));
 }
コード例 #6
0
ファイル: GraphNode.cs プロジェクト: Zelenov/ColorGraph
        //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);
        }
コード例 #7
0
ファイル: OutPoint.cs プロジェクト: Zelenov/ColorGraph
        /* 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);
        }
コード例 #8
0
 protected abstract void NotifyBack(IColorable from, SerialSignal signal);
コード例 #9
0
        public override object Clone()
        {
            SerialSignal clone = new SerialSignal();

            return(clone);
        }