Esempio n. 1
0
        private static ProgramReturnCode RunPredicateSetters(LogicArgument program, ref List <string> programOutput)
        {
            ProgramReturnCode errorCode = ProgramReturnCode.No_errors;

            for (int i = 0; i < program.predicateSetterList.PredicateSetterCount(); i++)
            {
                PredicateSetterSyntacticElement pse = program.predicateSetterList.GetPredicateSetterAt(i);
                try
                {
                    pse = RunPredicateSetter(pse, program);
                    if (pse.Value == false)
                    {
                        string error = pse.Text + " : contained an invalid value for predicate";
                        programOutput.Add(error);
                        errorCode = ProgramReturnCode.Setter_has_invalid_value;
                    }
                }
                catch (ArgumentNullException ex)
                {
                    string error = pse.Text + " : " + ex.Message;
                    programOutput.Add(error);
                    errorCode = ProgramReturnCode.No_predicate_for_setter;
                }
                catch (Exception ex)
                {
                    programOutput.Add(ex.Message);
                }
            }
            return(errorCode);
        }
Esempio n. 2
0
 private static PredicateSetterSyntacticElement RunPredicateSetter(PredicateSetterSyntacticElement pse, LogicArgument program)
 {
     if (pse is PropositionSyntacticElement)
     {
         program.predicateList = ExpressionExecutive.execute((PropositionSyntacticElement)pse, program.predicateList);
     }
     else if (pse is PropositionNegationSyntacticElement)
     {
         program.predicateList = ExpressionExecutive.execute((PropositionNegationSyntacticElement)pse, program.predicateList);
     }
     else
     {   // case cannot currently exist
         throw new NotImplementedException();
     }
     return(pse);
 }
Esempio n. 3
0
 public Boolean AddPredicateSetter(PredicateSetterSyntacticElement proposition)
 {
     Propositions.Add(proposition);
     return(true);
 }
Esempio n. 4
0
 public bool Add(PredicateSetterSyntacticElement pse)
 {
     return(predicateSetterList.AddPredicateSetter(pse));
 }