You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Simone Tripodi (Resolved) (JIRA)" <ji...@apache.org> on 2012/01/22 18:18:39 UTC
[jira] [Resolved] (SANDBOX-364) Adding generic weight type to model
[ https://issues.apache.org/jira/browse/SANDBOX-364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Tripodi resolved SANDBOX-364.
------------------------------------
Resolution: Fixed
Assignee: Simone Tripodi
Thanks once again for your contributions Claudio, really appreciated!
After a first look I was a little in trouble on removing the {{Comparable}} interface from {{WeightedEdge}}, but the super {{Monoid}} fills the gap in a more elegant way - at least, under a Mathematical PoV the new version looks much more elegant!!!
Patch applied, see [r1234551|https://svn.apache.org/viewvc?view=revision&revision=1234551]
I applied just 2 minor modifications to your patch:
* I didn't modify the {{FibonacciHeap}} wich is a general purpose queue;
* I moved the anonymous {{Comparator}} in {{Kruskal}} implementation in a private static inner class
Thanks once again!
-Simo
> Adding generic weight type to model
> ------------------------------------
>
> Key: SANDBOX-364
> URL: https://issues.apache.org/jira/browse/SANDBOX-364
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: Graph
> Reporter: Claudio Squarcella
> Assignee: Simone Tripodi
> Priority: Minor
> Labels: generic, graph, weight, weightededge
> Attachments: AddingGenericWeightTypeToModel.patch
>
>
> Hello,
> with this patch I introduce generic weight types in all the implementations of the domain (mainly classes in the {{model}} packages both in {{main}} and {{test}}). Consequently I updated tests and references to be fully generic.
> One side effect is that {{WeightedEdge}} does not implement {{Comparable}} anymore, because that would imply passing it a {{Comparator}} for weights as an argument upon creation. Instead, without polluting {{WeightedEdge}}, I changed the classes where it was needed to be {{Comparable}} (e.g. in {{Kruskal}} there is a {{PriorityQueue}} that is now initialized with an appropriate {{Comparator}} instead of relying on {{Comparable}} edges).
> All tests are green. Hoping to help :-)
> Claudio
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira