Beispiel #1
0
    /// <summary>
    /// The function actually doing the transforming. This function is called
    /// once for each SBase element in the model.
    /// </summary>
    /// <param name="element">the current element</param>
    /// <returns>status code</returns>
    public override int transform(SBase element)
    {
        // return in case we don't have a valid element
        if (element == null || element.getTypeCode() == libsbml.SBML_LOCAL_PARAMETER)
        {
            return(libsbml.LIBSBML_OPERATION_SUCCESS);
        }

        // or if there is nothing to do
        if (!element.isSetName() || element.getId() == element.getName())
        {
            return(libsbml.LIBSBML_OPERATION_SUCCESS);
        }

        // find the new id
        string newId = getValidIdForName(element.getName());

        // set it
        element.setId(newId);

        // remember it
        existingIds.Add(newId);

        return(libsbml.LIBSBML_OPERATION_SUCCESS);
    }