Пример #1
0
        internal static LogicalRow CreateFromVariablesValues(LogicalReport report, LogicalGrammarResult result, List <LogicalVariable> variables)
        {
            var logicalRow = new LogicalRow(report);

            logicalRow.VariablesValues = variables.Select(variable => variable.Value).ToList();
            logicalRow.Result          = result.LogicalOperation.GetValue();
            return(logicalRow);
        }
Пример #2
0
 private void PopulateFromVariables(LogicalGrammarResult result, List <LogicalVariable> variables, int i = 0)
 {
     if (i == variables.Count)
     {
         Rows.Add(LogicalRow.CreateFromVariablesValues(this, result, variables));
         return;
     }
     variables[i].Value = false;
     PopulateFromVariables(result, variables, i + 1);
     variables[i].Value = true;
     PopulateFromVariables(result, variables, i + 1);
 }
Пример #3
0
        internal static LogicalReport CreateFromResults(LogicalGrammarResult result)
        {
            LogicalReport report = new LogicalReport();

            if (result.Variables.Count == 0)
            {
                report.UniqueResult = result.LogicalOperation.GetValue();
                return(report);
            }

            List <LogicalVariable> variablesList = result.Variables.Values.OrderBy(v => v.ID).ToList();

            report.ColumnNames = variablesList.Select(variable => variable.ID).ToList();
            report.PopulateFromVariables(result, variablesList);
            bool r1 = report.Rows[0].Result;

            if (report.Rows.All(row => row.Result == r1))
            {
                report.UniqueResult = r1;
            }

            return(report);
        }
Пример #4
0
        public LogicalReport Analyze()
        {
            LogicalGrammarResult result = _grammarAnalyzer.Analyze();

            return(LogicalReport.CreateFromResults(result));
        }