当前位置: 首页>>代码示例>>Java>>正文


Java ZonedDateTime.equals方法代码示例

本文整理汇总了Java中org.threeten.bp.ZonedDateTime.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.equals方法的具体用法?Java ZonedDateTime.equals怎么用?Java ZonedDateTime.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.threeten.bp.ZonedDateTime的用法示例。


在下文中一共展示了ZonedDateTime.equals方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfMonth() == startDate.toLocalDate().lengthOfMonth()) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but neither was the last day of the month");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate.with(TemporalAdjusters.lastDayOfMonth());
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plus(Period.ofMonths(1)).with(TemporalAdjusters.lastDayOfMonth());
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:19,代码来源:EndOfMonthScheduleCalculator.java

示例2: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfMonth() == 1) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but neither was the first day of the month");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate.with(TemporalAdjusters.firstDayOfMonth());
  if (date.isBefore(startDate)) {
    date = date.plusMonths(1);
  }
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plusMonths(1);
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:22,代码来源:FirstOfMonthScheduleCalculator.java

示例3: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfMonth() == 31 && startDate.getMonth() == Month.DECEMBER) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but neither was the last day of the year");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate.with(TemporalAdjusters.lastDayOfYear());
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plusYears(1).with(TemporalAdjusters.lastDayOfYear());
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:19,代码来源:EndOfYearScheduleCalculator.java

示例4: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfWeek() == _dayOfWeek) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but their day of week was not the same as that required");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate;
  date = date.with(TemporalAdjusters.nextOrSame(_dayOfWeek));
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.with(TemporalAdjusters.next(_dayOfWeek));
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:20,代码来源:WeeklyScheduleOnDayCalculator.java

示例5: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  Validate.notNull(startDate, "start date");
  Validate.notNull(endDate, "end date");
  Validate.isTrue(startDate.isBefore(endDate) || startDate.equals(endDate));
  if (startDate.equals(endDate)) {
    if (MonthDay.from(startDate).equals(_monthDay)) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but the day of month and month of year were not those required");
  }
  ZonedDateTime date = startDate.with(_monthDay);
  if (date.isBefore(startDate)) {
    date = date.plusYears(1);
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plusYears(1);
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:22,代码来源:AnnualScheduleOnDayAndMonthCalculator.java

示例6: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfMonth() == 1 && startDate.getMonth() == Month.JANUARY) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but neither was the first day of the year");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate.with(TemporalAdjusters.firstDayOfYear());
  if (date.isBefore(startDate)) {
    date = date.plusYears(1);
  }
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plusYears(1);
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:22,代码来源:FirstOfYearScheduleCalculator.java

示例7: compare

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public int compare(final ZonedDateTime d1, final ZonedDateTime d2, final Period tolerance) {
  final ZonedDateTime dLow = d1.minus(tolerance);
  final ZonedDateTime dHigh = d1.plus(tolerance);
  if (d1.equals(d2) || (d2.isAfter(dLow) && d2.isBefore(dHigh))) {
    return 0;
  }
  return d1.isBefore(d2) ? -1 : 1;

}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:ZonedDateTimeLabelledMatrix1D.java

示例8: toDerivative

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Payment toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> indexFixingTimeSeries) {
  ArgumentChecker.notNull(date, "date");
  ArgumentChecker.isTrue(!date.isAfter(getPaymentDate()), "date is after payment date");
  final ZonedDateTime zonedDate = date.toLocalDate().atStartOfDay(ZoneOffset.UTC);
  double paymentTime = TimeCalculator.getTimeBetween(zonedDate, getPaymentDate()); // Calendar????
  if (date.isAfter(getFixingDate()) || (date.equals(getFixingDate()))) {
    Double fixedRate = indexFixingTimeSeries.getValue(getFixingDate());
    //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
    if (fixedRate == null) {
      final ZonedDateTime fixingDateAtLiborFixingTime = getFixingDate().with(LocalTime.of(11, 0));
      fixedRate = indexFixingTimeSeries.getValue(fixingDateAtLiborFixingTime);
    }
    if (fixedRate == null) {
      final ZonedDateTime previousBusinessDay = PRECEDING_BDC.adjustDate(_calendar,
          getFixingDate().minusDays(1));
      fixedRate = indexFixingTimeSeries.getValue(previousBusinessDay);
      //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
      if (fixedRate == null) {
        final ZonedDateTime previousBusinessDayAtLiborFixingTime = previousBusinessDay.with(LocalTime.of(11, 0));
        fixedRate = indexFixingTimeSeries.getValue(previousBusinessDayAtLiborFixingTime);
      }
      if (fixedRate == null) {
        throw new OpenGammaRuntimeException("Could not get fixing value for date " + getFixingDate());
      }
    }
    return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixedRate - _rate);
  }

  // Ibor is not fixed yet, all the details are required.
  double fixingTime = TimeCalculator.getTimeBetween(zonedDate, getFixingDate());
  double fixingPeriodStartTime = TimeCalculator.getTimeBetween(zonedDate, getFixingPeriodStartDate());
  double fixingPeriodEndTime = TimeCalculator.getTimeBetween(zonedDate, getFixingPeriodEndDate());
  return new ForwardRateAgreement(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), _index, fixingTime, fixingPeriodStartTime,
      fixingPeriodEndTime, getFixingPeriodAccrualFactor(), _rate);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:37,代码来源:ForwardRateAgreementDefinition.java

示例9: toDerivative

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Coupon toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
  ArgumentChecker.notNull(date, "date");
  ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
  ArgumentChecker.isTrue(!date.isAfter(getPaymentDate()), "date is after payment date " + date + " " + getPaymentDate());
  final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate());
  if (date.isAfter(getFixingDate()) || date.equals(getFixingDate())) { // The Ibor cap/floor has already fixed, it is now a fixed coupon.
    Double fixedRate = indexFixingTS.getValue(getFixingDate());
    //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
    if (fixedRate == null) {
      final ZonedDateTime fixingDateAtLiborFixingTime = getFixingDate().with(LocalTime.of(11, 0));
      fixedRate = indexFixingTS.getValue(fixingDateAtLiborFixingTime);
    }
    if (fixedRate == null) {
      final ZonedDateTime previousBusinessDay = BusinessDayConventions.PRECEDING.adjustDate(_calendar, getFixingDate().minusDays(1));
      fixedRate = indexFixingTS.getValue(previousBusinessDay);
      //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
      if (fixedRate == null) {
        final ZonedDateTime previousBusinessDayAtLiborFixingTime = previousBusinessDay.with(LocalTime.of(11, 0));
        fixedRate = indexFixingTS.getValue(previousBusinessDayAtLiborFixingTime);
      }
      if (fixedRate == null) {
        fixedRate = indexFixingTS.getLatestValue(); //TODO remove me as soon as possible
      }
    }
    return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), payOff(fixedRate));
  }
  // Ibor is not fixed yet, all the details are required.
  final double fixingTime = TimeCalculator.getTimeBetween(date, getFixingDate());
  final double fixingPeriodStartTime = TimeCalculator.getTimeBetween(date, getFixingPeriodStartDate());
  final double fixingPeriodEndTime = TimeCalculator.getTimeBetween(date, getFixingPeriodEndDate());
  //TODO: Definition has no spread and time version has one: to be standardized.
  return new CapFloorIbor(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, getIndex(), fixingPeriodStartTime, fixingPeriodEndTime,
      getFixingPeriodAccrualFactor(), _strike, _isCap);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:36,代码来源:CapFloorIborDefinition.java

