Skip to content
Snippets Groups Projects
Commit 1a11a841 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

new constructors added (with reaction id arg)

parent d2c2cd10
No related branches found
No related tags found
1 merge request!186Resolve "upload of sbml"
......@@ -261,6 +261,10 @@ public class Reaction implements BioEntity {
}
public Reaction(String reactionId) {
setIdReaction(reactionId);
}
/**
* Adds node to the reaction.
*
......
......@@ -18,51 +18,57 @@ import lcsb.mapviewer.model.map.reaction.Reaction;
@DiscriminatorValue("TRANSPORT_REACTION")
public class TransportReaction extends Reaction implements SimpleReactionInterface {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public TransportReaction() {
super();
}
/**
* Default constructor.
*/
public TransportReaction() {
super();
}
/**
* Constructor that copies data from the parameter given in the argument.
*
* @param result
* parent reaction from which we copy data
*/
public TransportReaction(Reaction result) {
super(result);
if (result.getProducts().size() < 1) {
throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0");
}
if (result.getReactants().size() < 1) {
throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0");
}
}
/**
* Constructor that copies data from the parameter given in the argument.
*
* @param result
* parent reaction from which we copy data
*/
public TransportReaction(Reaction result) {
super(result);
if (result.getProducts().size() < 1) {
throw new InvalidArgumentException(
"Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0");
}
if (result.getReactants().size() < 1) {
throw new InvalidArgumentException(
"Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0");
}
}
@Override
public String getStringType() {
return "Transport";
}
public TransportReaction(String reactionId) {
super(reactionId);
}
@Override
public ReactionRect getReactionRect() {
return ReactionRect.RECT_EMPTY;
}
@Override
public String getStringType() {
return "Transport";
}
@Override
public TransportReaction copy() {
if (this.getClass() == TransportReaction.class) {
return new TransportReaction(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
@Override
public ReactionRect getReactionRect() {
return ReactionRect.RECT_EMPTY;
}
@Override
public TransportReaction copy() {
if (this.getClass() == TransportReaction.class) {
return new TransportReaction(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment