Package com.mdimension.jchronic.utils

Examples of com.mdimension.jchronic.utils.Span


    // future
  }

  public void test_parse_guess_o_r_s_r() {
    Span time;
    time = parse_now("3rd wednesday in november");
    assertEquals(Time.construct(2006, 11, 15, 12), time);

    time = parse_now("10th wednesday in november");
    assertEquals(null, time);
View Full Code Here


    // time = parse_now("3rd wednesday in 2007");
    // assertEquals(Time.construct(2007, 1, 20, 12), time);
  }

  public void test_parse_guess_o_r_g_r() {
    Span time;
    time = parse_now("3rd month next year");
    assertEquals(Time.construct(2007, 3, 16, 12, 30), time);

    time = parse_now("3rd thursday this september");
    assertEquals(Time.construct(2006, 9, 21, 12), time);
View Full Code Here

  public Span handle(List<Token> tokens, Options options) {
    int month = tokens.get(0).getTag(RepeaterMonthName.class).getType().ordinal();
    int day = tokens.get(1).getTag(ScalarDay.class).getType().intValue();
    int year = tokens.get(2).getTag(ScalarYear.class).getType().intValue();

    Span span;
    try {
      List<Token> timeTokens = tokens.subList(3, tokens.size());
      Calendar dayStart = Time.construct(year, month, day);
      span = Handler.dayOrTime(dayStart, timeTokens, options);
    }
View Full Code Here

    time = parse_now("4th day last week");
    assertEquals(Time.construct(2006, 8, 9, 12), time);
  }

  public void test_parse_guess_nonsense() {
    Span time;
    time = parse_now("some stupid nonsense");
    assertEquals(null, time);
  }
View Full Code Here

    time = parse_now("some stupid nonsense");
    assertEquals(null, time);
  }

  public void test_parse_span() {
    Span span;
    span = parse_now("friday", new Options(false));
    assertEquals(Time.construct(2006, 8, 18), span.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 19), span.getEndCalendar());

    span = parse_now("november", new Options(false));
    assertEquals(Time.construct(2006, 11), span.getBeginCalendar());
    assertEquals(Time.construct(2006, 12), span.getEndCalendar());

    Options options = new Options(_time_2006_08_16_14_00_00, false);
    span = Chronic.parse("weekend", options);
    assertEquals(Time.construct(2006, 8, 19), span.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), span.getEndCalendar());
  }
View Full Code Here

    }

    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    _currentDayStart.add(Calendar.DAY_OF_MONTH, direction);

    return new Span(_currentDayStart, Calendar.DAY_OF_MONTH, 1);
  }
View Full Code Here

      dayEnd = Time.cloneAndAdd(Time.ymdh(getNow()), Calendar.DAY_OF_MONTH, 1);
    }
    else {
      throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
    }
    return new Span(dayBegin, dayEnd);
  }
View Full Code Here

    }
    else {
      throw new IllegalArgumentException("Invalid repeater: " + repeater);
    }
    */
    Span span = Chronic.parse("this second", new Options(options.getNow(), false));
    return handle(tokens, span, options);
  }
View Full Code Here

    }
    else {
      _secondStart.add(Calendar.SECOND, direction);
    }

    return new Span(_secondStart, Calendar.SECOND, 1);
  }
View Full Code Here

    return new Span(_secondStart, Calendar.SECOND, 1);
  }

  @Override
  protected Span _thisSpan(PointerType pointer) {
    return new Span(getNow(), Calendar.SECOND, 1);
  }
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.