Commit ee212394 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

epsilon in comparison wasn't used everywhere...

parent bf4d06ce
......@@ -29,7 +29,7 @@ public class ModelComparator extends Comparator<Model> {
/**
* Default class logger.
*/
private static Logger logger = LogManager.getLogger(ModelComparator.class);
private static Logger logger = LogManager.getLogger();
/**
* Epsilon value used for comparison of doubles.
......@@ -38,7 +38,7 @@ public class ModelComparator extends Comparator<Model> {
private SetComparator<SbmlUnit> unitSetComparator = new SetComparator<>(new SbmlUnitComparator());
private SetComparator<Reaction> reactionSetComparator = new SetComparator<>(new ReactionComparator(epsilon));
private SetComparator<Reaction> reactionSetComparator;
private ElementUtils eu = new ElementUtils();
......@@ -51,6 +51,7 @@ public class ModelComparator extends Comparator<Model> {
public ModelComparator(double epsilon) {
super(Model.class);
this.epsilon = epsilon;
reactionSetComparator = new SetComparator<>(new ReactionComparator(epsilon));
}
/**
......
......@@ -88,7 +88,7 @@ public class ComplexComparator extends Comparator<Complex> {
}
}
StructuralStateComparator structuralStateComparator = new StructuralStateComparator();
StructuralStateComparator structuralStateComparator = new StructuralStateComparator(epsilon);
if (structuralStateComparator.compare(arg0.getStructuralState(), arg1.getStructuralState()) != 0) {
logger
......
......@@ -59,7 +59,7 @@ public class ProteinComparator extends Comparator<Protein> {
@Override
protected int internalCompare(Protein arg0, Protein arg1) {
StructuralStateComparator structuralStateComparator = new StructuralStateComparator();
StructuralStateComparator structuralStateComparator = new StructuralStateComparator(epsilon);
StringSetComparator stringSetComparator = new StringSetComparator();
if (structuralStateComparator.compare(arg0.getStructuralState(), arg1.getStructuralState()) != 0) {
......
......@@ -4,6 +4,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import lcsb.mapviewer.common.Comparator;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.comparator.*;
import lcsb.mapviewer.model.map.MiriamData;
......@@ -15,13 +16,23 @@ import lcsb.mapviewer.model.map.MiriamData;
*/
public class StructuralStateComparator extends Comparator<StructuralState> {
/**
* Epsilon value used for comparison of doubles.
*/
private double epsilon;
private static Logger logger = LogManager.getLogger();
/**
* Default constructor.
*/
public StructuralStateComparator() {
this(Configuration.EPSILON);
}
public StructuralStateComparator(double epsilon) {
super(StructuralState.class);
this.epsilon=epsilon;
}
@Override
......@@ -30,7 +41,7 @@ public class StructuralStateComparator extends Comparator<StructuralState> {
if (stringComparator.compare(arg0.getValue(), arg1.getValue()) != 0) {
return stringComparator.compare(arg0.getValue(), arg1.getValue());
}
PointComparator pointComparator = new PointComparator();
PointComparator pointComparator = new PointComparator(epsilon);
if (pointComparator.compare(arg0.getPosition(), arg1.getPosition()) != 0) {
logger.debug("position different: " + arg0.getPosition() + ", " + arg1.getPosition());
return pointComparator.compare(arg0.getPosition(), arg1.getPosition());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment