Example #1
0
    @Override
    public D withValue(D context, Long value, boolean lenient) {

      long utcDays =
          MathUtils.safeSubtract(
              EpochDays.UNIX.transform(value.longValue(), this.element), UTC_OFFSET);

      return this.calsys.transform(utcDays);
    }
Example #2
0
    @Override
    public boolean isValid(D context, Long value) {

      long days =
          MathUtils.safeSubtract(
              EpochDays.UNIX.transform(value.longValue(), this.element), UTC_OFFSET);

      return ((days <= this.calsys.getMaximumSinceUTC())
          && (days >= this.calsys.getMinimumSinceUTC()));
    }
Example #3
0
  /*[deutsch]
   * <p>Rechnet die angegebene Tageszahl in eine Tageszahl auf der
   * Nummerierungsbasis dieser Instanz zur Mittagszeit um. </p>
   *
   * @param   amount  count of days relative to given epoch at noon
   * @param   epoch   epoch reference
   * @return  count of days relative to this epoch
   */
  public long transform(long amount, EpochDays epoch) {

    return MathUtils.safeAdd(amount, (epoch.offset - this.offset));
  }