Beispiel #1
0
        public Entry MatchEntry(string tapeId, Entry entryToMatch, IEntryComparer[] comparers = null)
        {
            Tape tape = Select(tapeId);

            // provide a default comparer
            if (comparers == null || comparers.Length == 0)
            {
                comparers = new IEntryComparer[] { new DefaultEntryComparer() };
            }

            var potentialMatches = tape.log.entries;

            return((
                       from entryComparer in comparers
                       select entryComparer.FindMatch(potentialMatches, entryToMatch)
                       into result
                       where result.Match != null
                       select result.Match)
                   .FirstOrDefault());
        }
Beispiel #2
0
        public Entry MatchEntry(string tapeId, Entry entryToMatch, IEntryComparer[] comparers = null)
        {
            lock (_lockObject)
            {
                Tape tape = Select(tapeId);

                // provide a default comparer
                if (comparers == null || comparers.Length == 0)
                {
                    comparers = new IEntryComparer[] {new DefaultEntryComparer()};
                }

                List<Entry> potentialMatches = tape.log.entries;
                return (
                           from entryComparer in comparers
                           select entryComparer.FindMatch(potentialMatches, entryToMatch)
                           into result
                           where result.Match != null
                           select result.Match)
                    .FirstOrDefault();
            }
        }