void myInitialAssignment_initTarget( myInitialAssignment *assign, mySpecies **species, unsigned int num_of_species, myParameter **parameters, unsigned int num_of_parameters, myCompartment **compartments, unsigned int num_of_compartments) { unsigned int i; InitialAssignment_t *origin; const char *origin_symbol; origin = myInitialAssignment_getOrigin(assign); origin_symbol = InitialAssignment_getSymbol(origin); for (i = 0; i < num_of_species; i++) { if (strcmp(origin_symbol, Species_getId(species[i]->origin)) == 0) { myInitialAssignment_setTargetSpecies(assign, species[i]); return; } } for (i = 0; i < num_of_parameters; i++) { if (strcmp(origin_symbol, Parameter_getId(parameters[i]->origin)) == 0) { myInitialAssignment_setTargetParameter(assign, parameters[i]); return; } } for (i = 0; i < num_of_compartments; i++) { if (strcmp(origin_symbol, Compartment_getId(compartments[i]->origin)) == 0) { myInitialAssignment_setTargetCompartment(assign, compartments[i]); return; } } }
void myInitialAssignment_initTargetSpeciesReference( myInitialAssignment *assign, myReaction **reactions, unsigned int num_of_reactions) { unsigned int i, j; InitialAssignment_t *origin; myReaction *re; mySpeciesReference *product, *reactant; const char *origin_symbol; origin = myInitialAssignment_getOrigin(assign); origin_symbol = InitialAssignment_getSymbol(origin); for (i = 0; i < num_of_reactions; i++) { re = reactions[i]; for (j = 0; j < re->num_of_products; j++) { product = re->products[j]; if (SpeciesReference_isSetId(product->origin) && strcmp(origin_symbol, SpeciesReference_getId(product->origin)) == 0) { myInitialAssignment_setTargetSpeciesReference(assign, product); return; } } for (j = 0; j < re->num_of_reactants; j++) { reactant = re->reactants[j]; if (SpeciesReference_isSetId(reactant->origin) && strcmp(origin_symbol, SpeciesReference_getId(reactant->origin)) == 0) { myInitialAssignment_setTargetSpeciesReference(assign, reactant); return; } } } }
END_TEST START_TEST (test_InitialAssignment_setSymbol2) { const char *id = "e1"; int i = InitialAssignment_setSymbol(E, id); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !strcmp(InitialAssignment_getSymbol(E), id) ); fail_unless( InitialAssignment_isSetSymbol(E) ); i = InitialAssignment_setSymbol(E, NULL); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !InitialAssignment_isSetSymbol(E) ); }