AddCell() публичный Метод

public AddCell ( Cell cell ) : void
cell Cell
Результат void
Пример #1
0
        public override GrammarModel ApplyOverrides(GrammarModel grammar)
        {
            var sentence = new Sentence {key = key};

            var over = grammar as Sentence;
            if (over == null)
            {
                sentence.format = format;
                sentence.cells = cells.Select(c => c.ApplyOverrides(null)).ToArray();
                return sentence;
            }

            sentence.format = over.format.IsNotEmpty() ? over.format : format;
            sentence.cells = cells?.Select(c =>
            {
                var match = sentence.cells.FirstOrDefault(x => x.Key == c.Key);
                return c.ApplyOverrides(match);
            }).ToArray();

            var keys = sentence.cells.Select(x => x.Key).ToList();
            var missing = over.cells.Where(x => !keys.Contains(x.Key));
            missing.Each(c =>
            {
                sentence.AddCell(c.ApplyOverrides(null));
            });

            return sentence;
        }
Пример #2
0
        public override GrammarModel ApplyOverrides(GrammarModel grammar)
        {
            var sentence = new Sentence();

            sentence.key = key;

            var over = grammar as Sentence;

            if (over == null)
            {
                sentence.format = format;
                sentence.cells  = cells.Select(c => c.ApplyOverrides(null)).ToArray();
                return(sentence);
            }

            sentence.format = over.format.IsNotEmpty() ? over.format : format;
            sentence.cells  = cells?.Select(c =>
            {
                var match = sentence.cells.FirstOrDefault(x => x.Key == c.Key);
                return(c.ApplyOverrides(match));
            }).ToArray();

            var keys    = sentence.cells.Select(x => x.Key).ToList();
            var missing = over.cells.Where(x => !keys.Contains(x.Key));

            missing.Each(c =>
            {
                sentence.AddCell(c.ApplyOverrides(null));
            });

            return(sentence);
        }