Package org.goda.time

Examples of org.goda.time.DateTime$Property


  public MutableInterval handle(List<Token> tokens, Options options) {
    int month = tokens.get(0).getTag(ScalarMonth.class).getType().intValue();
    int year = tokens.get(1).getTag(ScalarYear.class).getType().intValue();
    MutableInterval MutableInterval;
    try {
      DateTime start = Time.construct(year, month);
      DateTime end = Time.cloneAndAdd(start, Time.MONTH, 1);
      MutableInterval = new MutableInterval(start, end);
    }
    catch (IllegalArgumentException e) {
      if (options.isDebug()) {
        e.printStackTrace(System.out);
View Full Code Here


    return new MutableInterval(_currentDayStart, _currentDayStart.plusHours( 1));
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    DateTime hourStart;
    DateTime hourEnd;
    if (pointer == PointerType.FUTURE) {
      hourStart = Time.cloneAndAdd(Time.ymdhm(getNow()), Time.MINUTE, 1);
      hourEnd = Time.cloneAndAdd(Time.ymdh(getNow()), Time.HOUR, 1);
    }
    else if (pointer == PointerType.PAST) {
View Full Code Here

    int month = tokens.get(0).getTag(RepeaterMonthName.class).getType().ordinal();
    int year = tokens.get(1).getTag(ScalarYear.class).getType().intValue();

    MutableInterval MutableInterval;
    try {
      DateTime start = Time.construct(year, month);
      DateTime end = Time.cloneAndAdd(start, Time.MONTH, 1);
      MutableInterval = new MutableInterval(start, end);
    }
    catch (IllegalArgumentException e) {
      if (options.isDebug()) {
        e.printStackTrace(System.out);
View Full Code Here

import java.util.List;


public abstract class MDHandler implements IHandler {
    public MutableInterval handle(Repeater<?> month, Tag<? extends Number> day, List<Token> timeTokens, Options options) {
        month.setStart(new DateTime(options.getNow().getMillis()));

        MutableInterval mutableInterval = month.thisMutableInterval(options.getContext());
        DateTime dayStart = Time.construct(
                mutableInterval.getStart().get(DateTimeFieldType.year()),
                mutableInterval.getStart().get(DateTimeFieldType.monthOfYear()) , day.getType().intValue());

        return Handler.dayOrTime(dayStart, timeTokens, options);
    }
View Full Code Here

    return new MutableInterval(_currentDayStart, _currentDayStart.plusDays(1));
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    DateTime dayBegin;
    DateTime dayEnd;
    if (pointer == PointerType.FUTURE) {
      dayBegin = Time.cloneAndAdd(Time.ymdh(getNow()), Time.HOUR, 1);
      dayEnd = Time.cloneAndAdd(Time.ymd(getNow()), Time.DAY_OF_MONTH, 1);
    }
    else if (pointer == PointerType.PAST) {
View Full Code Here

    int year = tokens.get(5).getTag(ScalarYear.class).getType().intValue();

    MutableInterval MutableInterval;
    try {
      List<Token> timeTokens = CollectionUtils.subList(tokens,3, 4);
      DateTime dayStart = Time.construct(year, month, day);
      MutableInterval = Handler.dayOrTime(dayStart, timeTokens, options);
    }
    catch (IllegalArgumentException e) {
      if (options.isDebug()) {
        e.printStackTrace(System.out);
View Full Code Here

      grabber = tokens.get(0).getTag(Grabber.class);
      tokens.remove(tokens.size() - 1);
    }

    Repeater<?> head = repeaters.remove(0);
    head.setStart( new DateTime(options.getNow().getMillis()));

    MutableInterval outerMutableInterval;
    Grabber.Relative grabberType = grabber.getType();
    if (grabberType == Grabber.Relative.LAST) {
      outerMutableInterval = head.nextMutableInterval(Pointer.PointerType.PAST);
View Full Code Here

    return new MutableInterval(_currentYearStart, _currentYearStart.plusYears(1));
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    DateTime yearStart;
    DateTime yearEnd;
    if (pointer == PointerType.FUTURE) {
      yearStart = Time.cloneAndAdd(Time.ymd(getNow()), Time.DAY_OF_MONTH, 1);
      yearEnd = Time.cloneAndAdd(Time.yJan1(getNow()), Time.YEAR, 1);
    }
    else if (pointer == PointerType.PAST) {
View Full Code Here

  }

  @Override
  public MutableInterval getOffset(MutableInterval span, double amount, Pointer.PointerType pointer) {
    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    DateTime newBegin = Time.cloneAndAdd(span.getStart(), Time.YEAR, (int)(amount * direction));
    DateTime newEnd = Time.cloneAndAdd(span.getEnd(), Time.YEAR, (int)(amount * direction));
    return new MutableInterval(newBegin, newEnd);
  }
View Full Code Here

    int year = ((Number)tokens.get(2).getTag(ScalarYear.class).getType()).intValue();

    MutableInterval MutableInterval;
    try {
      List<Token> timeTokens = CollectionUtils.subList(tokens,3, tokens.size());
      DateTime dayStart = Time.construct(year, month, day);
      MutableInterval = Handler.dayOrTime(dayStart, timeTokens, options);
    }
    catch (IllegalArgumentException e) {
      if (options.isDebug()) {
        e.printStackTrace(System.out);
View Full Code Here

TOP

Related Classes of org.goda.time.DateTime$Property

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.