Home
last modified time | relevance | path

Searched refs:amount (Results 1 – 25 of 49) sorted by relevance

12

/libcore/ojluni/src/test/java/time/test/java/time/
DMockSimplePeriod.java91 private final long amount; field in MockSimplePeriod
107 public static MockSimplePeriod of(long amount, TemporalUnit unit) { in of() argument
108 return new MockSimplePeriod(amount, unit); in of()
111 private MockSimplePeriod(long amount, TemporalUnit unit) { in MockSimplePeriod() argument
116 this.amount = amount; in MockSimplePeriod()
132 return amount; in getAmount()
142 return temporal.plus(amount, unit); in addTo()
147 return temporal.minus(amount, unit); in subtractFrom()
156 return Long.compare(amount, otherPeriod.amount); in compareTo()
166 return this.amount == other.amount && in equals()
[all …]
/libcore/ojluni/src/test/java/time/tck/java/time/
DMockSimplePeriod.java91 private final long amount; field in MockSimplePeriod
107 public static MockSimplePeriod of(long amount, TemporalUnit unit) { in of() argument
108 return new MockSimplePeriod(amount, unit); in of()
111 private MockSimplePeriod(long amount, TemporalUnit unit) { in MockSimplePeriod() argument
116 this.amount = amount; in MockSimplePeriod()
132 return amount; in getAmount()
142 return temporal.plus(amount, unit); in addTo()
147 return temporal.minus(amount, unit); in subtractFrom()
156 return Long.compare(amount, otherPeriod.amount); in compareTo()
166 return this.amount == other.amount && in equals()
[all …]
DTCKDuration.java397 …public void factory_of_longTemporalUnit(long amount, TemporalUnit unit, long expectedSeconds, int … in factory_of_longTemporalUnit() argument
398 Duration t = Duration.of(amount, unit); in factory_of_longTemporalUnit()
416 public void factory_of_longTemporalUnit_outOfRange(long amount, TemporalUnit unit) { in factory_of_longTemporalUnit_outOfRange() argument
417 Duration.of(amount, unit); in factory_of_longTemporalUnit_outOfRange()
435 TemporalAmount amount = Duration.ofHours(3); in factory_from_TemporalAmount_Duration() local
436 assertEquals(Duration.from(amount), Duration.ofHours(3)); in factory_from_TemporalAmount_Duration()
441 TemporalAmount amount = new TemporalAmount() { in factory_from_TemporalAmount_DaysNanos() local
466 Duration t = Duration.from(amount); in factory_from_TemporalAmount_DaysNanos()
473 TemporalAmount amount = new TemporalAmount() { in factory_from_TemporalAmount_Minutes_tooBig() local
491 Duration.from(amount); in factory_from_TemporalAmount_Minutes_tooBig()
[all …]
DTCKInstant.java580 public <R extends Temporal> R addTo(R temporal, long amount) {
615 public <R extends Temporal> R addTo(R temporal, long amount) {
697 …public void test_plusTemporalAmount(TemporalUnit unit, TemporalAmount amount, int seconds, int nan…
699 Instant actual = inst.plus(amount);
713 public void test_badPlusTemporalAmount(TemporalAmount amount) {
715 inst.plus(amount);
991 …public void plusSeconds_long(long seconds, int nanos, long amount, long expectedSeconds, int expec…
993 t = t.plusSeconds(amount);
1070 …public void plusMillis_long(long seconds, int nanos, long amount, long expectedSeconds, int expect…
1072 t = t.plusMillis(amount);
[all …]
DTCKYear.java519 public void test_plusValid(int year, TemporalAmount amount, int expected) { in test_plusValid() argument
520 assertEquals(Year.of(year).plus(amount), Year.of(expected)); in test_plusValid()
538 public void test_plusInvalidUnit(TemporalAmount amount) { in test_plusInvalidUnit() argument
539 TEST_2008.plus(amount); in test_plusInvalidUnit()
624 …public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYe… in test_plus_long_TemporalUnit() argument
626 assertEquals(base.plus(amount, unit), expectedYear); in test_plus_long_TemporalUnit()
629 base.plus(amount, unit); in test_plus_long_TemporalUnit()
651 public void test_minusValid(int year, TemporalAmount amount, int expected) { in test_minusValid() argument
652 assertEquals(Year.of(year).minus(amount), Year.of(expected)); in test_minusValid()
670 public void test_minusInvalidUnit(TemporalAmount amount) { in test_minusInvalidUnit() argument
[all …]
DTCKZonedDateTime.java1620 …public void test_plus_TemporalAmount_Period_days(ZonedDateTime base, int amount, ZonedDateTime exp…
1621 assertEquals(base.plus(Period.ofDays(amount)), expected);
1625 …public void test_plus_TemporalAmount_Period_hours(ZonedDateTime base, long amount, ZonedDateTime e…
1626 assertEquals(base.plus(MockSimplePeriod.of(amount, HOURS)), expected);
1630 …public void test_plus_TemporalAmount_Duration_hours(ZonedDateTime base, long amount, ZonedDateTime…
1631 assertEquals(base.plus(Duration.ofHours(amount)), expected);
1671 public void test_plus_longUnit_days(ZonedDateTime base, long amount, ZonedDateTime expected) {
1672 assertEquals(base.plus(amount, DAYS), expected);
1676 public void test_plus_longUnit_hours(ZonedDateTime base, long amount, ZonedDateTime expected) {
1677 assertEquals(base.plus(amount, HOURS), expected);
[all …]
DTCKPeriod.java160 TemporalAmount amount = Period.of(1, 2, 3); in factory_from_TemporalAmount_Period() local
161 assertPeriod(Period.from(amount), 1, 2, 3); in factory_from_TemporalAmount_Period()
166 TemporalAmount amount = new TemporalAmount() { in factory_from_TemporalAmount_YearsDays() local
191 assertPeriod(Period.from(amount), 23, 0, 45); in factory_from_TemporalAmount_YearsDays()
196 TemporalAmount amount = new TemporalAmount() { in factory_from_TemporalAmount_Years_tooBig() local
214 Period.from(amount); in factory_from_TemporalAmount_Years_tooBig()
219 TemporalAmount amount = new TemporalAmount() { in factory_from_TemporalAmount_DaysHours() local
244 Period.from(amount); in factory_from_TemporalAmount_DaysHours()
645 TemporalAmount amount = new TemporalAmount() { in test_plus_TemporalAmount_DaysHours() local
670 pymd(4, 5, 6).plus(amount); in test_plus_TemporalAmount_DaysHours()
[all …]
/libcore/ojluni/src/main/java/java/time/chrono/
DChronoLocalDateTimeImpl.java372 long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY); in until() local
374 case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break; in until()
375 case MICROS: amount = Math.multiplyExact(amount, MICROS_PER_DAY); break; in until()
376 case MILLIS: amount = Math.multiplyExact(amount, MILLIS_PER_DAY); break; in until()
377 case SECONDS: amount = Math.multiplyExact(amount, SECONDS_PER_DAY); break; in until()
378 case MINUTES: amount = Math.multiplyExact(amount, MINUTES_PER_DAY); break; in until()
379 case HOURS: amount = Math.multiplyExact(amount, HOURS_PER_DAY); break; in until()
380 case HALF_DAYS: amount = Math.multiplyExact(amount, 2); break; in until()
382 return Math.addExact(amount, time.until(end.toLocalTime(), unit)); in until()
DChronoPeriodImpl.java176 ChronoPeriodImpl amount = validateAmount(amountToAdd); in plus() local
179 Math.addExact(years, amount.years), in plus()
180 Math.addExact(months, amount.months), in plus()
181 Math.addExact(days, amount.days)); in plus()
186 ChronoPeriodImpl amount = validateAmount(amountToSubtract); in minus() local
189 Math.subtractExact(years, amount.years), in minus()
190 Math.subtractExact(months, amount.months), in minus()
191 Math.subtractExact(days, amount.days)); in minus()
200 private ChronoPeriodImpl validateAmount(TemporalAmount amount) { in validateAmount() argument
201 Objects.requireNonNull(amount, "amount"); in validateAmount()
[all …]
DChronoLocalDate.java451 default ChronoLocalDate plus(TemporalAmount amount) { in plus() argument
452 return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); in plus()
474 default ChronoLocalDate minus(TemporalAmount amount) { in minus() argument
475 return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); in minus()
DChronoLocalDateTime.java290 default ChronoLocalDateTime<D> plus(TemporalAmount amount) { in plus() argument
291 return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); in plus()
308 default ChronoLocalDateTime<D> minus(TemporalAmount amount) { in minus() argument
309 return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); in minus()
DChronoLocalDateImpl.java192 public D plus(TemporalAmount amount) { in plus() argument
193 return (D) ChronoLocalDate.super.plus(amount); in plus()
218 public D minus(TemporalAmount amount) { in minus() argument
219 return (D) ChronoLocalDate.super.minus(amount); in minus()
DChronoZonedDateTime.java437 default ChronoZonedDateTime<D> plus(TemporalAmount amount) { in plus() argument
438 return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); in plus()
455 default ChronoZonedDateTime<D> minus(TemporalAmount amount) { in minus() argument
456 return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); in minus()
DMinguoDate.java350 public MinguoDate plus(TemporalAmount amount) { in plus() argument
351 return super.plus(amount); in plus()
360 public MinguoDate minus(TemporalAmount amount) { in minus() argument
361 return super.minus(amount); in minus()
DThaiBuddhistDate.java350 public ThaiBuddhistDate plus(TemporalAmount amount) { in plus() argument
351 return super.plus(amount); in plus()
360 public ThaiBuddhistDate minus(TemporalAmount amount) { in minus() argument
361 return super.minus(amount); in minus()
/libcore/ojluni/src/main/java/java/time/temporal/
DTemporal.java261 default Temporal plus(TemporalAmount amount) { in plus() argument
262 return amount.addTo(this); in plus()
333 default Temporal minus(TemporalAmount amount) { in minus() argument
334 return amount.subtractFrom(this); in minus()
DChronoUnit.java265 public <R extends Temporal> R addTo(R temporal, long amount) { in addTo() argument
266 return (R) temporal.plus(amount, this); in addTo()
/libcore/ojluni/src/main/java/java/time/
DLocalDateTime.java1673 long amount = date.daysUntil(end.date); in until() local
1674 if (amount == 0) { in until()
1678 if (amount > 0) { in until()
1679 amount--; // safe in until()
1682 amount++; // safe in until()
1687 amount = Math.multiplyExact(amount, NANOS_PER_DAY); in until()
1690 amount = Math.multiplyExact(amount, MICROS_PER_DAY); in until()
1694 amount = Math.multiplyExact(amount, MILLIS_PER_DAY); in until()
1698 amount = Math.multiplyExact(amount, SECONDS_PER_DAY); in until()
1702 amount = Math.multiplyExact(amount, MINUTES_PER_DAY); in until()
[all …]
DPeriod.java252 public static Period from(TemporalAmount amount) { in from() argument
253 if (amount instanceof Period) { in from()
254 return (Period) amount; in from()
256 if (amount instanceof ChronoPeriod) { in from()
257 if (IsoChronology.INSTANCE.equals(((ChronoPeriod) amount).getChronology()) == false) { in from()
258 throw new DateTimeException("Period requires ISO chronology: " + amount); in from()
261 Objects.requireNonNull(amount, "amount"); in from()
265 for (TemporalUnit unit : amount.getUnits()) { in from()
266 long unitAmount = amount.get(unit); in from()
DDayOfWeek.java366 int amount = (int) (days % 7); in plus() local
367 return ENUMS[(ordinal() + (amount + 7)) % 7]; in plus()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/org/apache/harmony/kernel/dalvik/
DThreadsTest.java156 private final long amount; field in ThreadsTest.Parker
183 this.amount = absolute ? parkMillis : parkMillis * NANOS_PER_MILLI; in Parker()
197 long amount = this.amount; in run() local
203 UNSAFE.park(true, start + amount); in run()
205 UNSAFE.park(false, amount); in run()
/libcore/ojluni/src/main/java/java/util/
DGregorianCalendar.java920 public void add(int field, int amount) {
923 if (amount == 0) {
937 year += amount;
947 year -= amount;
958 int month = internalGet(MONTH) + amount;
1002 int era = internalGet(ERA) + amount;
1011 long delta = amount;
1049 delta = amount / 2;
1050 timeOfDay = 12 * (amount % 2);
1169 public void roll(int field, int amount) { in roll() argument
[all …]
DJapaneseImperialCalendar.java407 public void add(int field, int amount) { in add() argument
410 if (amount == 0) { in add()
423 d.addYear(amount); in add()
431 d.addMonth(amount); in add()
438 int era = internalGet(ERA) + amount; in add()
446 long delta = amount; in add()
484 delta = amount / 2; in add()
485 timeOfDay = 12 * (amount % 2); in add()
561 public void roll(int field, int amount) { in roll() argument
564 if (amount == 0) { in roll()
[all …]
/libcore/luni/src/test/java/libcore/java/time/
DOffsetTimeTest.java70 private static void assertPlusIsNoop(long amount, TemporalUnit unit) { in assertPlusIsNoop() argument
71 assertSame(NOON_UTC, NOON_UTC.plus(amount, unit)); in assertPlusIsNoop()
/libcore/ojluni/src/test/java/time/tck/java/time/temporal/
DTCKChronoUnit.java169 …tAndTemporal(ChronoUnit unit, Temporal base, boolean isSupportedBy, long amount, Temporal target)… in test_unitAndTemporal() argument
172 Temporal result = unit.addTo(base, amount); in test_unitAndTemporal()
174 assertEquals(unit.between(base, result), amount); in test_unitAndTemporal() local

12