public void Remove(Statement statement) { if (statement.AnyNull) { for (int i = 0; i < statements.Count; i++) { Statement s = (Statement)statements[i]; if (statement.Matches(s)) { statements.RemoveAt(i); i--; if (isIndexed) { GetIndexArray(statementsAboutSubject, s.Subject).Remove(s); GetIndexArray(statementsAboutObject, s.Object).Remove(s); } } } } else { statements.Remove(statement); if (isIndexed) { GetIndexArray(statementsAboutSubject, statement.Subject).Remove(statement); GetIndexArray(statementsAboutObject, statement.Object).Remove(statement); } } }
protected void Visit(StatementList statementList) { for (int i = 0; i < statementList.Count; i++) { var statement = statementList[i]; var ifStatement = statement as IfStatement; if (ifStatement != null) { var result = evaluator.Evaluate(ifStatement.Condition); if (result.HasErrors) { continue; } statementList[i] = result.Value == 1.0 ? ifStatement.Then : ifStatement.Else; if (statementList[i] == null) { statementList.RemoveAt(i); } i--; } } Visit((Node)statementList); }