Package er.chronic.repeaters

Examples of er.chronic.repeaters.RepeaterTime


    List<Token> tokens = new LinkedList<Token>();

    // affect wanted patterns
    tokens.add(new Token("5:00"));
    tokens.add(new Token("morning"));
    tokens.get(0).tag(new RepeaterTime("5:00"));
    tokens.get(1).tag(new EnumRepeaterDayPortion(RepeaterDayPortion.DayPortion.MORNING));

    assertEquals(RepeaterDayPortion.DayPortion.MORNING, tokens.get(1).getTags().get(0).getType());

    tokens = Handler.dealiasAndDisambiguateTimes(tokens, new Options());
View Full Code Here


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

  public void testNextFuture() {
    RepeaterTime t;

    t = new RepeaterTime("4:00");
    t.setStart(_now);

    assertEquals(Time.construct(2006, 8, 16, 16), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 17, 4), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());

    t = new RepeaterTime("13:00");
    t.setStart(_now);

    assertEquals(Time.construct(2006, 8, 17, 13), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 18, 13), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());

    t = new RepeaterTime("0400");
    t.setStart(_now);

    assertEquals(Time.construct(2006, 8, 17, 4), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 18, 4), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2006, 8, 17, 4), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 18, 4), t.nextSpan(Pointer.PointerType.FUTURE).getBeginCalendar());
  }

  public void testNextPast() {
    RepeaterTime t;
    t = new RepeaterTime("4:00");
    t.setStart(_now);

    assertEquals(Time.construct(2006, 8, 16, 4), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 15, 16), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());

    t = new RepeaterTime("13:00");
    t.setStart(_now);

    assertEquals(Time.construct(2006, 8, 16, 13), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 15, 13), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2006, 8, 16, 13), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 15, 13), t.nextSpan(Pointer.PointerType.PAST).getBeginCalendar());
  }

  public void testType() {
    RepeaterTime t1;
    t1 = new RepeaterTime("4");
    assertEquals(14400, t1.getType().intValue());

    t1 = new RepeaterTime("14");
    assertEquals(50400, t1.getType().intValue());

    t1 = new RepeaterTime("4:00");
    assertEquals(14400, t1.getType().intValue());

    t1 = new RepeaterTime("4:30");
    assertEquals(16200, t1.getType().intValue());

    t1 = new RepeaterTime("1400");
    assertEquals(50400, t1.getType().intValue());

    t1 = new RepeaterTime("0400");
    assertEquals(14400, t1.getType().intValue());

    t1 = new RepeaterTime("04");
    assertEquals(14400, t1.getType().intValue());

    t1 = new RepeaterTime("400");
    assertEquals(14400, t1.getType().intValue());
  }
View Full Code Here

    tokens.get(0).tag(new RepeaterDayName(RepeaterDayName.DayName.FRIDAY));
   
    assertTrue(handler.match(tokens, Handler.definitions(_options)));
   
    tokens.add(new Token("5:00"));
    tokens.get(1).tag(new RepeaterTime("5:00"));
   
    assertTrue(handler.match(tokens, Handler.definitions(_options)));
   
    tokens.add(new Token("pm"));
    tokens.get(2).tag(new EnumRepeaterDayPortion(RepeaterDayPortion.DayPortion.PM));
View Full Code Here

TOP

Related Classes of er.chronic.repeaters.RepeaterTime

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.