MCPcopy Create free account
hub / github.com/SoarGroup/Soar / make_new_negative_node

Function make_new_negative_node

Core/SoarKernel/src/rete.cpp:2498–2532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2496-------------------------------------------------------------------- */
2497
2498rete_node* make_new_negative_node(agent* thisAgent,
2499 rete_node* parent, byte node_type,
2500 var_location left_hash_loc,
2501 alpha_mem* am, rete_test* rt)
2502{
2503 rete_node* node;
2504
2505 allocate_with_pool(thisAgent, &thisAgent->rete_node_pool, &node);
2506 init_new_rete_node_with_type(thisAgent, node, node_type);
2507 node->parent = parent;
2508 node->next_sibling = parent->first_child;
2509 parent->first_child = node;
2510 node->first_child = NIL;
2511 node->left_hash_loc_field_num = left_hash_loc.field_num;
2512 node->left_hash_loc_levels_up = left_hash_loc.levels_up;
2513 node->b.posneg.other_tests = rt;
2514 node->b.posneg.alpha_mem_ = am;
2515 node->a.np.tokens = NIL;
2516 node->b.posneg.nearest_ancestor_with_same_am =
2517 nearest_ancestor_with_same_am(node, am);
2518 relink_to_right_mem(node);
2519
2520 node->node_id = get_next_beta_node_id(thisAgent);
2521
2522 /* --- call new node's add_left routine with all the parent's tokens --- */
2523 update_node_with_matches_from_above(thisAgent, node);
2524
2525 /* --- if no tokens arrived from parent, unlink the node --- */
2526 if (! node->a.np.tokens)
2527 {
2528 unlink_from_right_mem(node);
2529 }
2530
2531 return node;
2532}
2533
2534/* --------------------------------------------------------------------
2535 Make New CN Node

Callers 2

Calls 6

allocate_with_poolFunction · 0.85
relink_to_right_memFunction · 0.85
get_next_beta_node_idFunction · 0.85

Tested by

no test coverage detected