Skip to main content

Re: Add five methods in Quantity interface[Proposal]

  • From: Werner Keil < >
  • To:
  • Subject: Re: Add five methods in Quantity interface[Proposal]
  • Date: Sat, 1 Nov 2014 11:26:48 +0100

Calendar and LocalTime are not comparable.
Don't recall the package, but you have a "calendar" equivalent in 310.
System.currentTimeInMillis() was always there, LocalTime.now() is one of
several redundant copies of it in 310.
There's *Time, *Date, Duration and Period (which effectively solve almost
the same problem, JavaFX got just one, ICU4J has the TimeUnitAmount for
that and a rather poiwerful Holiday API, 310 didn't even bother offering an
SPI for;-) Instant or Clock, a big mess of implementation level classes.

Each with a very unique set of differently named methods and convenience
factories. Just like e.g. BigDecimal vs. BigInteger;-)

354 is much cleaner and extensible, but some methods may be too specific
and seem redundant outside the financial domain.

Werner
Am 01.11.2014 10:24 schrieb "Otávio Gonçalves de Santana" <
>:

> 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]

(continued)

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

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 11/01/2014

Re: Add five methods in Quantity interface[Proposal]

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