* Function : select_force **************************************************************************/
| 67 | * Function : select_force |
| 68 | **************************************************************************/ |
| 69 | preference* select_force(agent* thisAgent, preference* candidates, bool reinit) |
| 70 | { |
| 71 | preference* return_val = NULL; |
| 72 | preference* cand = candidates; |
| 73 | std::string temp; |
| 74 | |
| 75 | if (thisAgent->select->select_enabled) |
| 76 | { |
| 77 | // go through the list till we find a match or done |
| 78 | while (cand && !return_val) |
| 79 | { |
| 80 | if (cand->value->symbol_type == IDENTIFIER_SYMBOL_TYPE) |
| 81 | { |
| 82 | // clear comparison string |
| 83 | temp = ""; |
| 84 | |
| 85 | // get first letter of comparison string |
| 86 | temp += cand->value->id->name_letter; |
| 87 | |
| 88 | // get number of comparison string |
| 89 | std::string temp2; |
| 90 | to_string(cand->value->id->name_number, temp2); |
| 91 | temp += temp2; |
| 92 | |
| 93 | if (!thisAgent->select->select_operator.compare(temp)) |
| 94 | { |
| 95 | return_val = cand; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | cand = cand->next; |
| 100 | } |
| 101 | |
| 102 | if (return_val && reinit) |
| 103 | { |
| 104 | select_init(thisAgent); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return return_val; |
| 109 | } |
| 110 | |
| 111 | /*************************************************************************** |
| 112 | * Function : predict_init |
no test coverage detected