Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3B9692F1 for ; Sun, 12 Feb 2012 22:44:06 +0000 (UTC) Received: (qmail 68915 invoked by uid 500); 12 Feb 2012 22:44:06 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 68795 invoked by uid 500); 12 Feb 2012 22:44:05 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 68787 invoked by uid 99); 12 Feb 2012 22:44:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Feb 2012 22:44:05 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simone.tripodi@gmail.com designates 209.85.216.50 as permitted sender) Received: from [209.85.216.50] (HELO mail-qw0-f50.google.com) (209.85.216.50) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Feb 2012 22:44:01 +0000 Received: by qabg27 with SMTP id g27so10531466qab.9 for ; Sun, 12 Feb 2012 14:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=atLXtWHYTP03sstrxLKinTIB4Lg1hMarjW+B9l7cIBo=; b=ItQGOIKqB4Q9b0aWbKcXu/MBM87isr2/sDqUZe5CWibVTtZueqtsVhamD5+objpAXG N8BvAH9H4T/nuAXUqmXhkB0HX48LDwJIH0vkboXIChZu2yM2FTgLSEfXFhRWHJm1kNFy ixp9vB0Stvyd6KO0y9XJClq4xqDgnliGD8HPw= MIME-Version: 1.0 Received: by 10.229.78.215 with SMTP id m23mr7519189qck.93.1329086620155; Sun, 12 Feb 2012 14:43:40 -0800 (PST) Sender: simone.tripodi@gmail.com Received: by 10.224.195.73 with HTTP; Sun, 12 Feb 2012 14:43:40 -0800 (PST) In-Reply-To: <4F383F03.2020402@dia.uniroma3.it> References: <4EDC0593.5070200@dia.uniroma3.it> <49628.31.191.72.0.1324659757.squirrel@email.dia.uniroma3.it> <4F09D48E.6010905@dia.uniroma3.it> <4F0EBF67.7040900@dia.uniroma3.it> <41C26625-224D-4F54-9DCE-A8695CB0FD74@gmail.com> <4F37EA93.6050807@dia.uniroma3.it> <4F381F1B.1030602@dia.uniroma3.it> <8528DD9A-521A-4921-B935-0A8B69EB715A@gmail.com> <4F383F03.2020402@dia.uniroma3.it> Date: Sun, 12 Feb 2012 23:43:40 +0100 X-Google-Sender-Auth: R7rTA8rlNBU8YEELb5uZb1Lmmdw Message-ID: Subject: Re: [Graph] On graph weight type(s) From: Simone Tripodi To: Commons Developers List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hola Claudio, the patch you mentioned was something I would have asked you, before or lat= er :P Since we are on topic: is there any particular reason why Zero.zero() can not be part of Semigroup interface? Or better: is there any benefit we can get from keeping Zero and Semigroup separated? TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sun, Feb 12, 2012 at 11:36 PM, Claudio Squarcella wrote: > Hi, > > >>> * the mapping between primitive types and their respective default >>> =C2=A0 *Operations is known and kept somewhere (abstract class, etc); >>> * each algorithm specifies only once the set of primitive types that >>> =C2=A0 it accepts; >>> * with a bit of magic (?) we combine the above to provide shortcuts to >>> =C2=A0 the user. >> >> +1 >> >> I think that a mapper can be useful. >> we can create a default mapper between primitives and *Operations and ad= d >> a void API like that >> findMaxFlow( graph ).from( a ).to( g ).applying( void ). >> we can choose the correct Operation mappimng directly on the default >> constructor using our mapper. >> >> so for the primitives Integer, Double etc, the user doesn't =C2=A0have t= o >> specify anything. > > > I thought about something similar. But I finally see two downsides: > > =C2=A0* we would need to use reflection for generics or some better > =C2=A0 alternative to actually understand the generic type of weight and > =C2=A0 map it to the appropriate *Operations, > =C2=A0* we should throw an exception when non-primitive weights are > =C2=A0 incorrectly passed without a handler. > > Now that I have a clearer picture in mind I'm almost convinced to give up= ... > > Anyway, expect a patch soon from me that at least incorporates suggestion= s > on new names for primitive implementations and variable names ;) > > Ciao, > > Claudio > > -- > Claudio Squarcella > PhD student at Roma Tre University > http://www.dia.uniroma3.it/~squarcel > http://squarcella.com/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org