diff --git a/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java b/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java index 12f8c4b232906c4e05251737a0d396622d9e1b1d..d9dc99567b03f6d4552bad1f882440446dedbb06 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java @@ -226,7 +226,9 @@ public class MiriamData implements Comparable<MiriamData>, Serializable { @Override public int compareTo(MiriamData other) { - return ((dataType + ":" + resource).toLowerCase().compareTo((other.dataType + ":" + other.resource).toLowerCase())); + String name = annotator != null ? annotator.getName() : ""; + String otherName = other.annotator != null ? other.annotator.getName() : ""; + return (dataType + ":" + resource + ":" + name).toLowerCase().compareTo((other.dataType + ":" + other.resource + ":" + otherName).toLowerCase()); } /** @@ -279,16 +281,6 @@ public class MiriamData implements Comparable<MiriamData>, Serializable { public void setRelationType(MiriamRelationType relationType) { this.relationType = relationType; } - - @Override - public String toString() { - if (relationType != null) { - return "[" + relationType.getStringRepresentation() + "] " + dataType + ":" + resource; - } else { - return "[UNKNOWN] " + dataType + ":" + resource; - - } - } /** * @@ -305,4 +297,15 @@ public class MiriamData implements Comparable<MiriamData>, Serializable { public void setAnnotator(Class<?> annotator) { this.annotator = annotator; } + + @Override + public String toString() { + String annotatorClass = annotator != null ? ":" +annotator.getName() : ""; + if (relationType != null) { + return "[" + relationType.getStringRepresentation() + "] " + dataType + ":" + resource + annotatorClass; + } else { + return "[UNKNOWN] " + dataType + ":" + resource + annotatorClass; + + } + } } diff --git a/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java b/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java index 06ca17f86f8cd3018cbbfc76145f2d82c06bca77..8e9668360dcf6050fabb6cf0b4330fa88e84459b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java @@ -116,6 +116,17 @@ public class MiriamDataTest { try { MiriamData md = new MiriamData(); assertTrue(md.compareTo(new MiriamData(MiriamType.CAS, "a")) != 0); + + MiriamData md1 = new MiriamData(MiriamType.CAS, "a"); + MiriamData md2 = new MiriamData(MiriamType.CAS, "a"); + assertTrue(md1.compareTo(md2) == 0); + + md1.setAnnotator(Integer.class); + assertTrue(md1.compareTo(md2) != 0); + + md2.setAnnotator(Integer.class); + assertTrue(md1.compareTo(md2) == 0); + } catch (Exception e) { e.printStackTrace(); throw e;