private Matcher SetupMatcher(MatcherBuilder builder)
 {
     for (int i = 0; i < Endpoints.Length; i++)
     {
         builder.AddEndpoint(Endpoints[i]);
     }
     return(builder.Build());
 }
        public void Pruned()
        {
            FuzzyMatcher f = MatcherBuilder.Matcher(new string[] {
                "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-_abcdefghijklmnopqrstuvwxyz",
                "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-_abcdefghijklmnopqrstuvwxyz",
                "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-_abcdefghijklmnopqrstuvwxyz",
                "+",
                "\\",
                "/"
            });

            Assert.AreEqual("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz", f.Signature);
        }
        private async Task <IList <Match> > GetMatchesAsync(string file, uint threshold)
        {
            var lines = new List <string>();

            // Open the FileStream with the same FileMode, FileAccess
            // and FileShare as a call to File.OpenText would've done.
            using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous | FileOptions.SequentialScan))
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    string line;
                    while ((line = await reader.ReadLineAsync()) != null)
                    {
                        lines.Add(line);
                    }
                }
            var matcher = MatcherBuilder.Matcher(lines);

            return(await Task.Run(() => matcher.Matches(lines, threshold)));
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ParameterizedTest @MethodSource("parameters") void shouldLogAsynchronously(Invocation invocation, Level level, Style style)
        internal virtual void ShouldLogAsynchronously(Invocation invocation, Level level, Style style)
        {
            // given
            AssertableLogProvider logging = new AssertableLogProvider();
            Log            log            = logging.getLog(this.GetType());
            DeferredSender events         = new DeferredSender();
            AsyncLog       asyncLog       = new AsyncLog(events, log);

            // when
            log(invocation.decorate(asyncLog), level, style);
            // then
            logging.AssertNoLoggingOccurred();

            // when
            events.Process();
            // then
            MatcherBuilder matcherBuilder = new MatcherBuilder(inLog(this.GetType()));

            log(matcherBuilder, level, style);
            logging.AssertExactly(matcherBuilder.Matcher());
        }
        public void RandomStrings()
        {
            FuzzyMatcher f = MatcherBuilder.Matcher(new string[] {
                "HAAVGCA",
                "VQQOLBT",
                "VGOPXJT",
                "ZKDEGLB",
                "KUFQKUC",
                "OPDXAAF",
                "YTSAHCY",
                "SQTSQKC",
                "YDCPBTY",
                "UAVJKPY",
                "YPLZTWY",
                "EJGXVWR",
                "RRDTSVG",
                "JVEKZZL",
                "KAZQYDL",
                "NJEPOWE",
                "HRQJZTW",
                "LQWINPT",
                "WDZWDAW",
                "PEZHQGI",
                "TVQGZVVOZVUCTDK",
                "TXXDOJDQHJGXCAC",
                "FZSDAIFPSSIGHSM",
                "JTIYUHFSLKIRDBD",
                "WYFMXYBAJDVPKOI",
                "POLPNKOGMEJZTEU",
                "HDLBEEKYKRSUVQY",
                "OOQECMVHUGEXISF",
                "MJOZGUPVKOHCSRP",
                "DPQRCNYRRBOFHGZ"
            });

            Assert.AreEqual("AAABCCDDEEFFGHIIJJKKLMNOOPPQQRRRSSSSTTUUVVVVWWWXXXYYZZ", f.Signature);
        }
        public void AlphabeticallySorted()
        {
            FuzzyMatcher f = MatcherBuilder.Matcher(new string[] {
                "AAACGHV",
                "AADFOPX",
                "ABDFIJKMOPVWXYY",
                "ACCDDGHJJOQTXXX",
                "ACHSTYY",
                "ADDWWWZ",
                "ADFFGHIIMPSSSSZ",
                "ADKLQYZ",
                "AJKPUVY",
                "BCDFGHNOPQRRRYZ",
                "BCDPTYY",
                "BDDFHIIJKLRSTUY",
                "BDEEHKKLQRSUVYY",
                "BDEGKLZ",
                "BLOQQTV",
                "CDGKOQTTUVVVVZZ",
                "CEEFGHIMOOQSUVX",
                "CFKKQUU",
                "CGHJKMOOPPRSUVZ",
                "CKQQSST",
                "DGRRSTV",
                "EEGJKLMNOOPPTUZ",
                "EEJNOPW",
                "EGHIPQZ",
                "EGJRVWX",
                "EJKLVZZ",
                "GJOPTVX",
                "HJQRTWZ",
                "ILNPQTW",
                "LPTWYYZ"
            });

            Assert.AreEqual("AAABCCDDEEFFGHIIJJKKLMNOOPPQQRRRSSSSTTUUVVVVWWWXXXYYZZ", f.Signature);
        }
 private Matcher SetupMatcher(MatcherBuilder builder)
 {
     builder.AddEndpoint(Endpoints[0]);
     return(builder.Build());
 }
 public void Init()
 {
     matcher      = MatcherBuilder.Matcher("AAABBCCCDDDEEEEFFGGGHHIIIIJKKLLLMMNNNOOOPPQRRRSSSSTTTUUVVWWXYYZZ");
     matcherEmpty = MatcherBuilder.Matcher(new string[0]);
 }
Example #9
0
 public LoggerAnonymousInnerClass4(MatcherBuilder outerInstance)
 {
     this.outerInstance = outerInstance;
 }
Example #10
0
        private QilGenerator(bool debug)
        {
            _scope = new CompilerScopeManager<QilIterator>();
            _outputScope = new OutputScopeManager();
            _prefixesInUse = new HybridDictionary();
            _f = new XsltQilFactory(new QilFactory(), debug);
            _xpathBuilder = new XPathBuilder((IXPathEnvironment)this);
            _xpathParser = new XPathParser<QilNode>();
            _ptrnBuilder = new XPathPatternBuilder((IXPathEnvironment)this);
            _ptrnParser = new XPathPatternParser();
            _refReplacer = new ReferenceReplacer(_f.BaseFactory);
            _invkGen = new InvokeGenerator(_f, debug);
            _matcherBuilder = new MatcherBuilder(_f, _refReplacer, _invkGen);
            _singlFocus = new SingletonFocus(_f);
            _funcFocus = new FunctionFocus();
            _curLoop = new LoopFocus(_f);
            _strConcat = new QilStrConcatenator(_f);
            _varHelper = new VariableHelper(_f);

            _elementOrDocumentType = T.DocumentOrElement;
            _textOrAttributeType = T.NodeChoice(XmlNodeKindFlags.Text | XmlNodeKindFlags.Attribute);

            _nameCurrent = _f.QName("current", XmlReservedNs.NsXslDebug);
            _namePosition = _f.QName("position", XmlReservedNs.NsXslDebug);
            _nameLast = _f.QName("last", XmlReservedNs.NsXslDebug);
            _nameNamespaces = _f.QName("namespaces", XmlReservedNs.NsXslDebug);
            _nameInit = _f.QName("init", XmlReservedNs.NsXslDebug);

            _formatterCnt = 0;
        }