Ejemplo n.º 1
0
 public static void main(String[] args) {
   DBHelper helper = new DBHelper("databases/timeline.db");
   TLEvent event1 = new Atomic("one", "", new Date(((long) 1000) * 60 * 60 * 24));
   TLEvent event2 =
       new Duration(
           "two",
           "",
           new Date(((long) 1000) * 60 * 60 * 24),
           new Date(((long) 1000) * 60 * 60 * 24 * 2));
   Timeline test1 = new Timeline("Test1", 0);
   Timeline test2 = new Timeline("Test2", 2);
   test1.addEvent(event1);
   test1.addEvent(event2);
   helper.removeTimeline(test1);
   helper.removeTimeline(test2);
   helper.writeTimeline(test1);
   helper.writeTimeline(test2);
   helper.removeTimeline(test1);
   helper.changeTimeline(test2, test1);
   Timeline[] timelines = helper.getTimelines();
   for (Timeline timeline : timelines) {
     System.out.println("-----" + timeline.getName() + "-----");
     TLEvent[] events = timeline.getEvents();
     for (TLEvent event : events) {
       System.out.println(event.getName());
     }
   }
   System.out.println("Finished!");
 }
Ejemplo n.º 2
0
 @Override
 public Timeline changeTimeline(Timeline oldTimeline, Timeline newTimeline) {
   removeTimeline(oldTimeline);
   writeTimeline(newTimeline);
   return newTimeline;
 }