コード例 #1
0
ファイル: dict.c プロジェクト: tinrodriguez8/sourceProjects
dict_t dict_add(dict_t dict, word_t word, def_t def) {
    assert(dict != NULL && word != NULL && def != NULL &&
           (!dict_exists(dict, word)));
    index_t index_word = index_from_string(word);
    data_t data_def = data_from_string(def);
    list_t new_list = list_append(dict->list, index_word, data_def);
    dict->list = new_list;
    dict->length++;
    return (dict);
}
コード例 #2
0
ファイル: dict.c プロジェクト: tinrodriguez8/sourceProjects
dict_t dict_add(dict_t dict, word_t word, def_t def) {
	
	assert(dict != NULL && word != NULL && def != NULL && !dict_exists(dict,word));
	
	index_t index = index_from_string(word);
	data_t data = data_from_string(def);
	
	dict->length = dict->length +1;
	dict->data = list_add(dict->data,index,data);		
	
	
	return dict;
}
コード例 #3
0
dict_t dict_add(dict_t dict, word_t word, def_t def) {

    /*Precondition verification*/
    assert(dict != NULL);
    assert(word != NULL);
    assert(def != NULL);
    assert(!dict_exists(dict, word));


    index_t index = index_from_string(word);
    data_t data = data_from_string(def);

    dict->length += 1;
    dict->data = bst_add(dict->data, index, data);


    /* POST: the elements of the result are the same as the one in 'dict' with
     * the new pair ('word', 'def') added.*/

    return (dict);

}