From: Xuan B. <med...@us...> - 2007-04-30 13:54:07
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/ozone In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29754/src/org/tm4j/topicmap/ozone Modified Files: OzoneTopicImpl.java OzoneTopicMapImpl.java OzoneTopicMapObjectImpl.java Log Message: Convert concrete ID comparisons to more abstracted call equalsByID(). Index: OzoneTopicMapImpl.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/ozone/OzoneTopicMapImpl.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** OzoneTopicMapImpl.java 7 Oct 2004 09:35:47 -0000 1.58 --- OzoneTopicMapImpl.java 30 Apr 2007 13:53:12 -0000 1.59 *************** *** 254,258 **** Topic t = ((Topic)o).getBaseTopic(); ! if (!t.getID().equals(ret.getID()) && !t.getMergedTopics().contains(ret)) { t.addMergedTopic(ret); --- 254,258 ---- Topic t = ((Topic)o).getBaseTopic(); ! if (!t.equalsByID(ret) && !t.getMergedTopics().contains(ret)) { t.addMergedTopic(ret); *************** *** 289,293 **** // which cause merges. To avoid merging the topic with itself, check the returned // topic id. ! if (t.getID().equals(ret.getID())) { continue; } --- 289,293 ---- // which cause merges. To avoid merging the topic with itself, check the returned // topic id. ! if (t.equalsByID(ret)) { continue; } *************** *** 311,315 **** Topic t = (Topic) m_topicsByScopedName.get(scName); t = t.getBaseTopic(); ! if (t.getID().equals(topic.getBaseTopic().getID())) { continue; } --- 311,315 ---- Topic t = (Topic) m_topicsByScopedName.get(scName); t = t.getBaseTopic(); ! if (t.equalsByID(topic.getBaseTopic())) { continue; } *************** *** 614,618 **** m_topicsBySubject.containsKey(oldSubject.getAddress())) { Topic t = (Topic) m_topicsBySubject.get(oldSubject.getAddress()); ! if (t.getID() == topic.getID()) { m_topicsBySubject.remove(oldSubject.getAddress()); } --- 614,618 ---- m_topicsBySubject.containsKey(oldSubject.getAddress())) { Topic t = (Topic) m_topicsBySubject.get(oldSubject.getAddress()); ! if (t.getID() == topic.getID()) { // REVIEW: What's that? We do not compare by value, we compare by pointer? m_topicsBySubject.remove(oldSubject.getAddress()); } *************** *** 636,640 **** Topic t = (Topic) m_topicsByScopedName.get(scopedName); ! if ((t != null) && (t.getID().equals(topic.getID()))) { m_topicsByScopedName.remove(scopedName); } --- 636,640 ---- Topic t = (Topic) m_topicsByScopedName.get(scopedName); ! if ((t != null) && (t.equalsByID(topic))) { m_topicsByScopedName.remove(scopedName); } *************** *** 653,657 **** Topic t = (Topic) m_topicsBySubjectIndicator.get(indicator.getAddress()); ! if ((t != null) && t.getID().equals(topic.getID())) { m_topicsBySubjectIndicator.remove(indicator.getAddress()); } --- 653,657 ---- Topic t = (Topic) m_topicsBySubjectIndicator.get(indicator.getAddress()); ! if ((t != null) && t.equalsByID(topic)) { m_topicsBySubjectIndicator.remove(indicator.getAddress()); } Index: OzoneTopicImpl.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/ozone/OzoneTopicImpl.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** OzoneTopicImpl.java 8 Dec 2004 10:50:59 -0000 1.62 --- OzoneTopicImpl.java 30 Apr 2007 13:53:12 -0000 1.63 *************** *** 136,140 **** if (getTopicMap().getBaseLocator() == null) { if (other.getTopicMap().getBaseLocator() == null) { ! return (getID().compareTo(other.getID()) == 0); } else { return false; --- 136,141 ---- if (getTopicMap().getBaseLocator() == null) { if (other.getTopicMap().getBaseLocator() == null) { ! // return (getID().compareTo(other.getID()) == 0); ! return (equalsByID(other)); } else { return false; *************** *** 149,153 **** if (comp == 0) { ! return (getID().compareTo(other.getID()) == 0); } else { return false; --- 150,155 ---- if (comp == 0) { ! // return (getID().compareTo(other.getID()) == 0); ! return (equalsByID(other)); } else { return false; *************** *** 1251,1255 **** return; } ! if (mergedTopic.getID().equals(getID())) { m_log.error("Detected an attempt to merge the topic: " + getID() + " with itself."); --- 1253,1257 ---- return; } ! if (mergedTopic.equalsByID(this)) { m_log.error("Detected an attempt to merge the topic: " + getID() + " with itself."); *************** *** 1303,1307 **** } ! if (merged.getID().equals(getID())) { return; } --- 1305,1309 ---- } ! if (merged.equalsByID(this)) { return; } Index: OzoneTopicMapObjectImpl.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/ozone/OzoneTopicMapObjectImpl.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** OzoneTopicMapObjectImpl.java 30 Apr 2007 13:35:22 -0000 1.35 --- OzoneTopicMapObjectImpl.java 30 Apr 2007 13:53:13 -0000 1.36 *************** *** 132,136 **** /** */ ! public boolean equalsByID(TopicMapObject o) { return getID().equals(o.getID()); } --- 132,136 ---- /** */ ! public boolean equalsByID(org.tm4j.topicmap.TopicMapObject o) { return getID().equals(o.getID()); } |