std::set<TextQuery::line_no> NotQuery::eval( const TextQuery& file ) const { std::set<TextQuery::line_no> has_val = query.eval( file ); std::set<line_no> ret_lines; for( TextQuery::line_no n = 0; n != file.size(); ++n ) if ( has_val.find( n ) == has_val.end() ) ret_lines.insert( n ); return ret_lines; }
std::set<TextQuery::line_no> NotQuery::eval(const TextQuery &obj_TextQuery) const { std::set<TextQuery::line_no> has_val = query.eval(obj_TextQuery); std::set<TextQuery::line_no> ret_line; for (int i = 0; i != obj_TextQuery.size(); ++i) { if (has_val.find(i) == has_val.end()) ret_line.insert(i); return ret_line; } }
std::set<TextQuery::line_no> NotQuery::eval(const TextQuery& tq) const { std::set<TextQuery::line_no> v = query.eval(tq); std::set<line_no> ret; for( TextQuery::line_no n = 0 ; n != tq.size() ; n++ ) { if( v.find(n) == v.end() ) { ret.insert(n); } } return ret; }
set<TextQuery::line_no> NotQuery::eval(const TextQuery& file) const { // virtual call through the Query handle to eval set<TextQuery::line_no> has_val = query.eval(file); set<line_no> ret_lines; // for each line in the input file, check whether that line is in has_val // if not, add that line number to ret_lines for (TextQuery::line_no n = 0; n != file.size(); ++n) if (has_val.find(n) == has_val.end()) ret_lines.insert(n); return ret_lines; }