karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Łukasz Dywicki <l...@code-house.org>
Subject RE: svn commit: r1064126 - /karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/completer/StringsCompleter.java
Date Thu, 27 Jan 2011 14:38:18 GMT
Hi,
After talk on irc we agree with Guillaume to change getStrings method
signature from Collection<String> to SortedSet<String> to avoid re-creating
unnecessary sets in complete method. This will allow StringCompleter
extensions to manage own values and safe performance like it was in previous
implementation.

Best reagards,
Lukasz



-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Thursday, January 27, 2011 3:10 PM
To: dev@karaf.apache.org; ldywicki@apache.org
Subject: Re: svn commit: r1064126 -
/karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/com
pleter/StringsCompleter.java

Could that be refactored a bit to avoid the performance loss caused by
re-creating a sorted set  each time the completer is invoked ?

On Thu, Jan 27, 2011 at 15:06,  <ldywicki@apache.org> wrote:
> Author: ldywicki
> Date: Thu Jan 27 14:06:22 2011
> New Revision: 1064126
>
> URL: http://svn.apache.org/viewvc?rev=1064126&view=rev
> Log:
> KARAF-421. Allow StringCompleter extensions to return own strings
>
> Modified:
>  
 karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/comp
leter/StringsCompleter.java
>
> Modified:
karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/compl
eter/StringsCompleter.java
> URL:
http://svn.apache.org/viewvc/karaf/trunk/shell/console/src/main/java/org/apa
che/karaf/shell/console/completer/StringsCompleter.java?rev=1064126&r1=10641
25&r2=1064126&view=diff
>
============================================================================
==
> ---
karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/compl
eter/StringsCompleter.java (original)
> +++
karaf/trunk/shell/console/src/main/java/org/apache/karaf/shell/console/compl
eter/StringsCompleter.java Thu Jan 27 14:06:22 2011
> @@ -81,7 +81,8 @@ public class StringsCompleter
>             buffer = buffer.toLowerCase();
>         }
>
> -        SortedSet<String> matches = strings.tailSet(buffer);
> +        // KARAF-421, use getStrings() instead strings field.
> +        SortedSet<String> matches = new
TreeSet<String>(getStrings()).tailSet(buffer);
>
>         for (String match : matches) {
>             String s = caseSensitive ? match : match.toLowerCase();
>
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com


Mime
View raw message