test_class.declarator: topicmap
test_class.modifier: private
test_class.original_string: private TopicMapIF topicmap;
test_class.type: TopicMapIF
test_class.var_name: topicmap
test_class.declarator: topic
test_class.modifier: private
test_class.original_string: private TopicIF topic;
test_class.type: TopicIF
test_class.var_name: topic
test_class.declarator: untyped
test_class.modifier: private
test_class.original_string: private TopicNameIF untyped;
test_class.type: TopicNameIF
test_class.var_name: untyped
test_class.declarator: untyped_scoped
test_class.modifier: private
test_class.original_string: private TopicNameIF untyped_scoped;
test_class.type: TopicNameIF
test_class.var_name: untyped_scoped
test_class.declarator: typed
test_class.modifier: private
test_class.original_string: private TopicNameIF typed;
test_class.type: TopicNameIF
test_class.var_name: typed
test_class.declarator: typed_scoped
test_class.modifier: private
test_class.original_string: private TopicNameIF typed_scoped;
test_class.type: TopicNameIF
test_class.var_name: typed_scoped
test_class.declarator: scope
test_class.modifier: private
test_class.original_string: private TopicIF scope;
test_class.type: TopicIF
test_class.var_name: scope
test_class.file: ontopia-engine/src/test/java/net/ontopia/topicmaps/utils/TopicNameComparatorTest.java
test_class.identifier: TopicNameComparatorTest
test_case.body: @Test
    public void testIssue439() {
      TopicMapIF tm = new InMemoryTopicMapStore().getTopicMap();
      TopicIF topic = tm.getBuilder().makeTopic();
      TopicNameIF name1 = tm.getBuilder().makeTopicName(topic, topic, "value1");
      TopicNameIF name2 = tm.getBuilder().makeTopicName(topic, topic, "value2");
      Assert.assertEquals(-1, new TopicNameComparator(Collections.EMPTY_LIST).compare(name1, name2));
    }
test_case.class_method_signature: TopicNameComparatorTest.testIssue439()
test_case.full_signature: @Test public void testIssue439()
test_case.identifier: testIssue439
test_case.invocations: getTopicMap makeTopic getBuilder makeTopicName getBuilder makeTopicName getBuilder assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIssue439()
focal_class.file: ontopia-engine/src/main/java/net/ontopia/topicmaps/utils/TopicNameComparator.java
focal_class.identifier: TopicNameComparator
focal_class.class_method_signature: TopicNameComparator.TopicNameComparator(Collection<TopicIF> scope)
focal_class.full_signature:   TopicNameComparator(Collection<TopicIF> scope)
focal_class.identifier: TopicNameComparator
focal_class.parameters: (Collection<TopicIF> scope)
focal_class.signature:  TopicNameComparator(Collection<TopicIF> scope)
focal_class.class_method_signature: TopicNameComparator.compare(TopicNameIF o1, TopicNameIF o2)
focal_class.full_signature: @Override public int compare(TopicNameIF o1, TopicNameIF o2)
focal_class.identifier: compare
focal_class.modifiers: @Override public
focal_class.parameters: (TopicNameIF o1, TopicNameIF o2)
focal_class.return: int
focal_class.signature: int compare(TopicNameIF o1, TopicNameIF o2)
focal_class.superclass: extends ScopedIFComparator<TopicNameIF>
focal_method.body: @Override
    public int compare(TopicNameIF o1, TopicNameIF o2) {
      TopicMapIF tm = o1.getTopicMap();
  
      TopicIF t1 = o1.getType();
      TopicIF t2 = o2.getType();
      
      // check for default type
      TopicIF untypedname = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType());
      if (untypedname == null) {
        t1 = null;
        t2 = null;
      } else {
        if (untypedname.equals(t1)) t1 = null;
        if (untypedname.equals(t2)) t2 = null;
      }
  
      // untyped should sort before typed
      if (t1 == null) {
        if (t2 != null) return -1;
      } else {
        if (t2 == null) return 1;
      }
      
      return super.compare(o1, o2);
    }
focal_method.class_method_signature: TopicNameComparator.compare(TopicNameIF o1, TopicNameIF o2)
focal_method.full_signature: @Override public int compare(TopicNameIF o1, TopicNameIF o2)
focal_method.identifier: compare
focal_method.invocations: getTopicMap getType getType getTopicBySubjectIdentifier getSAMNameType equals equals compare
focal_method.modifiers: @Override public
focal_method.parameters: (TopicNameIF o1, TopicNameIF o2)
focal_method.return: int
focal_method.signature: int compare(TopicNameIF o1, TopicNameIF o2)