[threeten-dev] [threeten-develop] Rough draft of TemporalAmount

Roger Riggs Roger.Riggs at oracle.com
Fri Jan 25 07:21:26 PST 2013


Hi,

On 1/25/2013 10:02 AM, Stephen Colebourne wrote:
> On 25 January 2013 14:48, Roger Riggs<Roger.Riggs at oracle.com>  wrote:
>> On 1/24/2013 7:31 PM, Stephen Colebourne wrote:
>> The Amount interface has two different kinds of<hn>  tag on
>> addTo/subtractFrom.
>>
>> I didn't see the difference, these are retained from adder/subtractor
> Looks like they are both<h3>  but the output Javadoc shows them
> differently. Weird.
No too puzzling,  I generated the javadoc using the custom 
stylesheet.css that we/you modified
to highlight the implementation notes.
The SE 8 javadoc has done a revamp of the stylesheet.
I'll revert the handy ant javadoc creator task to use the default 
stylesheet and remove
the custom one..
>> I think its an interesting question as to whether the units of period are
>> y/m/d/h/m/s/n or  y/m/d/nanos. The latter is the minimum set of data, and
>> better describes the internals, but might make a formatter harder to write.
>> I guess a user might assume h/m/s/n, so maybe its OK how it is.
>>
>> Period provides methods for all of those components and it seems
>> reasonable that
>> the same would be available as fields.  For example, MICROS, MILLIS,
>> HALF_DAYS;
>> but for some units it would need to define rounding/truncation.
>> The plus and minus methods go further and support any timeunit that is
>> not estimated.   If plus/minus are going to support the richer set of
>> units perhaps
>> get should also. But then at the moment a simpler is better (quicker).
>>
>> It is possible to convert to any arbitrary extensible unit through the use
>> of TemporalUnit.getDuration.  Though this would apply only to SimplePeriod.
> I think that the conversions lead us to implement more code now, code
> that we don't really know enough about. For example Duration would
> also have to support MILLIS/MICROS etc.
>
> So, the simplest option is
> Duration = SECONDS + NANOS
> Period + YEARS + MONTHS + DAYS + NANOS
The javadoc for Period describes itself has supporting the most commonly 
used units
including "time units with an exact duration".  To be consistent 
get(unit) should follow
that pattern.

The Period supplying y/m/d/h/m/s/n is trivial and already implemented 
and tested.

Roger

> We can add additional conversions in JDK 1.9 if the javadoc is careful.
>
> Stephen
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> threeten-develop mailing list
> threeten-develop at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/threeten-develop

-- 
Thanks, Roger

Oracle Java Platform Group

Green Oracle <http://www.oracle.com/commitment> Oracle is committed to 
developing practices and products that help protect the environment



More information about the threeten-dev mailing list