// Look up in fm, assigning found val at spec'd address Bool lookupFM ( WordFM* fm, /*OUT*/Word* valP, Word key ) { AvlNode* node = avl_find_node( fm->root, key, fm->kCmp ); if (node) { if (valP) *valP = node->val; return True; } else { return False; } }
int glp_find_row(glp_prob *lp, const char *name) { AVLNODE *node; int i = 0; if (lp->r_tree == NULL) xerror("glp_find_row: row name index does not exist\n"); if (!(name == NULL || name[0] == '\0' || strlen(name) > 255)) { node = avl_find_node(lp->r_tree, name); if (node != NULL) i = ((GLPROW *)avl_get_node_link(node))->i; } return i; }
int glp_find_col(glp_prob *lp, const char *name) { AVLNODE *node; int j = 0; if (lp->c_tree == NULL) xerror("glp_find_col: column name index does not exist\n"); if (!(name == NULL || name[0] == '\0' || strlen(name) > 255)) { node = avl_find_node(lp->c_tree, name); if (node != NULL) j = ((GLPCOL *)avl_get_node_link(node))->j; } return j; }
// Delete key from fm, returning associated val if found Bool delFromFM ( WordFM* fm, /*OUT*/Word* oldV, Word key ) { AvlNode* node = avl_find_node( fm->root, key, fm->kCmp ); if (node) { avl_remove_wrk( &fm->root, node, fm->kCmp ); if (oldV) *oldV = node->val; fm->dealloc(node); return True; } else { return False; } }
int glp_find_vertex(glp_graph *G, const char *name) { /* find vertex by its name */ AVLNODE *node; int i = 0; if (G->index == NULL) xerror("glp_find_vertex: vertex name index does not exist\n"); if (!(name == NULL || name[0] == '\0' || strlen(name) > 255)) { node = avl_find_node(G->index, name); if (node != NULL) i = ((glp_vertex *)avl_get_node_link(node))->i; } return i; }
// Look up in fm, assigning found key & val at spec'd addresses Bool VG_(lookupFM) ( WordFM* fm, /*OUT*/UWord* keyP, /*OUT*/UWord* valP, UWord key ) { AvlNode* node = avl_find_node( fm->root, key, fm->kCmp ); if (node) { if (keyP) *keyP = node->key; if (valP) *valP = node->val; return True; } else { return False; } }