예제 #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));
        }