Skip to content
Snippets Groups Projects
Commit db753e9c authored by piotr.gawron's avatar piotr.gawron
Browse files

remove element from reaction node

parent acd025b3
No related branches found
No related tags found
1 merge request!1Issue 37
......@@ -522,15 +522,6 @@ public class Reaction implements AnnotatedObject {
* @return <code>true</code> if element is part of the reaction,
* <code>false</code> otherwise
*/
public boolean containsElement(Element element) {
for (ReactionNode node : getReactionNodes()) {
if (node.getElement().equals(element)) {
return true;
}
}
return false;
}
public boolean containsElement(Alias alias) {
for (ReactionNode node : getReactionNodes()) {
if (node.getAlias().equals(alias)) {
......
package lcsb.mapviewer.model.map.reaction;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import lcsb.mapviewer.model.map.Element;
import lcsb.mapviewer.model.map.layout.alias.Alias;
/**
* One of two known types of nodes in the {@link Reaction}. It defines input or
* output element of the reaction in the map model. {@link #element} and
* {@link #alias} define which element on the map correspond to this node. There
* are three known subclasses:
* <ul>
* <li> {@link Reactant} - input of the reaction,</li>
* <li> {@link Product} - output of the reaction,</li>
* <li> {@link Modifier} - some modifier of the reaction.</li>
* </ul>
*
*
* @author Piotr Gawron
*
*/
@Entity
@DiscriminatorValue("GENERIC_REACTION_NODE")
public abstract class ReactionNode extends AbstractNode {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* {@link Element} that represents this node in the model.
*/
@ManyToOne
private Element element;
/**
* {@link SpecisAlias} that represents this node in the model.
*/
@ManyToOne
private Alias alias;
/**
* Default constructor.
*/
protected ReactionNode() {
super();
}
/**
* Constructor that creates a copy of the object in the parameter.
*
* @param node
* original node
*/
protected ReactionNode(ReactionNode node) {
super(node);
this.element = node.getElement();
this.alias = node.getAlias();
}
/**
* Constructor that creates node for given {@link #alias} and {@link #element}
* .
*
* @param alias
* {@link Alias} to which this node refer to
* @param element
* {@link Element} to which this node refer to
*/
public ReactionNode(Alias alias, Element element) {
this.alias = alias;
this.element = element;
}
/**
* @return the element
* @see #element
*/
public Element getElement() {
return element;
}
/**
* @param element the element to set
* @see #element
*/
public void setElement(Element element) {
this.element = element;
}
/**
* @return the alias
* @see #alias
*/
public Alias getAlias() {
return alias;
}
/**
* @param alias the alias to set
* @see #alias
*/
public void setAlias(Alias alias) {
this.alias = alias;
}
}
package lcsb.mapviewer.model.map.reaction;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import lcsb.mapviewer.model.map.Element;
import lcsb.mapviewer.model.map.layout.alias.Alias;
/**
* One of two known types of nodes in the {@link Reaction}. It defines input or
* output element of the reaction in the map model. {@link #element} and
* {@link #alias} define which element on the map correspond to this node. There
* are three known subclasses:
* <ul>
* <li> {@link Reactant} - input of the reaction,</li>
* <li> {@link Product} - output of the reaction,</li>
* <li> {@link Modifier} - some modifier of the reaction.</li>
* </ul>
*
*
* @author Piotr Gawron
*
*/
@Entity
@DiscriminatorValue("GENERIC_REACTION_NODE")
public abstract class ReactionNode extends AbstractNode {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* {@link SpecisAlias} that represents this node in the model.
*/
@ManyToOne
private Alias alias;
/**
* Default constructor.
*/
protected ReactionNode() {
super();
}
/**
* Constructor that creates a copy of the object in the parameter.
*
* @param node
* original node
*/
protected ReactionNode(ReactionNode node) {
super(node);
this.alias = node.getAlias();
}
/**
* Constructor that creates node for given {@link #alias} and {@link #element}
* .
*
* @param alias
* {@link Alias} to which this node refer to
* @param element
* {@link Element} to which this node refer to
*/
public ReactionNode(Alias alias, Element element) {
this.alias = alias;
}
/**
* @return the alias
* @see #alias
*/
public Alias getAlias() {
return alias;
}
/**
* @param alias the alias to set
* @see #alias
*/
public void setAlias(Alias alias) {
this.alias = alias;
}
}
......@@ -91,11 +91,6 @@ public class ReactionNodeComparator implements Comparator<ReactionNode> {
return aliasComparator.compare(arg0.getAlias(), arg1.getAlias());
}
if (elementComparator.compare(arg0.getElement(), arg1.getElement()) != 0) {
logger.debug("Element different");
return elementComparator.compare(arg0.getElement(), arg1.getElement());
}
return 0;
}
}
......@@ -86,14 +86,6 @@ public class NodeOperatorComparatorTest {
operator1 = createNodeOperator();
operator2 = createNodeOperator();
Product product = (Product) operator1.getOutputs().get(0);
product.setElement(new GenericProtein());
assertTrue(comparator.compare(operator1, operator2) != 0);
assertTrue(comparator.compare(operator2, operator1) != 0);
operator1 = createNodeOperator();
operator2 = createNodeOperator();
reactant = (Reactant) operator1.getInputs().get(0);
reactant.getAlias().setName("bla");
assertTrue(comparator.compare(operator1, operator2) != 0);
......
......@@ -85,13 +85,6 @@ public class ReactionNodeComparatorTest {
operator1 = createNodeOperator();
operator2 = createNodeOperator();
operator1.setElement(new GenericProtein());
assertTrue(comparator.compare(operator1, operator2) != 0);
assertTrue(comparator.compare(operator2, operator1) != 0);
operator1 = createNodeOperator();
operator2 = createNodeOperator();
operator1.getAlias().setName("bla");
assertTrue(comparator.compare(operator1, operator2) != 0);
assertTrue(comparator.compare(operator2, operator1) != 0);
......
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