Beispiel #1
0
        public static void PrintFunInfo()
        {
            foreach (var fun in infoStore.spine)
            {
                RandColor.Write($"{fun.Value.description.GetPolName()} {fun.Value.description.GetFunName()} ", colorHeading);
                RandColor.Write($"order: {fun.Key} ", GetSwapColor());
                RandColor.WriteLine($"id: {fun.Value.description.funID}", GetSwapColor());
            }

            RandColor.WriteLine(Environment.NewLine + "- - - - - - - - - - - - - - - - - - - - - - - - ", colorHeading);
            RandColor.WriteLine(Environment.NewLine + "Press x to exit, order to analyse function", colorHeading);
            do
            {
                RandColor.Write("order: ", GetSwapColor()); string o = Console.ReadLine(); if (o == "x")
                {
                    break;
                }
                if (!int.TryParse(o, out int order) || !infoStore.spine.ContainsKey(order))
                {
                    continue;
                }

                PrintParAsDefined(infoStore.spine[order]);
                PrintParAsRead(infoStore.spine[order]);

                RandColor.WriteLine("- - - - - - - - - - - - - - - - - - - - - - - - ", colorHeading);
            } while (true);
        }
Beispiel #2
0
        private static void PrintParAsDefined(FunBase fun)
        {
            DefinitionAdmin.Fun funDef = DefinitionAdmin.GetFunDefinition(fun.description.GetFunName());
            PrintSubHeading("Possible parameters");

            CompOpt(funDef.GetParList());
            foreach (DefinitionAdmin.ParGroup group in funDef.GetGroupParList())
            {
                RandColor.WriteLine($"{(group.minCount > 0 ? "Compuslory" : "Optional")} group {group.groupName}:", colorHeading);
                CompOpt(group.par, "   ");
            }

            void CompOpt(Dictionary <string, DefinitionAdmin.Par> parList, string space = "")
            {
                RandColor.Write($"{space}Compulsory: ", colorHeading);
                foreach (var par in parList)
                {
                    if (par.Value.minCount > 0)
                    {
                        RandColor.Write($"{par.Key} ", GetSwapColor());
                    }
                }
                RandColor.Write(Environment.NewLine + $"{space}Optional: ", colorHeading);
                foreach (var par in parList)
                {
                    if (par.Value.minCount == 0)
                    {
                        RandColor.Write($"{par.Key} ", GetSwapColor());
                    }
                }
                Console.WriteLine();
            }
        }
        public static void PrintOperandInfo()
        {
            PrintHeading("Operands");
            foreach (string operandName in infoStore.operandAdmin.GetOperandNames())
            {
                RandColor.Write($"{operandName}  ", GetSwapColor());
                RandColor.Write($"{infoStore.operandAdmin.GetParType(operandName)}  ", GetSwapColor());
                RandColor.Write($"{(infoStore.operandAdmin.GetIsMonetary(operandName) ? "monetary" : "not-monetary")}  ", GetSwapColor());
                RandColor.Write($"{(infoStore.operandAdmin.GetIsGlobal(operandName) ? "global" : "not-global")}  ", GetSwapColor());
                try { RandColor.Write($"var-index:{infoStore.operandAdmin.GetIndexInPersonVarList(operandName)}  ", GetSwapColor()); } catch { }

                if (infoStore.operandAdmin.GetParType(operandName) == DefPar.PAR_TYPE.IL &&
                    infoStore.operandAdmin.GetILContent(operandName).Count > 0)
                {
                    RandColor.Write($"content:", GetSwapColor());
                    foreach (var ilComponent in infoStore.operandAdmin.GetILContent(operandName))
                    {
                        string pm = ilComponent.Value.ToString() + "*";
                        if (ilComponent.Value == 1)
                        {
                            pm = "+";
                        }
                        if (ilComponent.Value == -1)
                        {
                            pm = "-";
                        }
                        Console.Write($"{pm}{ilComponent.Key}");
                    }
                }
                Console.WriteLine();
            }
        }
Beispiel #4
0
        public static void PrintTUInfo()
        {
            PrintHeading("Household info - taxunits");

            PrintSubHeading($"{infoStore.indexTUs.Count} TUs defined:");
            foreach (string tuName in infoStore.indexTUs.Keys)
            {
                RandColor.Write($"{tuName} ", GetSwapColor());
            }
            Console.WriteLine();

            if (infoStore.hhAdmin == null)
            {
                return;
            }

            int nTestHH = 3; int i = 0;

            PrintSubHeading($"first and last {nTestHH} households");

            foreach (HH hh in infoStore.hhAdmin.hhs)
            {
                if (Exclude(ref i, nTestHH, infoStore.hhAdmin.hhs.Count))
                {
                    continue;
                }
                ConsoleColor color = GetSwapColor();
                foreach (var tu in hh.hhTUs)
                {
                    RandColor.WriteLine($"{tu.Key}: {tu.Value.Count} unit(s) in HH {i}", color);
                }
            }
        }
Beispiel #5
0
 private static void PrintHeading(string heading)
 {
     RandColor.Write(Environment.NewLine + "* * *   ", colorHeading);
     foreach (char c in heading.ToUpper())
     {
         RandColor.Write($"{c} ", colorHeading);
     }
     RandColor.WriteLine("  * * *", colorHeading);
 }
Beispiel #6
0
        private static void PrintParAsRead(FunBase fun)
        {
            PrintSubHeading("Actual parameters");

            RandColor.Write($"Unique pars: ", colorHeading);
            foreach (var par in fun.TestGetUniquePar())
            {
                RandColor.Write($"{par.Key} ", GetSwapColor());
            }

            RandColor.Write(Environment.NewLine + $"Non-unique pars: ", colorHeading);
            foreach (var par in fun.TestGetNonUniquePar())
            {
                RandColor.Write($"{par.Key} ({par.Value.Count}) ", GetSwapColor());
            }

            RandColor.Write(Environment.NewLine + $"Groups: ", colorHeading);
            foreach (var cat in fun.TestGetGroupPar())
            {
                foreach (var group in cat.Value)
                {
                    Console.WriteLine();
                    RandColor.Write($"   {cat.Key}{group.Key}: ", colorHeading);
                    foreach (var par in group.Value)
                    {
                        RandColor.Write($"{par.description.GetParName()} ", GetSwapColor());
                    }
                }
            }

            RandColor.Write(Environment.NewLine + $"Placeholder pars: ", colorHeading);
            foreach (var par in fun.TestGetPlaceholderPar())
            {
                RandColor.Write($"{par.Key} ", GetSwapColor());
            }

            RandColor.Write(Environment.NewLine + $"Footnote pars: ", colorHeading);
            foreach (var no in fun.TestGetFootnotePar())
            {
                foreach (var par in no.Value)
                {
                    RandColor.Write($"{par.Key}_{no.Key} ", GetSwapColor());
                }
            }
            Console.WriteLine();
        }
        public static void PrintHHInfo()
        {
            PrintHeading("Household info - variables");
            if (infoStore.hhAdmin == null)
            {
                RandColor.WriteLine("No info on households available", colorInfo); return;
            }

            int nTestHH = 5; int i = 0;

            PrintSubHeading($"first and last {nTestHH} households");

            foreach (string varName in infoStore.operandAdmin.GetPersonVarNameList())
            {
                RandColor.Write($"{varName,7} ", GetSwapColor());
            }
            RandColor.WriteLine(""); // header: names of variables

            foreach (HH hh in infoStore.hhAdmin.hhs)
            {
                if (Exclude(ref i, nTestHH, infoStore.hhAdmin.hhs.Count))
                {
                    continue;
                }
                ConsoleColor color = GetSwapColor();
                for (int iPerson = 0; iPerson < hh.personVarList.Count; ++iPerson)
                {
                    foreach (var d in hh.personVarList[iPerson])
                    {
                        RandColor.Write($"{Math.Round(d,2, MidpointRounding.AwayFromZero),7} ", color);
                    }
                    foreach (var s in hh.personStringVarList[iPerson])
                    {
                        RandColor.Write($"{s} ", color);
                    }
                    Console.WriteLine();
                }
            }
        }
        public static void PrintParInfo()
        {
            RandColor.WriteLine(Environment.NewLine + "parameter-order (140011-12) or function-order (140011) for analysis, x to exit", colorHeading);
            do
            {
                RandColor.Write("order: ", GetSwapColor()); string o = Console.ReadLine(); if (o == "x")
                {
                    break;
                }
                string fo, parOrder;
                fo       = o.Contains("-") ? o.Substring(0, o.IndexOf('-')) : o;
                parOrder = o.Contains("-") ? o.Substring(o.IndexOf('-')).TrimStart(new char[] { '-' }) : string.Empty;
                if (!double.TryParse(fo, out double funOrder) || !infoStore.spine.ContainsKey(funOrder))
                {
                    continue;
                }
                if (parOrder == string.Empty)
                {
                    foreach (var p in infoStore.spine[funOrder].TestGetAllPar(true))
                    {
                        RandColor.WriteLine($"{p.description.GetParName()} {p.description.par.order}", GetSwapColor());
                    }
                    continue;
                }
                ParBase anaPar = GetPar(funOrder, parOrder);
                if (anaPar != null)
                {
                    PrintParDetails(anaPar);
                }
                RandColor.WriteLine("- - - - - - - - - - - - - - - - - - - - - - - - ", colorHeading);
            } while (true);

            ParBase GetPar(double funOrder, string parOrder)
            {
                return((from p in infoStore.spine[funOrder].TestGetAllPar(true)
                        where p.description.par.order == parOrder
                        select p).FirstOrDefault());
            }
        }