commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zigler zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-525) PatriciaTrie
Date Sat, 10 May 2014 22:16:38 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13993528#comment-13993528
] 

zigler zhang commented on COLLECTIONS-525:
------------------------------------------

I'm afraid there are two other places make the same mistake:
in PrefixRangeEntrySet iterator

   } else if (delegate.lengthInBits >= prefixStart.bitIndex) {

and in subtree:

  if (current.bitIndex <= path.bitIndex || lengthInBits <= current.bitIndex) {

the former one and the second judgement of the second should both eliminate '='

the test code as below:
		PatriciaTrie<String> aTree2 = new PatriciaTrie<String> ();
		aTree2.put("点评", "联盟");
		aTree2.put("点版", "定向");
		System.out.println(aTree2.prefixMap("点").values());


> PatriciaTrie
> ------------
>
>                 Key: COLLECTIONS-525
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-525
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>    Affects Versions: 4.0
>         Environment: android
>            Reporter: zigler zhang
>            Priority: Critical
>         Attachments: 525.patch
>
>
>  the result of trie tree prefixMap function is inconsistent. it would contain a key but
the size is 0;
> some unittest codes as below: 
>   PatriciaTrie<String> aTree =
>         new PatriciaTrie<String> ();
>     aTree.put("点评", "测试");
>     aTree.put("书评", "测试");
>     assertTrue(aTree.prefixMap("点").containsKey("点评")); //pass
>     assertEquals("测试", aTree.prefixMap("点").get("点评")); //pass
>     assertFalse(aTree.prefixMap("点").isEmpty());                 //fail
>     assertEquals(1, aTree.prefixMap("点").size());                 //fail actural 0
>     assertEquals(1, aTree.prefixMap("点").keySet().size());   //fail actural 0
>     assertEquals(1, aTree.prefixMap("点").entrySet().size()); //fail actural 0
>     assertEquals(1, aTree.prefixMap("点评").values().size()); //fail actural 0



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message