Package org.goda.time

Examples of org.goda.time.MutableInterval


public class SRPAHandler extends SRPHandler {

  @Override
  public MutableInterval handle(List<Token> tokens, Options options) {
    MutableInterval anchorMutableInterval = Handler.getAnchor(CollectionUtils.subList(tokens,3, tokens.size()), options);
    return super.handle(tokens, anchorMutableInterval, options);
  }
View Full Code Here


public abstract class ORRHandler implements IHandler {
  public MutableInterval handle(List<Token> tokens, MutableInterval outerMutableInterval, Options options) {
    Repeater<?> repeater = tokens.get(1).getTag(Repeater.class);
    repeater.setStart(Time.cloneAndAdd(outerMutableInterval.getStart(), Time.SECOND, -1));
    Number ordinalValue = tokens.get(0).getTag(Ordinal.class).getType();
    MutableInterval MutableInterval = null;
    for (int i = 0; i < ordinalValue.intValue(); i++) {
      MutableInterval = repeater.nextMutableInterval(Pointer.PointerType.FUTURE);
      if (MutableInterval.getStartMillis() > outerMutableInterval.getEndMillis()) {
        MutableInterval = null;
        break;
      }
    }
    return MutableInterval;
View Full Code Here

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

    }

    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
     _currentDayStart = _currentDayStart.plusDays(direction);

    return new MutableInterval(_currentDayStart, _currentDayStart.plusDays(1));
  }
View Full Code Here

      dayEnd = Time.cloneAndAdd(Time.ymdh(getNow()), Time.SECOND, RepeaterDay.DAY_SECONDS);
    }
    else {
      throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
    }
    return new MutableInterval(dayBegin, dayEnd);
  }
View Full Code Here

  @Override
  public MutableInterval getOffset(MutableInterval mutableInterval, double amount, Pointer.PointerType pointer) {
    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    // WARN: Does not use Calendar
    int seconds = (int) (direction * amount * RepeaterDay.DAY_SECONDS);
    return new MutableInterval( mutableInterval.getStart().plusSeconds(seconds), mutableInterval.getEnd().plusSeconds(seconds));
  }
View Full Code Here

  public MutableInterval handle(List<Token> tokens, Options options) {
    int month = tokens.get(1).getTag(RepeaterMonthName.class).getType().ordinal();
    int day = tokens.get(2).getTag(ScalarDay.class).getType().intValue();
    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);
    }
View Full Code Here

    }
    else {
      _secondStart = _secondStart.plusSeconds(direction);
    }

    return new MutableInterval(_secondStart, _secondStart.plusSeconds( 1));
  }
View Full Code Here

    return new MutableInterval(_secondStart, _secondStart.plusSeconds( 1));
  }

  @Override
  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    return new MutableInterval(getNow(), getNow().plusSeconds(1));
  }
View Full Code Here

  @Override
  public MutableInterval getOffset(MutableInterval span, double amount, Pointer.PointerType pointer) {
    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    // WARN: Does not use Calendar
    int seconds = (int) (direction * amount * RepeaterSecond.SECOND_SECONDS);
    return new MutableInterval( span.getStart().plusSeconds(seconds), span.getEnd().plusSeconds(seconds));
  }
View Full Code Here

TOP

Related Classes of org.goda.time.MutableInterval

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.