//----------------------------------------------------------------------- public ChronoLocalDateTimeImpl <D> Plus(long amountToAdd, TemporalUnit unit) { if (unit is ChronoUnit) { ChronoUnit f = (ChronoUnit)unit; switch (f) { case NANOS: return(PlusNanos(amountToAdd)); case MICROS: return(PlusDays(amountToAdd / MICROS_PER_DAY).PlusNanos((amountToAdd % MICROS_PER_DAY) * 1000)); case MILLIS: return(PlusDays(amountToAdd / MILLIS_PER_DAY).PlusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000)); case SECONDS: return(PlusSeconds(amountToAdd)); case MINUTES: return(PlusMinutes(amountToAdd)); case HOURS: return(PlusHours(amountToAdd)); case HALF_DAYS: // no overflow (256 is multiple of 2) return(PlusDays(amountToAdd / 256).PlusHours((amountToAdd % 256) * 12)); } return(With(Date.Plus(amountToAdd, unit), Time)); } return(ChronoLocalDateTimeImpl.EnsureValid(Date.Chronology, unit.AddTo(this, amountToAdd))); }
public ChronoLocalDateTimeImpl <D> With(TemporalField field, long newValue) { if (field is ChronoField) { ChronoField f = (ChronoField)field; if (f.TimeBased) { return(With(Date, Time.With(field, newValue))); } else { return(With(Date.With(field, newValue), Time)); } } return(ChronoLocalDateTimeImpl.EnsureValid(Date.Chronology, field.AdjustInto(this, newValue))); }
//----------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public ChronoLocalDateTimeImpl<D> with(java.time.temporal.TemporalAdjuster adjuster) public override ChronoLocalDateTimeImpl <D> With(TemporalAdjuster adjuster) { if (adjuster is ChronoLocalDate) { // The Chronology is checked in with(date,time) return(With((ChronoLocalDate)adjuster, Time)); } else if (adjuster is LocalTime) { return(With(Date, (LocalTime)adjuster)); } else if (adjuster is ChronoLocalDateTimeImpl) { //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl<?>) adjuster); return(ChronoLocalDateTimeImpl.EnsureValid(Date.Chronology, (ChronoLocalDateTimeImpl <?>)adjuster)); } //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl<?>) adjuster.adjustInto(this)); return(ChronoLocalDateTimeImpl.EnsureValid(Date.Chronology, (ChronoLocalDateTimeImpl <?>)adjuster.AdjustInto(this))); }