Will
Will

Reputation: 1622

What exists in terms of a Java 'timeline' library?

I am interested in any library which can do the following:

I have a time range: let's say 1995 to 2010 which I can classify in some way, let's say as "The Internet Era".
I then want to be able to break that up further, say 2001-2010 as "The Google Era".

Ideally, I'd like the time line to exist as some sort of list of timespans objects (or an object with a start and end date), one for each era. So after these two add operations, it would look like:

1995-2000 - The Internet Era (the end date is truncated so as to not overlap)

2001-2010 - The Google Era

Upvotes: 0

Views: 721

Answers (3)

Bill K
Bill K

Reputation: 62769

A simple set "Event" of objects with a start & end time (Using Joda perhaps?) and description should be a good start.

Drop them into a Timeline container that sorts them by start time, then running through the events should give you the data you want in any manner you require.

Sometimes solutions are so straight-forward that writing a generic library for them will actually detract from your solution--it would just mask your storage structure, stick you with a non-optimal format and not really hide much code at all.

Upvotes: 1

Jack
Jack

Reputation: 133577

I would say (as usually ) Joda Time, you should look inside their key concepts onto the web-page to see if one or a combination of more is suitable for your needs.

Upvotes: 1

Aravind Yarram
Aravind Yarram

Reputation: 80176

i suggest you look at the joda-time library, specifically Duration and Interval classes

Upvotes: 1

Related Questions