source: timeline/src/main/java/geniusweb/progress/ProgressFactory.java@ 24

Last change on this file since 24 was 1, checked in by bart, 5 years ago

Initial Release

File size: 841 bytes
Line 
1package geniusweb.progress;
2
3import java.util.Date;
4
5import geniusweb.deadline.Deadline;
6import geniusweb.deadline.DeadlineRounds;
7import geniusweb.deadline.DeadlineTime;
8
9public class ProgressFactory {
10 /**
11 *
12 * @param deadline the deadline to create a progress for
13 * @param nowms The time as from {@link System#currentTimeMillis()} that
14 * is to be used as start time for the progress.
15 * @return new Progress matching the deadline type.
16 */
17 public static Progress create(Deadline deadline, Long nowms) {
18 if (deadline instanceof DeadlineRounds) {
19 return new ProgressRounds(((DeadlineRounds) deadline).getRounds(),
20 0, new Date(
21 nowms + ((DeadlineRounds) deadline).getDuration()));
22 } else {
23 return new ProgressTime(((DeadlineTime) deadline).getDuration(),
24 new Date(nowms));
25 }
26
27 }
28
29}
Note: See TracBrowser for help on using the repository browser.