Package er.chronic.utils

Examples of er.chronic.utils.Span


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

  @Override
  protected Span _thisSpan(PointerType pointer) {
    return new Span(getNow(), Calendar.SECOND, 1);
  }
View Full Code Here


    else {
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentYearStart.add(Calendar.YEAR, direction);
    }

    return new Span(_currentYearStart, Calendar.YEAR, 1);
  }
View Full Code Here

      yearEnd = Time.cloneAndAdd(Time.yJan1(getNow()), Calendar.YEAR, 1);
    }
    else {
      throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
    }
    return new Span(yearStart, yearEnd);
  }
View Full Code Here

  @Override
  public Span getOffset(Span span, float amount, Pointer.PointerType pointer) {
    int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
    Calendar newBegin = Time.cloneAndAdd(span.getBeginCalendar(), Calendar.YEAR, amount * direction);
    Calendar newEnd = Time.cloneAndAdd(span.getEndCalendar(), Calendar.YEAR, amount * direction);
    return new Span(newBegin, newEnd);
  }
View Full Code Here

  protected Span _nextSpan(PointerType pointer) {
    if (_currentWeekStart == null) {
      if (pointer == PointerType.FUTURE) {
        RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
        sundayRepeater.setStart((Calendar) getNow().clone());
        Span nextSundaySpan = sundayRepeater.nextSpan(Pointer.PointerType.FUTURE);
        _currentWeekStart = nextSundaySpan.getBeginCalendar();
      }
      else if (pointer == PointerType.PAST) {
        RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
        sundayRepeater.setStart(Time.cloneAndAdd(getNow(), Calendar.DAY_OF_MONTH, 1));
        sundayRepeater.nextSpan(Pointer.PointerType.PAST);
        Span lastSundaySpan = sundayRepeater.nextSpan(Pointer.PointerType.PAST);
        _currentWeekStart = lastSundaySpan.getBeginCalendar();
      }
      else {
        throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
      }
    }
    else {
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentWeekStart.add(Calendar.DAY_OF_MONTH, RepeaterWeek.WEEK_DAYS * direction);
    }

    return new Span(_currentWeekStart, Calendar.DAY_OF_MONTH, RepeaterWeek.WEEK_DAYS);
  }
View Full Code Here

    return new Span(_currentWeekStart, Calendar.DAY_OF_MONTH, RepeaterWeek.WEEK_DAYS);
  }

  @Override
  protected Span _thisSpan(PointerType pointer) {
    Span thisWeekSpan;
    Calendar thisWeekStart;
    Calendar thisWeekEnd;
    if (pointer == PointerType.FUTURE) {
      thisWeekStart = Time.cloneAndAdd(Time.ymdh(getNow()), Calendar.HOUR, 1);
      RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
      sundayRepeater.setStart((Calendar) getNow().clone());
      Span thisSundaySpan = sundayRepeater.thisSpan(Pointer.PointerType.FUTURE);
      thisWeekEnd = thisSundaySpan.getBeginCalendar();
      thisWeekSpan = new Span(thisWeekStart, thisWeekEnd);
    }
    else if (pointer == PointerType.PAST) {
      thisWeekEnd = Time.ymdh(getNow());
      RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
      sundayRepeater.setStart((Calendar) getNow().clone());
      Span lastSundaySpan = sundayRepeater.nextSpan(Pointer.PointerType.PAST);
      thisWeekStart = lastSundaySpan.getBeginCalendar();
      thisWeekSpan = new Span(thisWeekStart, thisWeekEnd);
    }
    else if (pointer == PointerType.NONE) {
      RepeaterDayName sundayRepeater = new RepeaterDayName(RepeaterDayName.DayName.SUNDAY);
      sundayRepeater.setStart((Calendar) getNow().clone());
      Span lastSundaySpan = sundayRepeater.nextSpan(Pointer.PointerType.PAST);
      thisWeekStart = lastSundaySpan.getBeginCalendar();
      thisWeekEnd = Time.cloneAndAdd(thisWeekStart, Calendar.DAY_OF_MONTH, RepeaterWeek.WEEK_DAYS);
      thisWeekSpan = new Span(thisWeekStart, thisWeekEnd);
    }
    else {
      throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
    }
    return thisWeekSpan;
View Full Code Here

      else {
        throw new IllegalArgumentException("Unable to handle pointer " + pointer + ".");
      }
    }

    return new Span(_currentMonthBegin, Calendar.MONTH, 1);
  }
View Full Code Here

    return new Span(_currentMonthBegin, Calendar.MONTH, 1);
  }

  @Override
  protected Span _thisSpan(PointerType pointer) {
    Span span;
    if (pointer == Pointer.PointerType.PAST) {
      span = nextSpan(pointer);
    }
    else if (pointer == Pointer.PointerType.FUTURE || pointer == Pointer.PointerType.NONE) {
      span = nextSpan(Pointer.PointerType.NONE);
View Full Code Here

    }

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

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

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

TOP

Related Classes of er.chronic.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.