de.unirostock.sems.bives.sbml.parser.SBMLDiffReport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BiVeS-SBML Show documentation
Show all versions of BiVeS-SBML Show documentation
BiVeS - BioModel Version Control System
This package provides SBML integration for BiVeS
/**
*
*/
package de.unirostock.sems.bives.sbml.parser;
import java.util.ArrayList;
import java.util.List;
/**
* The Class SBMLDiffReport creates a report about the differences between two versions of an SBML document.
*
* @author Martin Scharm
*/
public class SBMLDiffReport
{
/** The header. */
private String header;
/** The modified species. */
private List modifiedSpecies;
/** The modified species types. */
private List modifiedSpeciesTypes;
/** The modified parameter. */
private List modifiedParameter;
/** The modified reactions. */
private List modifiedReactions;
/** The modified compartments. */
private List modifiedCompartments;
/** The modified compartment types. */
private List modifiedCompartmentTypes;
/** The modified rules. */
private List modifiedRules;
/** The modified functions. */
private List modifiedFunctions;
/** The modified constraints. */
private List modifiedConstraints;
/** The modified events. */
private List modifiedEvents;
/** The modified initial assignments. */
private List modifiedInitialAssignments;
/** The modified units. */
private List modifiedUnits;
/**
* Instantiates a new sBML diff report.
*/
public SBMLDiffReport ()
{
header = "";
modifiedSpecies = new ArrayList ();
modifiedSpeciesTypes = new ArrayList ();
modifiedParameter = new ArrayList ();
modifiedReactions = new ArrayList ();
modifiedCompartments = new ArrayList ();
modifiedCompartmentTypes = new ArrayList ();
modifiedRules = new ArrayList ();
modifiedFunctions = new ArrayList ();
modifiedConstraints = new ArrayList ();
modifiedEvents = new ArrayList ();
modifiedInitialAssignments = new ArrayList ();
modifiedUnits = new ArrayList ();
}
/**
* Generate html report.
*
* @return the string
*/
public String generateHTMLReport ()
{
String report = "Diff Report
Please keep in mind that these modifications are choosen by what we think is important!
"+header+"
";
report += generateTable (modifiedSpecies, "Following Species were modified", "species");
report += generateTable (modifiedSpeciesTypes, "Following SpeciesTypes were modified", "speciestypes");
report += generateTable (modifiedParameter, "Following Parameter were modified", "parameter");
report += generateTable (modifiedReactions, "Following Reactions were modified", "reaction");
report += generateTable (modifiedCompartments, "Following Compartments were modified", "compartment");
report += generateTable (modifiedCompartmentTypes, "Following CompartmentTypes were modified", "compartmenttype");
report += generateTable (modifiedUnits, "Following Units were modified", "unit");
report += generateTable (modifiedRules, "Following Rules were modified", "rule");
report += generateTable (modifiedFunctions, "Following Functions were modified", "function");
report += generateTable (modifiedConstraints, "Following Constraints were modified", "constraint");
report += generateTable (modifiedEvents, "Following Events were modified", "event");
report += generateTable (modifiedInitialAssignments, "Following InitialAssignments were modified", "initialssignment");
return report;
}
/**
* Generate table.
*
* @param mods the mods
* @param headline the headline
* @param cssclass the cssclass
* @return the string
*/
private String generateTable (List mods, String headline, String cssclass)
{
if (mods.size () < 1)
return "";
String rep = "";
for (String mod: mods)
rep += mod;
if (rep.length () < 1)
return "";
return ""+headline+"
" +
"ID (name) Modification " + rep + "
";
}
/**
* Adds the header.
*
* @param header the header
*/
public void addHeader (String header)
{
this.header += header;
}
/**
* Modify species.
*
* @param rep the rep
*/
public void modifySpecies (String rep)
{
modifiedSpecies.add (rep);
}
/**
* Modify species types.
*
* @param rep the rep
*/
public void modifySpeciesTypes (String rep)
{
modifiedSpeciesTypes.add (rep);
}
/**
* Modify parameter.
*
* @param rep the rep
*/
public void modifyParameter (String rep)
{
modifiedParameter.add (rep);
}
/**
* Modify reaction.
*
* @param rep the rep
*/
public void modifyReaction (String rep)
{
modifiedReactions.add (rep);
}
/**
* Modify compartments.
*
* @param rep the rep
*/
public void modifyCompartments (String rep)
{
modifiedCompartments.add (rep);
}
/**
* Modify compartment types.
*
* @param rep the rep
*/
public void modifyCompartmentTypes (String rep)
{
modifiedCompartmentTypes.add (rep);
}
/**
* Modify rules.
*
* @param rep the rep
*/
public void modifyRules (String rep)
{
modifiedRules.add (rep);
}
/**
* Modify functions.
*
* @param rep the rep
*/
public void modifyFunctions (String rep)
{
modifiedFunctions.add (rep);
}
/**
* Modify contraints.
*
* @param rep the rep
*/
public void modifyContraints (String rep)
{
modifiedConstraints.add (rep);
}
/**
* Modify events.
*
* @param rep the rep
*/
public void modifyEvents (String rep)
{
modifiedEvents.add (rep);
}
/**
* Modify initial assignments.
*
* @param rep the rep
*/
public void modifyInitialAssignments (String rep)
{
modifiedInitialAssignments.add (rep);
}
/**
* Modify units.
*
* @param rep the rep
*/
public void modifyUnits (String rep)
{
modifiedUnits.add (rep);
}
}