this returns a pair with
| 2383 | |
| 2384 | //this returns a pair with <needFullSearch, goodCue> |
| 2385 | std::pair<bool, bool>* processMathQuery(agent* thisAgent, Symbol* mathQuery, smem_prioritized_weighted_cue* weighted_pq) |
| 2386 | { |
| 2387 | bool needFullSearch = false; |
| 2388 | //Use this set to track when certain elements have been added, so we don't add them twice |
| 2389 | std::set<Symbol*> uniqueMathQueryElements; |
| 2390 | std::pair<bool, bool>* result = new std::pair<bool, bool>(true, true); |
| 2391 | |
| 2392 | smem_wme_list* cue = smem_get_direct_augs_of_id(mathQuery); |
| 2393 | for (smem_wme_list::iterator cue_p = cue->begin(); cue_p != cue->end(); cue_p++) |
| 2394 | { |
| 2395 | |
| 2396 | smem_wme_list* cueTypes = smem_get_direct_augs_of_id((*cue_p)->value); |
| 2397 | if (cueTypes->empty()) |
| 2398 | { |
| 2399 | //This would be an attribute without a query type attached |
| 2400 | result->first = false; |
| 2401 | result->second = false; |
| 2402 | break; |
| 2403 | } |
| 2404 | else |
| 2405 | { |
| 2406 | for (smem_wme_list::iterator cueType = cueTypes->begin(); cueType != cueTypes->end(); cueType++) |
| 2407 | { |
| 2408 | if ((*cueType)->attr == thisAgent->smem_sym_math_query_less) |
| 2409 | { |
| 2410 | if ((*cueType)->value->symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE) |
| 2411 | { |
| 2412 | _smem_process_cue_wme(thisAgent, (*cue_p), true, *weighted_pq, new MathQueryLess((*cueType)->value->fc->value)); |
| 2413 | } |
| 2414 | else if ((*cueType)->value->symbol_type == INT_CONSTANT_SYMBOL_TYPE) |
| 2415 | { |
| 2416 | _smem_process_cue_wme(thisAgent, (*cue_p), true, *weighted_pq, new MathQueryLess((*cueType)->value->ic->value)); |
| 2417 | } |
| 2418 | else |
| 2419 | { |
| 2420 | //There isn't a valid value to compare against |
| 2421 | result->first = false; |
| 2422 | result->second = false; |
| 2423 | break; |
| 2424 | } |
| 2425 | } |
| 2426 | else if ((*cueType)->attr == thisAgent->smem_sym_math_query_greater) |
| 2427 | { |
| 2428 | if ((*cueType)->value->symbol_type == FLOAT_CONSTANT_SYMBOL_TYPE) |
| 2429 | { |
| 2430 | _smem_process_cue_wme(thisAgent, (*cue_p), true, *weighted_pq, new MathQueryGreater((*cueType)->value->fc->value)); |
| 2431 | } |
| 2432 | else if ((*cueType)->value->symbol_type == INT_CONSTANT_SYMBOL_TYPE) |
| 2433 | { |
| 2434 | _smem_process_cue_wme(thisAgent, (*cue_p), true, *weighted_pq, new MathQueryGreater((*cueType)->value->ic->value)); |
| 2435 | } |
| 2436 | else |
| 2437 | { |
| 2438 | //There isn't a valid value to compare against |
| 2439 | result->first = false; |
| 2440 | result->second = false; |
| 2441 | break; |
| 2442 | } |
no test coverage detected