Package org.joda.time

Examples of org.joda.time.DateTime.plus()


      duration = Duration.standardHours(1);
    }
   
    // check interval at next half hour
    DateTime firstTimeslot = getNextHalfHour();
    Interval test = new Interval(firstTimeslot, firstTimeslot.plus(duration));
    testInterval(infeasible, preferred, test, solutions);
   
    // loop over all infeasible intervals
    for (Interval i : infeasible) {
      // test timeslot left from the infeasible interval
View Full Code Here


   * @param agentId
   * @return scheduler
   */
  public synchronized Scheduler getScheduler(String agentId) {
    DateTime start = DateTime.now();
    while (schedulerFactory == null && start.plus(30000).isBeforeNow()){
      try {
        this.wait();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
View Full Code Here

            if (period == null) {
                break;
            }
            else {
                date = date.plus(period);
            }

            count += 1;
        }
View Full Code Here

      DateTime time5 = baseTime.minusSeconds(25);
      long period5Ms = 12000;
      Period period5 = new Period(period5Ms);
      loader.addScheduledJob("test5", time5, period5, false);
      while(time5.isBefore(baseTime)) {
        time5 = time5.plus(period5);
      }
     
      ScheduleManager scheduler = new ScheduleManager(executor, loader);

      synchronized(this) {
View Full Code Here

      DateTime time6 = baseTime.plusSeconds(35);
      scheduler.schedule("test6", time6, true);
     
      long totalTime = 45000;
      DateTime endTime = new DateTime();
      endTime = endTime.plus(totalTime);
      for (int i = 0; i < totalTime; i+= 5000 ) {
        synchronized(this) {
        try {

          System.out.println("Tick Tock " + i);
View Full Code Here

      ArrayList<DateTime> checkList = new ArrayList<DateTime>();
     
      DateTime start = startTime;
      while(start.isBefore(endTime)) {
        checkList.add(start);
        start = start.plus(repeating);
      }
     
      return checkList.toArray(new DateTime[checkList.size()]);
    }
   
View Full Code Here

      DateTime time5 = baseTime.minusSeconds(25);
      long period5Ms = 12000;
      Period period5 = new Period(period5Ms);
      loader.addScheduledJob("test5", time5, period5, false);
      while(time5.isBefore(baseTime)) {
        time5 = time5.plus(period5);
      }
     
      ScheduleManager scheduler = new ScheduleManager(executor, loader);

      synchronized(this) {
View Full Code Here

      Period period6 = new Period(period6Ms);
      scheduler.schedule("test5", time6, period6, false);

      long totalTime = 30000;
      DateTime endTime = new DateTime();
      endTime = endTime.plus(totalTime);
      for (int i = 0; i < totalTime; i+= 5000 ) {
        synchronized(this) {
        try {

          System.out.println("Tick Tock " + i);
View Full Code Here

        DateTime start = aroundInstant.minus(period);
        DateTime end = aroundInstant.plus(period);
        Interval range = new Interval(start, end);
        DateTime middleOf = IntervalUtils.middleOf(range);
        long halfRange = range.toDurationMillis() / 4;
        final Interval newInterval = new Interval(middleOf.minus(halfRange), middleOf.plus(halfRange));
        return newInterval;
    }
}
View Full Code Here

        DateTime current = lower;
        // Loop as long we exceeded the upper bound.
        while (current.isBefore(upper)) {
            tickDates.add(current);
            current = current.plus(rangeDivisionInfo.getPeriodSize().getPeriod());//.add(interval.interval, interval.amount);
        }

        // At last add the upper bound.
        tickDates.add(upper);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.