示例10: toDerivative

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Coupon toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> data) {
  ArgumentChecker.notNull(date, "date");
  ArgumentChecker.isTrue(!date.isAfter(getPaymentDate()), "date is after payment date");
  // First curve used for discounting. If two curves, the same forward is used for both swaps;
  // if more than two curves, the second is used for the forward of the first swap and the third for the forward of the second swap.
  final double paymentTime = TimeCalculator.getTimeBetween(date, getPaymentDate());
  if (date.isAfter(getFixingDate()) || date.equals(getFixingDate())) { // The CMS coupon has already fixed, it is now a fixed coupon.
    Double fixedRate = data.getValue(getFixingDate());
    //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
    if (fixedRate == null) {
      final ZonedDateTime fixingDateAtLiborFixingTime = getFixingDate().with(LocalTime.of(11, 0));
      fixedRate = data.getValue(fixingDateAtLiborFixingTime);
    }
    if (fixedRate == null) {
      final ZonedDateTime previousBusinessDay = BusinessDayConventions.PRECEDING.adjustDate(_calendar1,
          getFixingDate().minusDays(1));
      fixedRate = data.getValue(previousBusinessDay);
      //TODO remove me when times are sorted out in the swap definitions or we work out how to deal with this another way
      if (fixedRate == null) {
        final ZonedDateTime previousBusinessDayAtLiborFixingTime = previousBusinessDay.with(LocalTime.of(11, 0));
        fixedRate = data.getValue(previousBusinessDayAtLiborFixingTime);
      }
      if (fixedRate == null) {
        fixedRate = data.getLatestValue(); //TODO remove me as soon as possible
        //throw new OpenGammaRuntimeException("Could not get fixing value for date " + getFixingDate());
      }
    }

    return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), payOff(fixedRate));
  }
  // CMS spread is not fixed yet, all the details are required.
  final double fixingTime = TimeCalculator.getTimeBetween(date, getFixingDate());
  final double settlementTime = TimeCalculator.getTimeBetween(date, _underlyingSwap1.getFixedLeg().getNthPayment(0).getAccrualStartDate());
  final SwapFixedCoupon<Coupon> swap1 = _underlyingSwap1.toDerivative(date);
  final SwapFixedCoupon<Coupon> swap2 = _underlyingSwap2.toDerivative(date);
  return new CapFloorCMSSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, swap1, _cmsIndex1, swap2, _cmsIndex2, settlementTime, _strike, _isCap);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:39,代码来源:CapFloorCMSSpreadDefinition.java

示例11: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    return new ZonedDateTime[] {startDate};
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  ZonedDateTime date = startDate;
  while (!date.isAfter(endDate)) {
    dates.add(date);
    date = date.plusDays(1);
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:16,代码来源:DailyScheduleCalculator.java

示例12: getSchedule

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public ZonedDateTime[] getSchedule(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  ArgumentChecker.notNull(startDate, "start date");
  ArgumentChecker.notNull(endDate, "end date");
  ArgumentChecker.isFalse(startDate.isAfter(endDate), "start date must not be after end date");
  if (startDate.equals(endDate)) {
    if (startDate.getDayOfMonth() == _dayOfMonth) {
      return new ZonedDateTime[] {startDate};
    }
    throw new IllegalArgumentException("Start date and end date were the same but their day of month was not the same as that required");
  }
  final List<ZonedDateTime> dates = new ArrayList<>();
  int year = endDate.getYear();
  Month month = startDate.getMonth();
  ZonedDateTime date = startDate.withMonth(month.getValue()).withDayOfMonth(_dayOfMonth);
  if (date.isBefore(startDate)) {
    month = month.plus(1);
    date = date.withMonth(month.getValue());
  }
  year = date.getYear();
  while (!date.isAfter(endDate)) {
    dates.add(date);
    month = month.plus(1);
    if (month == Month.JANUARY) {
      year++;
    }
    date = date.with(LocalDate.of(year, month.getValue(), _dayOfMonth));
  }
  return dates.toArray(EMPTY_ZONED_DATE_TIME_ARRAY);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:30,代码来源:MonthlyScheduleOnDayCalculator.java

示例13: createFixingSeries

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
static ZonedDateTimeDoubleTimeSeries createFixingSeries(final ZonedDateTime startDate, final ZonedDateTime endDate) {
  final List<ZonedDateTime> dates = new ArrayList<>();
  final List<Double> data = new ArrayList<>();
  ZonedDateTime dt = startDate;
  while (dt.isBefore(endDate) || dt.equals(endDate)) {
    dates.add(dt);
    data.add(0.05 + Math.sin(dt.getDayOfYear()) / 100);
    dt = dt.plusDays(1);
    if (dt.getDayOfWeek().equals(DayOfWeek.SATURDAY)) {
      dt = dt.plusDays(2);
    }
  }
  return ImmutableZonedDateTimeDoubleTimeSeries.of(dates, data, ZoneOffset.UTC);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:AnnuityCouponONDefinitionTest.java


注:本文中的org.threeten.bp.ZonedDateTime.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。