[ImageJ-devel] Priorities

Curtis Rueden ctrueden at wisc.edu
Wed Nov 30 22:13:06 CST 2011


Hi Johannes,

I'd like to change the priorities so that the higher the number, the
> greater the priority.
>

Sounds good. We'll just have to invert the compareTo method in the
AbstractUIDetails class. (All modules and tools are sorted that way.)

I am thinking about imagej.util.Priorities.
>

Maybe imagej.util.Priority, to match some of the enums like WidgetStyle and
ItemVisibility? (Though admittedly, the Priority class wouldn't be an
enum...)

Then I'd like to introduce a SortByPriority helper class that takes an
> Iterator<T> as parameter to the constructor and a helper class that
> determines a priority (type "double") given an instance of T. The
> SortByPriority class then presents itself as an Iterable<T> and outputs
> the items in order of the priority.
>

I was going to say it seemed a bit on the YAGNI side, but we would benefit
from a way to sort IPluginFinders without complicating the interface.
However, I don't understand how that second helper class would determine a
priority from the instance of T. Maybe T must extend a Prioritized
interface with a getPriority method—but that would require IPluginFinder to
implement it, hence complicating the interface. Perhaps your proposed patch
to PluginService is good enough?

Regards,
Curtis


On Wed, Nov 30, 2011 at 5:13 PM, Johannes Schindelin <schindelin at wisc.edu>wrote:

> Hi all,
>
> I see that the top priority in imagej.ext.plugin.Plugin is defined as
> negative infinity. That's a bit counter-intuitive to me. I'd like to
> change the priorities so that the higher the number, the greater the
> priority.
>
> Then I'd like to define a new class which has constants for these
> priorities. I am thinking about imagej.util.Priorities.
>
> Then I'd like to introduce a SortByPriority helper class that takes an
> Iterator<T> as parameter to the constructor and a helper class that
> determines a priority (type "double") given an instance of T. The
> SortByPriority class then presents itself as an Iterable<T> and outputs
> the items in order of the priority.
>
> Objections?
>
> Ciao,
> Johannes
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagejdev.org
> http://imagejdev.org/mailman/listinfo/imagej-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20111130/a4d46673/attachment.html>


More information about the ImageJ-devel mailing list