本文整理汇总了Java中org.threeten.bp.ZonedDateTime.withZoneSameInstant方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.withZoneSameInstant方法的具体用法?Java ZonedDateTime.withZoneSameInstant怎么用?Java ZonedDateTime.withZoneSameInstant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.withZoneSameInstant方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Coupon> toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
ArgumentChecker.notNull(valZdt, "date");
ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
final List<Coupon> resultList = new ArrayList<>();
final CouponONArithmeticAverageSpreadDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt, indexFixingTS));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:17,代码来源:AnnuityCouponArithmeticAverageONSpreadDefinition.java
示例2: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Coupon> toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
ArgumentChecker.notNull(valZdt, "date");
ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
final List<Coupon> resultList = new ArrayList<>();
final CouponONSpreadDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt, indexFixingTS));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
示例3: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Coupon> toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
ArgumentChecker.notNull(valZdt, "date");
ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
final List<Coupon> resultList = new ArrayList<>();
final CouponONDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt, indexFixingTS));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
示例4: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Coupon> toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
ArgumentChecker.notNull(valZdt, "date");
ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
final List<Coupon> resultList = new ArrayList<>();
final CouponONArithmeticAverageDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt, indexFixingTS));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
示例5: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Payment> toDerivative(final ZonedDateTime valZdt, final DoubleTimeSeries<ZonedDateTime> indexFixingTS) {
ArgumentChecker.notNull(valZdt, "date");
ArgumentChecker.notNull(indexFixingTS, "index fixing time series");
final List<Payment> resultList = new ArrayList<>();
final CouponCommodityCashSettleDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt, indexFixingTS));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
示例6: toDerivative
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Annuity<? extends Payment> toDerivative(final ZonedDateTime valZdt) {
ArgumentChecker.notNull(valZdt, "date");
final List<Payment> resultList = new ArrayList<>();
final CouponCommodityPhysicalSettleDefinition[] payments = getPayments();
final ZonedDateTime valZdtInPaymentZone = valZdt.withZoneSameInstant(payments[0].getPaymentDate().getZone());
final LocalDate valDate = valZdtInPaymentZone.toLocalDate();
for (int loopcoupon = 0; loopcoupon < payments.length; loopcoupon++) {
if (!valDate.isAfter(payments[loopcoupon].getPaymentDate().toLocalDate())) {
resultList.add(payments[loopcoupon].toDerivative(valZdt));
}
}
return new Annuity<>(resultList.toArray(new Coupon[resultList.size()]));
}
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:17,代码来源:AnnuityCouponCommodityPhysicalSettleDefinition.java
示例7: getTimeBetween
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
* Computes the time between two dates using a user-supplied day count convention. Dates can be in any order.
* If date1 is after date2, the result will be negative.
* @param date1 The first date.
* @param date2 The second date.
* @param dayCount The day count.
* @param calendar the calendar.
* @return The time.
*/
public static double getTimeBetween(final ZonedDateTime date1, final ZonedDateTime date2, final DayCount dayCount, final Calendar calendar) {
ArgumentChecker.notNull(date1, "date1");
ArgumentChecker.notNull(date1, "date2");
ArgumentChecker.notNull(dayCount, "day count");
ArgumentChecker.notNull(calendar, "calendar");
// Implementation note: here we convert date2 to the same zone as date1 so we don't accidentally gain or lose a day.
final ZonedDateTime rebasedDate2 = date2.withZoneSameInstant(date1.getZone());
final boolean timeIsNegative = date1.isAfter(rebasedDate2); // date1 >= date2
if (!timeIsNegative) {
return dayCount.getDayCountFraction(date1, rebasedDate2, calendar);
}
return -1.0 * dayCount.getDayCountFraction(rebasedDate2, date1, calendar);
}
示例8: getTimeBetween
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
* Computes the time between two dates using a user-supplied day count convention. Dates can be in any order.
* If date1 is after date2, the result will be negative.
* @param date1 The first date.
* @param date2 The second date.
* @param dayCount The day count
* @param calendar the calendar
* @return The time.
*/
public static double getTimeBetween(final ZonedDateTime date1, final ZonedDateTime date2, final DayCount dayCount, final Calendar calendar) {
ArgumentChecker.notNull(date1, "date1");
ArgumentChecker.notNull(date1, "date2");
ArgumentChecker.notNull(dayCount, "day count");
// Implementation note: here we convert date2 to the same zone as date1 so we don't accidentally gain or lose a day.
final ZonedDateTime rebasedDate2 = date2.withZoneSameInstant(date1.getZone());
final boolean timeIsNegative = date1.isAfter(rebasedDate2); // date1 >= date2
if (!timeIsNegative) {
return dayCount.getDayCountFraction(date1, rebasedDate2, calendar);
}
return -1.0 * dayCount.getDayCountFraction(rebasedDate2, date1, calendar);
}
示例9: MapMarketDataEnvironment
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@ImmutableConstructor
MapMarketDataEnvironment(Map<SingleValueRequirement, Object> data,
Map<MarketDataId<?>, DateTimeSeries<LocalDate, ?>> timeSeries,
ZonedDateTime valuationTime) {
ArgumentChecker.notNull(data, "data");
ArgumentChecker.notNull(timeSeries, "timeSeries");
ArgumentChecker.notNull(valuationTime, "valuationTime");
_data = ImmutableMap.copyOf(data);
_timeSeries = ImmutableMap.copyOf(timeSeries);
_valuationTime = valuationTime.withZoneSameInstant(ZoneOffset.UTC);
}
示例10: apply
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) {
return zonedDateTime.withZoneSameInstant(zoneId);
}
示例11: GatheringMarketDataEnvironment
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
GatheringMarketDataEnvironment(GatheringMarketDataBundle bundle, ZonedDateTime valuationTime) {
_bundle = bundle;
_valuationTime = valuationTime.withZoneSameInstant(ZoneOffset.UTC);
}