Ejemplo n.º 1
0
        internal CouchUrl DB(string db)
        {
            var path = ListModule.OfSeq <string>(new string[] { db });

            if (this.path.Length > 0) //replace just the first of the list
            {
                path = ListModule.Append(path, ListModule.Tail(this.path));
            }

            return(Create(this.couchRepo, path, this.queryString, this.filters));
        }
Ejemplo n.º 2
0
        //[Test, TestCaseSource("split_token_tests")]
        public void TestSplitContent(StringTest test)
        {
            Func <string[], FSStringList> of_array = (array) => ListModule.OfArray <string>(array);

            Func <FSStringList, string[]> to_string_array = (string_list) =>
            {
                var tl  = string_list;
                var res = new StringList();
                while (ListModule.Length <string>(tl) > 0)
                {
                    res.Add(ListModule.Head <string>(tl));
                    tl = ListModule.Tail <string>(tl);
                }

                return(res.ToArray());
            };

            //Assert.AreEqual(to_string_array(of_array(test.expected)), to_string_array(OutputHandling.split_token_contents(test.provided)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <see cref=""/>
        /// </summary>
        /// <param name="test"></param>
        //[Test, TestCaseSource("smart_split_tests")]
        public void TestSmartSplit(StringTest test)
        {
            Regex           r = new Regex(@"(""(?:[^""\\]*(?:\\.[^""\\]*)*)""|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)", RegexOptions.Compiled);
            MatchCollection m = r.Matches(@"'\'funky\' style'");

            Func <string[], FSStringList> of_array = (array) => ListModule.OfArray <string>(array);

            Func <FSStringList, string[]> to_string_array = (string_list) =>
            {
                var tl  = string_list;
                var res = new StringList();
                while (ListModule.Length <string>(tl) > 0)
                {
                    res.Add(ListModule.Head <string>(tl));
                    tl = ListModule.Tail <string>(tl);
                }

                return(res.ToArray());
            };

            //         Assert.AreEqual(to_string_array(of_array(test.expected)), to_string_array(OutputHandling.smart_split(test.provided)));
        }
Ejemplo n.º 4
0
        public Deedle.Ranges.Ranges <T> MergeWith(IEnumerable <Deedle.Ranges.Ranges <T> > ranges)
        {
            IEnumerable <Deedle.Ranges.Ranges <T> > list = (IEnumerable <Deedle.Ranges.Ranges <T> >)SeqModule.ToList <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(this, ranges, 0, (Deedle.Ranges.Ranges <T>)null));

            if (SeqModule.IsEmpty <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list))
            {
                throw new ArgumentException("Range cannot be empty", nameof(ranges));
            }
            IRangeKeyOperations <T>    operations = ((Deedle.Ranges.Ranges <T>)SeqModule.Head <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list)).Operations;
            FSharpList <Tuple <T, T> > fsharpList = (FSharpList <Tuple <T, T> >)ListModule.SortWith <Tuple <T, T> >((FSharpFunc <M0, FSharpFunc <M0, int> >) new Ranges.MergeWith <T>(operations), SeqModule.ToList <Tuple <T, T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(list, (Deedle.Ranges.Ranges <T>)null, (IEnumerator <Deedle.Ranges.Ranges <T> >)null, (Tuple <T, T>)null, (IEnumerator <Tuple <T, T> >)null, 0, (Tuple <T, T>)null)));
            FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > > fsharpFunc = (FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > >) new Ranges.MergeWith <T>(operations);
            IRangeKeyOperations <T> ops = operations;

            return(new Deedle.Ranges.Ranges <T>((IEnumerable <Tuple <T, T> >)FSharpFunc <Tuple <T, T>, FSharpList <Tuple <T, T> > > .InvokeFast <IEnumerable <Tuple <T, T> > >((FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, M0> >)fsharpFunc, (Tuple <T, T>)ListModule.Head <Tuple <T, T> >((FSharpList <M0>)fsharpList), (FSharpList <Tuple <T, T> >)ListModule.Tail <Tuple <T, T> >((FSharpList <M0>)fsharpList)), ops));
        }
Ejemplo n.º 5
0
        public static FSharpOption <Tuple <FSharpOption <Bitmap>, string, FSharpList <Tuple <string, string> > > > EtiketParse(string path)
        {
            string txt    = File.ReadAllText(path, enc);
            Match  match  = regBar.Match(txt);
            Match  match2 = match;
            Match  match3 = match2;
            Match  n      = match3;

            if (n.Success)
            {
                Match  m      = match3;
                string barc   = m.Groups[1].Value;
                Match  match4 = regEtik.Match(txt);
                Match  match5 = match4;
                Match  match6 = match5;
                Match  l      = match6;
                if (l.Success)
                {
                    Match k = match6;
                    return(FSharpOption <Tuple <FSharpOption <Bitmap>, string, FSharpList <Tuple <string, string> > > > .Some(new Tuple <FSharpOption <Bitmap>, string, FSharpList <Tuple <string, string> > >(null, barc, ListModule.Zip(FSharpList <string> .Cons("mark", FSharpList <string> .Cons("sht", FSharpList <string> .Cons("pp", FSharpList <string> .Cons("fn", FSharpList <string> .Cons("rh", FSharpList <string> .Cons("posgr", FSharpList <string> .Cons("sideAndSize", FSharpList <string> .Cons("strSteelCart", FSharpList <string> .Cons("car", FSharpList <string> .Cons("sp", FSharpList <string> .Cons("customername", FSharpList <string> .Cons("orderitemname", FSharpList <string> .Cons("mon_comm", FSharpList <string> .Empty))))))))))))), ListModule.Tail(SeqModule.ToList(new EtiketParse_71(k, null, null, 0, null)))))));
                }
                Match match7 = regImp.Match(txt);
                Match match8 = match7;
                Match match9 = match8;
                Match j      = match9;
                if (j.Success)
                {
                    Match    i    = match9;
                    Bitmap   bmp  = new Bitmap(170, 170);
                    Graphics gr   = Graphics.FromImage(bmp);
                    Pen      pen  = new Pen(Color.Black, 2f);
                    Pen      penB = new Pen(Color.Black, 4f);
                    ListModule.Iterate(new EtiketParse_82_4(gr, pen, penB), SeqModule.ToList(new EtiketParse_81_5(txt, null, null, 0, null)));
                    ListModule.Iterate(new EtiketParse_99_9(gr), ListModule.Filter(new EtiketParse_98_10(), SeqModule.ToList(new EtiketParse_97_11(txt, null, null, 0, null))));
                    return(FSharpOption <Tuple <FSharpOption <Bitmap>, string, FSharpList <Tuple <string, string> > > > .Some(new Tuple <FSharpOption <Bitmap>, string, FSharpList <Tuple <string, string> > >(FSharpOption <Bitmap> .Some(bmp), barc, ListModule.Zip(FSharpList <string> .Cons("mark", FSharpList <string> .Cons("MarkBalka", FSharpList <string> .Cons("ColorCode", FSharpList <string> .Cons("SideBalka", FSharpList <string> .Cons("car", FSharpList <string> .Cons("strSteelCart", FSharpList <string> .Cons("PosGroup", FSharpList <string> .Cons("pp", FSharpList <string> .Cons("IsShtulp", FSharpList <string> .Cons("IsFalsh", FSharpList <string> .Empty)))))))))), ListModule.Tail(SeqModule.ToList(new EtiketParse_109_15(i, null, null, 0, null)))))));
                }
                return(null);
            }
            return(null);
        }