Package er.chronic.repeaters

Examples of er.chronic.repeaters.RepeaterYear


    tokens.add(new Token("3"));
    tokens.add(new Token("years"));
    tokens.add(new Token("past"));
   
    tokens.get(0).tag(new Scalar(Integer.valueOf(3)));
    tokens.get(1).tag(new RepeaterYear());
    tokens.get(2).tag(new Pointer(Pointer.PointerType.PAST));
   
    assertTrue(handler.match(tokens, Handler.definitions(_options)));
  }
View Full Code Here


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

  public void testNextFuture() {
    RepeaterYear years = new RepeaterYear();
    years.setStart(_now);

    Span nextYear = years.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2007, 1, 1), nextYear.getBeginCalendar());
    assertEquals(Time.construct(2008, 1, 1), nextYear.getEndCalendar());

    Span nextNextYear = years.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2008, 1, 1), nextNextYear.getBeginCalendar());
    assertEquals(Time.construct(2009, 1, 1), nextNextYear.getEndCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2008, 1, 1), nextNextYear.getBeginCalendar());
    assertEquals(Time.construct(2009, 1, 1), nextNextYear.getEndCalendar());
  }

  public void testNextPast() {
    RepeaterYear years = new RepeaterYear();
    years.setStart(_now);
    Span lastYear = years.nextSpan(Pointer.PointerType.PAST);
    assertEquals(Time.construct(2005, 1, 1), lastYear.getBeginCalendar());
    assertEquals(Time.construct(2006, 1, 1), lastYear.getEndCalendar());

    Span lastLastYear = years.nextSpan(Pointer.PointerType.PAST);
    assertEquals(Time.construct(2004, 1, 1), lastLastYear.getBeginCalendar());
    assertEquals(Time.construct(2005, 1, 1), lastLastYear.getEndCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2004, 1, 1), lastLastYear.getBeginCalendar());
    assertEquals(Time.construct(2005, 1, 1), lastLastYear.getEndCalendar());
  }

  public void testThis() {
    RepeaterYear years = new RepeaterYear();
    years.setStart(_now);

    Span thisYear;
    thisYear = years.thisSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 17), thisYear.getBeginCalendar());
    assertEquals(Time.construct(2007, 1, 1), thisYear.getEndCalendar());

    thisYear = years.thisSpan(Pointer.PointerType.PAST);
    assertEquals(Time.construct(2006, 1, 1), thisYear.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 16), thisYear.getEndCalendar());
  }
View Full Code Here

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

      Span offsetSpan;
      offsetSpan = new RepeaterYear().getOffset(span, 3, Pointer.PointerType.FUTURE);

      assertEquals(Time.construct(2009, 8, 16, 14), offsetSpan.getBeginCalendar());
      assertEquals(Time.construct(2009, 8, 16, 14, 0, 1), offsetSpan.getEndCalendar());

      offsetSpan = new RepeaterYear().getOffset(span, 10, Pointer.PointerType.PAST);

      assertEquals(Time.construct(1996, 8, 16, 14), offsetSpan.getBeginCalendar());
      assertEquals(Time.construct(1996, 8, 16, 14, 0, 1), offsetSpan.getEndCalendar());
  }
View Full Code Here

TOP

Related Classes of er.chronic.repeaters.RepeaterYear

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.