You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Claudio Squarcella (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/03/03 18:13:57 UTC
[jira] [Issue Comment Edited] (SANDBOX-404) Simplify weight model
[ https://issues.apache.org/jira/browse/SANDBOX-404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221645#comment-13221645 ]
Claudio Squarcella edited comment on SANDBOX-404 at 3/3/12 5:13 PM:
--------------------------------------------------------------------
Hi Simo,
good that you moved discussion here so that we can focus.
I don't know if I got your question correctly, but I have answers for both interpretations :)
* _what if our class has to implement two different kinds of Monoid (e.g. Addition and Multiplication)?_ I propose to convert our current {{Monoid}} to {{Addition}} to represent the sum operation (which indeed is how we use it right know). Then we can add {{Multiplication}} as a completely separate interface, without the need to be backed by the same "abstract monoid" (although, of course, theory tells us that they are both monoids):
{code}
public class DoubleOperations
implements Addition, Comparator, Multiplication
{
...
}
{code}
* _what if our class has to be not just a Monoid, but also something else?_ Then we simply add a new interface. I am already thinking of clearly separating {{Monoid}}/{{Addition}} from {{Comparator}} (see code snippet above). Algorithms can still enumerate all properties/operations they need, for example:
{code}
public <WO extends Addition<W> & Comparator<W>> HeuristicBuilder<V, WE, W, G, WO> applyingAStar( WO weightOperations )
{
...
}
{code}
Ciao
Claudio
was (Author: claudio.squarcella):
Hi Simo,
good that you moved discussion here so we can focus.
I don't know if I got your question correctly, but I have answers for both interpretations :)
* _what if our class has to implement two different kinds of Monoid (e.g. Addition and Multiplication)?_ I propose to convert our current {{Monoid}} to {{Addition}} to represent the sum operation (which indeed is how we use it right know). Then we can add {{Multiplication}} as a completely separate interface, without the need to be backed by the same "abstract monoid" (although, of course, theory tells us that they are both monoids):
* _what if our class has to be not just a Monoid, but also something else?_ Then we simply add a new interface. I am already thinking of clearly separating {{Monoid}}/{{Addition}} from {{Comparator}}
> Simplify weight model
> ---------------------
>
> Key: SANDBOX-404
> URL: https://issues.apache.org/jira/browse/SANDBOX-404
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: Graph
> Reporter: Simone Tripodi
> Attachments: SANDBOX-404.patch
>
>
> As discussed on {{dev@}}, {{Zero}}, {{Semigroup}} and {{Monoid}} can be merged directly in one single interface
--
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