Exemplo n.º 1
0
        private readonly MultiDictionary<ISentenceForm, Fact> _sentencesByForm; //TODO: Immutable

        #endregion Fields

        #region Constructors

        private ImmutableConstantChecker(ImmutableSentenceFormModel sentenceModel, MultiDictionary<ISentenceForm, Fact> sentencesByForm)
        {
            Debug.Assert(sentenceModel.ConstantSentenceForms.IsSupersetOf(sentencesByForm.Keys));
            _sentenceModel = sentenceModel;
            _sentencesByForm = sentencesByForm;
            _allSentences = sentencesByForm.SelectMany(s => s.Value).ToImmutableHashSet();
        }
            public void AddAndClearAllPendingWrites(ArrayBuilder <Action <SqlConnection> > result)
            {
                // Copy the pending work we have to the result copy.
                result.AddRange(_writeQueueKeyToWrites.SelectMany(kvp => kvp.Value));

                // Clear out the collection so we don't process things multiple times.
                _writeQueueKeyToWrites.Clear();
            }
Exemplo n.º 3
0
        private HashSet <string> CheckSourceForDuplicates()
        {
            Dictionary <string, List <string> > duplicatesByTarget = _filesByDestination
                                                                     .SelectMany(destination => destination.Value)
                                                                     .GroupBy(copyFile => copyFile.Target)
                                                                     .Where(group => group.Count() > 1)
                                                                     .ToDictionary(group => group.Key, group => group.Select(copyFile => copyFile.File).ToList());

            var ignoreFiles = new HashSet <string>();

            foreach (var group in duplicatesByTarget)
            {
                var newestInGroup = new FileInfo(group.Value.First());
                foreach (var otherFile in group.Value.Skip(1).Select(path => new FileInfo(path)))
                {
                    if (newestInGroup.Length != otherFile.Length)
                    {
                        _logger.Error("Conflicting source files with different file size: '{0}' and '{1}'.", newestInGroup.FullName, otherFile.FullName);
                    }
                    else if (newestInGroup.LastWriteTime != otherFile.LastWriteTime)
                    {
                        _logger.Info("Conflicting source files with different modification time: '{0}' and '{1}'.", newestInGroup.FullName, otherFile.FullName);
                    }
                    else
                    {
                        _logger.Info("Duplicate source files ignored: '{0}' and '{1}'.", newestInGroup.FullName, otherFile.FullName);
                    }

                    if (otherFile.LastWriteTime > newestInGroup.LastWriteTime ||
                        otherFile.LastWriteTime == newestInGroup.LastWriteTime && otherFile.Length > newestInGroup.Length)
                    {
                        newestInGroup = otherFile;
                    }
                }

                foreach (string file in group.Value)
                {
                    if (file != newestInGroup.FullName)
                    {
                        ignoreFiles.Add(file);
                    }
                }
            }

            return(ignoreFiles);
        }
Exemplo n.º 4
0
 public int UnresolvedConceptsCount()
 {
     return(_unresolvedConceptsByReference
            .SelectMany(concepts => concepts.Value.Select(concept => concept.Dependant.Key))
            .Distinct().Count());
 }