Package com.mdimension.jchronic.utils

Examples of com.mdimension.jchronic.utils.Span


        else {
          throw new IllegalArgumentException("Unable to handle pointer type " + pointer);
        }
      }

      _currentSpan = new Span(rangeStart, Time.cloneAndAdd(rangeStart, Calendar.SECOND, _range.getWidth()));
    }
    else {
      if (pointer == Pointer.PointerType.FUTURE) {
        // WARN: Does not use Calendar
        _currentSpan = _currentSpan.add(RepeaterDayPortion.FULL_DAY_SECONDS);
View Full Code Here


  public void testThisFuture() {
    RepeaterWeekend weekends = new RepeaterWeekend();
    weekends.setStart(_now);

    Span thisWeekend = weekends.thisSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 19), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), thisWeekend.getEndCalendar());
  }
View Full Code Here

  }

  @Override
  protected Span _thisSpan(PointerType pointer) {
    Calendar rangeStart = Time.cloneAndAdd(Time.ymd(getNow()), Calendar.SECOND, _range.getBegin());
    _currentSpan = new Span(rangeStart, Time.cloneAndAdd(rangeStart, Calendar.SECOND, _range.getWidth()));
    return _currentSpan;
  }
View Full Code Here

  }

  @Override
  public Span getOffset(Span span, int amount, PointerType pointer) {
    setStart(span.getBeginCalendar());
    Span portionSpan = nextSpan(pointer);
    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    portionSpan = portionSpan.add(direction * (amount - 1) * RepeaterDay.DAY_SECONDS);
    return portionSpan;
  }
View Full Code Here

  public void testThisPast() {
    RepeaterWeekend weekends = new RepeaterWeekend();
    weekends.setStart(_now);

    Span thisWeekend = weekends.thisSpan(Pointer.PointerType.PAST);
    assertEquals(Time.construct(2006, 8, 12), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 14), thisWeekend.getEndCalendar());
  }
View Full Code Here

  public void testThisNone() {
    RepeaterWeekend weekends = new RepeaterWeekend();
    weekends.setStart(_now);

    Span thisWeekend = weekends.thisSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 19), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), thisWeekend.getEndCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2006, 8, 19), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), thisWeekend.getEndCalendar());
  }

  public void testOffset() {
    Span span = new Span(_now, Calendar.SECOND, 1);

    Span offsetSpan;

    offsetSpan = new RepeaterWeekend().getOffset(span, 3, Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 9, 2), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 9, 2, 0, 0, 1), offsetSpan.getEndCalendar());

    offsetSpan = new RepeaterWeekend().getOffset(span, 1, Pointer.PointerType.PAST);
    assertEquals(Time.construct(2006, 8, 12), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 12, 0, 0, 1), offsetSpan.getEndCalendar());

    offsetSpan = new RepeaterWeekend().getOffset(span, 0, Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 12), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 12, 0, 0, 1), offsetSpan.getEndCalendar());
  }
View Full Code Here

    super.setUp();
    _now = Time.construct(2006, 8, 16, 14, 0, 0, 0);
  }

  public void testSpanWidth() {
    Span span = new Span(Time.construct(2006, 8, 16, 0), Time.construct(2006, 8, 17, 0));
    assertEquals(60 * 60 * 24, span.getWidth());
  }
View Full Code Here

    Span span = new Span(Time.construct(2006, 8, 16, 0), Time.construct(2006, 8, 17, 0));
    assertEquals(60 * 60 * 24, span.getWidth());
  }

  public void testSpanMath() {
    Span span = new Span(1, 2);
    assertEquals(2, span.add(1).getBegin());
    assertEquals(3, span.add(1).getEnd());
    assertEquals(0, span.subtract(1).getBegin());
    assertEquals(1, span.subtract(1).getEnd());
  }
View Full Code Here

    else {
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentMinuteStart.add(Calendar.MINUTE, direction);
    }
   
    return new Span(_currentMinuteStart, Calendar.SECOND, RepeaterMinute.MINUTE_SECONDS);
  }
View Full Code Here

TOP

Related Classes of com.mdimension.jchronic.utils.Span

Copyright © 2018 www.massapicom. 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.