Examples of MutableInterval


Examples of org.goda.time.MutableInterval

  @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 * RepeaterMinute.MINUTE_SECONDS);
    return new MutableInterval( span.getStart().plusSeconds(seconds), span.getEnd().plusSeconds(seconds));
  }
View Full Code Here

Examples of org.goda.time.MutableInterval


public class ORSRHandler extends ORRHandler {

  public MutableInterval handle(List<Token> tokens, Options options) {
    MutableInterval outerMutableInterval = Handler.getAnchor( CollectionUtils.subList(tokens,3, 4), options);
    return handle(CollectionUtils.subList(tokens,0, 2), outerMutableInterval, options);
  }
View Full Code Here

Examples of org.goda.time.MutableInterval

  public MutableInterval handle(List<Token> tokens, Options options) {
    int month = tokens.get(0).getTag(ScalarMonth.class).getType().intValue();
    int day = tokens.get(1).getTag(ScalarDay.class).getType().intValue();
    DateTime start = Time.construct(options.getNow().get(DateTimeFieldType.year()), month, day);
    DateTime end = Time.cloneAndAdd(start, Time.DAY_OF_MONTH, 1);
    return new MutableInterval(start, end);
  }
View Full Code Here

Examples of org.goda.time.MutableInterval

  protected MutableInterval _nextMutableInterval(PointerType pointer) {
    if (_currentFortnightStart == null) {
      if (pointer == PointerType.FUTURE) {
        RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
        sundayRepeater.setStart(getNow());
        MutableInterval nextSundayMutableInterval = sundayRepeater.nextMutableInterval(PointerType.FUTURE);
        _currentFortnightStart = nextSundayMutableInterval.getStart();
      }
      else if (pointer == PointerType.PAST) {
        RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
        sundayRepeater.setStart(Time.cloneAndAdd(getNow(), Time.SECOND, RepeaterDay.DAY_SECONDS));
        sundayRepeater.nextMutableInterval(PointerType.PAST);
        sundayRepeater.nextMutableInterval(PointerType.PAST);
        MutableInterval lastSundayMutableInterval = sundayRepeater.nextMutableInterval(PointerType.PAST);
        _currentFortnightStart = lastSundayMutableInterval.getStart();
      }
      else {
        throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
      }
    }
    else {
      int direction = (pointer == PointerType.FUTURE) ? 1 : -1;
      _currentFortnightStart = _currentFortnightStart.plusSeconds(direction * RepeaterFortnight.FORTNIGHT_SECONDS);
    }

    return new MutableInterval(_currentFortnightStart, _currentFortnightStart.plusSeconds( RepeaterFortnight.FORTNIGHT_SECONDS));
  }
View Full Code Here

Examples of org.goda.time.MutableInterval

  protected MutableInterval _thisMutableInterval(PointerType pointer) {
    if (pointer == null) {
      pointer = PointerType.FUTURE;
    }

    MutableInterval MutableInterval;
    if (pointer == PointerType.FUTURE) {
      DateTime thisFortnightStart = Time.cloneAndAdd(Time.ymdh(getNow()), Time.SECOND, RepeaterHour.HOUR_SECONDS);
      RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
      sundayRepeater.setStart(getNow());
      sundayRepeater.thisMutableInterval(PointerType.FUTURE);
      MutableInterval thisSundayMutableInterval = sundayRepeater.thisMutableInterval(PointerType.FUTURE);
      DateTime thisFortnightEnd = thisSundayMutableInterval.getStart();
      MutableInterval = new MutableInterval(thisFortnightStart, thisFortnightEnd);
    }
    else if (pointer == PointerType.PAST) {
      DateTime thisFortnightEnd = Time.ymdh(getNow());
      RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
      sundayRepeater.setStart(getNow());
      MutableInterval lastSundayMutableInterval = sundayRepeater.nextMutableInterval(PointerType.PAST);
      DateTime thisFortnightStart = lastSundayMutableInterval.getStart();
      MutableInterval = new MutableInterval(thisFortnightStart, thisFortnightEnd);
    }
    else {
      throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
    }
View Full Code Here

Examples of org.goda.time.MutableInterval

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

Examples of org.goda.time.MutableInterval

  @Override
  public MutableInterval getOffset(MutableInterval mutableInterval, double amount, PointerType pointer) {
    int direction = (pointer == PointerType.FUTURE) ? 1 : -1;
    int seconds = (int) (direction * amount * RepeaterFortnight.FORTNIGHT_SECONDS);
    return new MutableInterval( mutableInterval.getStart().plusSeconds(seconds), mutableInterval.getEnd().plusSeconds(seconds));
   
  }
View Full Code Here

Examples of org.goda.time.MutableInterval

import org.goda.time.MutableInterval;

public class ORGRHandler extends ORRHandler {

  public MutableInterval handle(List<Token> tokens, Options options) {
    MutableInterval outerMutableInterval = Handler.getAnchor(CollectionUtils.subList(tokens,2, 4), options);
    return handle(CollectionUtils.subList(tokens,0, 2), outerMutableInterval, options);
  }
View Full Code Here

Examples of org.goda.time.MutableInterval

public class SmSyHandler implements IHandler {
  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

Examples of org.goda.time.MutableInterval

    }
    else {
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
       _currentDayStart = _currentDayStart.plusHours( direction);
    }
    return new MutableInterval(_currentDayStart, _currentDayStart.plusHours( 1));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.