Skip to main content

Re: Add five methods in Quantity interface[Proposal]

  • From: Otávio Gonçalves de Santana < >
  • To:
  • Subject: Re: Add five methods in Quantity interface[Proposal]
  • Date: Sat, 1 Nov 2014 07:23:10 -0200

Martin, using the compareto method is really simple to make this.
About why create this method, is because we are in DSL age, to make our
code more expressive.
For example if you look new API how the JSR 310, it is not using
getInstance how the old API, but .now to create a instance in the exact
moment.

I believe is more expressive use:

Calendar calendar = Calendar.getInstance();
LocalTime time = LocalTime.now();

Talking about this JSR, it has comparative method, so the JSR 354 has too.

http://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html
http://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
http://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html



On Sat, Nov 1, 2014 at 12:56 AM, Martin Desruisseaux <
>
 wrote:

>  Le 01/11/14 04:36, Otávio Gonçalves de Santana a écrit :
>
>  I would like to propose to add four new comparatives methods in Quantity
> interface:
>
>    -   boolean isGreaterThan(Quantity<T> quantity);
>     -   boolean isGreaterThanOrEqualTo(Quantity<T> quantity);
>     -   boolean isLessThan(Quantity<T> quantity);
>     -   boolean isLessThanOrEqualTo(Quantity<T> quantity);
>     -   boolean isEquivalentTo(Quantity<T> quantity);
>
>   Why not just implement the int compareTo(Quantity<Q>) method that we
> could inherit from the Comparable interface instead? But I agree with
> Werner, we need to sort out the Measurement - Quantity relationship first.
>
>     Martin
>
>


-- 
Otávio Gonçalves de Santana

blog:     http://otaviosantana.blogspot.com.br/
twitter: http://twitter.com/otaviojava
site:     *http://about.me/otaviojava ;<http://about.me/otaviojava>*
55 (11) 98255-3513


Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 11/01/2014

<Possible follow-up(s)>

Re: Add five methods in Quantity interface[Proposal]

Martin Desruisseaux 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Martin Desruisseaux 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Martin Desruisseaux 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Martin Desruisseaux 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Martin Desruisseaux 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 11/01/2014
 
 
Close
loading
Please Confirm
Close