public XCellAND CreateAnXCellANDGivenItsIDInTemporalList(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            var xCellAND = new XCellAND(id, this);

            xCellAND.AssignLevel();
            ListOfXCellsAND.Add(xCellAND);
            if (xCellAND.ListOfOutputChannels.Count() == 0)
            {
                xCellAND.ListOfOutputChannels.Add(new Channel {
                    XCellOrigin = xCellAND
                });
            }
            //LayerUp.ListOfInputChannels.Add(xCellAND.ListOfOutputChannels[0]);

            TemporalListOfXCellsANDGroupedByLevels.TryGetValue(xCellAND.Li, out var listOfXCellsANDGroupedByLevels);
            if (listOfXCellsANDGroupedByLevels == null)
            {
                var listXCellAND = new List <XCellAND>();
                listXCellAND.Add(xCellAND);
                TemporalListOfXCellsANDGroupedByLevels.Add(xCellAND.Li, listXCellAND);
            }
            else
            {
                listOfXCellsANDGroupedByLevels?.Add(xCellAND);
            }
            return(xCellAND);
        }
        public XCellAND CreateAnXCellANDGivenItsID(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            var xCellAND = new XCellAND(id, this);

            xCellAND.AssignLevel();
            ListOfXCellsAND.Add(xCellAND);
            if (xCellAND.ListOfOutputChannels.Count() == 0)
            {
                xCellAND.ListOfOutputChannels.Add(new Channel {
                    XCellOrigin = xCellAND
                });
            }
            LayerUp.ListOfInputChannels.Add(xCellAND.ListOfOutputChannels[0]);
            return(xCellAND);
        }
        /// <summary>
        /// Se leen los datos de entrada y se construye la estructura necesaria para poder realizar posteriormente SendOutputDataSync
        /// </summary>
        public override void GetInputDataSync() //Diastole
        {
            //CreateAnXCellANDGivenItsIDInTemporalList(CreateIdOfAllActiveInputs());

            var oldLi = double.NaN;

            foreach (var xCellAND in ListOfXCellsAND.OrderBy(xCellAnd => xCellAnd.Li).ToList())
            {
                if (xCellAND.Li != oldLi && oldLi != double.NaN)
                {
                    if (TemporalListOfXCellsANDGroupedByLevels.TryGetValue(oldLi, out var ListXCellAndWithLi))
                    {
                        if (ListXCellAndWithLi != null)
                        {
                            foreach (var xCellAnd in ListXCellAndWithLi)
                            {
                                xCellAnd.GetInputData();
                            }
                        }
                    }
                    //TODO:
                    //Cuando se termina de procesar las entradas para un nivel,
                    //se pasa a generar sus salidas para poder seguir procesando las entradas del siguiente nivel
                }

                oldLi = xCellAND.Li;
                xCellAND.GetInputData();
            }

            foreach (var levelListXCell in TemporalListOfXCellsANDGroupedByLevels)
            {
                foreach (var xCell in levelListXCell.Value)
                {
                    ListOfXCellsAND.Add(xCell);
                }
            }
            TemporalListOfXCellsANDGroupedByLevels.Clear();
        }
 public override ICollection <XCell> GetListOfXCells()
 {
     return(ListOfXCellsAND.Cast <XCell>().ToList());
 }
 public void CreateAnXCellANDGivenItsID(string id)
 {
     ListOfXCellsAND.Add(new XCellAND(id, this));
 }