/libcore/ojluni/src/test/java/time/tck/java/time/ |
D | MockSimplePeriod.java | 95 private final TemporalUnit unit; 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 112 Objects.requireNonNull(unit, "unit"); in MockSimplePeriod() 113 if (unit == FOREVER) { in MockSimplePeriod() 117 this.unit = unit; in MockSimplePeriod() 121 public long get(TemporalUnit unit) { in get() argument 136 return unit; in getUnit() 142 return temporal.plus(amount, unit); in addTo() [all …]
|
/libcore/ojluni/src/test/java/time/test/java/time/ |
D | MockSimplePeriod.java | 95 private final TemporalUnit unit; 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 112 Objects.requireNonNull(unit, "unit"); in MockSimplePeriod() 113 if (unit == FOREVER) { in MockSimplePeriod() 117 this.unit = unit; in MockSimplePeriod() 121 public long get(TemporalUnit unit) { in get() argument 136 return unit; in getUnit() 142 return temporal.plus(amount, unit); in addTo() [all …]
|
/libcore/ojluni/src/main/java/java/nio/file/attribute/ |
D | FileTime.java | 57 private final TimeUnit unit; field in FileTime 77 private FileTime(long value, TimeUnit unit, Instant instant) { in FileTime() argument 79 this.unit = unit; in FileTime() 95 public static FileTime from(long value, TimeUnit unit) { in from() argument 96 Objects.requireNonNull(unit, "unit"); in from() 97 return new FileTime(value, unit, null); in from() 141 public long to(TimeUnit unit) { in to() argument 142 Objects.requireNonNull(unit, "unit"); in to() 143 if (this.unit != null) { in to() 144 return unit.convert(this.value, this.unit); in to() [all …]
|
/libcore/ojluni/src/main/java/java/time/temporal/ |
D | Temporal.java | 152 boolean isSupported(TemporalUnit unit); in isSupported() argument 297 Temporal plus(long amountToAdd, TemporalUnit unit); in plus() argument 369 default Temporal minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 370 …oSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, u… in minus() 447 long until(Temporal endExclusive, TemporalUnit unit); in until() argument
|
/libcore/ojluni/src/main/java/java/time/ |
D | Year.java | 396 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 397 if (unit instanceof ChronoUnit) { in isSupported() 398 … return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; in isSupported() 400 return unit != null && unit.isSupportedBy(this); in isSupported() 702 public Year plus(long amountToAdd, TemporalUnit unit) { in plus() argument 703 if (unit instanceof ChronoUnit) { in plus() 704 switch ((ChronoUnit) unit) { in plus() 711 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 713 return unit.addTo(this, amountToAdd); in plus() 778 public Year minus(long amountToSubtract, TemporalUnit unit) { in minus() argument [all …]
|
D | YearMonth.java | 384 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 385 if (unit instanceof ChronoUnit) { in isSupported() 386 …return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNI… in isSupported() 388 return unit != null && unit.isSupportedBy(this); in isSupported() 799 public YearMonth plus(long amountToAdd, TemporalUnit unit) { in plus() argument 800 if (unit instanceof ChronoUnit) { in plus() 801 switch ((ChronoUnit) unit) { in plus() 809 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 811 return unit.addTo(this, amountToAdd); in plus() 897 public YearMonth minus(long amountToSubtract, TemporalUnit unit) { in minus() argument [all …]
|
D | Instant.java | 488 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 489 if (unit instanceof ChronoUnit) { in isSupported() 490 return unit.isTimeBased() || unit == DAYS; in isSupported() 492 return unit != null && unit.isSupportedBy(this); in isSupported() 742 public Instant truncatedTo(TemporalUnit unit) { in truncatedTo() argument 743 if (unit == ChronoUnit.NANOS) { in truncatedTo() 746 Duration unitDur = unit.getDuration(); in truncatedTo() 844 public Instant plus(long amountToAdd, TemporalUnit unit) { in plus() argument 845 if (unit instanceof ChronoUnit) { in plus() 846 switch ((ChronoUnit) unit) { in plus() [all …]
|
D | Duration.java | 303 public static Duration of(long amount, TemporalUnit unit) { in of() argument 304 return ZERO.plus(amount, unit); in of() 331 for (TemporalUnit unit : amount.getUnits()) { in from() 332 duration = duration.plus(amount.get(unit), unit); in from() 527 public long get(TemporalUnit unit) { in get() argument 528 if (unit == SECONDS) { in get() 530 } else if (unit == NANOS) { in get() 533 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in get() 691 public Duration plus(long amountToAdd, TemporalUnit unit) { in plus() argument 692 Objects.requireNonNull(unit, "unit"); in plus() [all …]
|
D | OffsetTime.java | 425 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 426 if (unit instanceof ChronoUnit) { in isSupported() 427 return unit.isTimeBased(); in isSupported() 429 return unit != null && unit.isSupportedBy(this); in isSupported() 816 public OffsetTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 817 return with(time.truncatedTo(unit), offset); in truncatedTo() 872 public OffsetTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 873 if (unit instanceof ChronoUnit) { in plus() 874 return with(time.plus(amountToAdd, unit), offset); in plus() 876 return unit.addTo(this, amountToAdd); in plus() [all …]
|
D | LocalTime.java | 570 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 571 if (unit instanceof ChronoUnit) { in isSupported() 572 return unit.isTimeBased(); in isSupported() 574 return unit != null && unit.isSupportedBy(this); in isSupported() 966 public LocalTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 967 if (unit == ChronoUnit.NANOS) { in truncatedTo() 970 Duration unitDur = unit.getDuration(); in truncatedTo() 1061 public LocalTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 1062 if (unit instanceof ChronoUnit) { in plus() 1063 switch ((ChronoUnit) unit) { in plus() [all …]
|
D | OffsetDateTime.java | 519 public boolean isSupported(TemporalUnit unit) { in isSupported() argument 520 if (unit instanceof ChronoUnit) { in isSupported() 521 return unit != FOREVER; in isSupported() 523 return unit != null && unit.isSupportedBy(this); in isSupported() 1126 public OffsetDateTime truncatedTo(TemporalUnit unit) { in truncatedTo() argument 1127 return with(dateTime.truncatedTo(unit), offset); in truncatedTo() 1182 public OffsetDateTime plus(long amountToAdd, TemporalUnit unit) { in plus() argument 1183 if (unit instanceof ChronoUnit) { in plus() 1184 return with(dateTime.plus(amountToAdd, unit), offset); in plus() 1186 return unit.addTo(this, amountToAdd); in plus() [all …]
|
/libcore/ojluni/src/main/java/java/time/chrono/ |
D | ChronoLocalDate.java | 409 default boolean isSupported(TemporalUnit unit) { in isSupported() argument 410 if (unit instanceof ChronoUnit) { in isSupported() 411 return unit.isDateBased(); in isSupported() 413 return unit != null && unit.isSupportedBy(this); in isSupported() 458 default ChronoLocalDate plus(long amountToAdd, TemporalUnit unit) { in plus() argument 459 if (unit instanceof ChronoUnit) { in plus() 460 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 462 return ChronoLocalDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); in plus() 482 default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 483 …urn ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); in minus() [all …]
|
D | ChronoLocalDateImpl.java | 198 public D plus(long amountToAdd, TemporalUnit unit) { in plus() argument 199 if (unit instanceof ChronoUnit) { in plus() 200 ChronoUnit f = (ChronoUnit) unit; in plus() 211 throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); in plus() 213 return (D) ChronoLocalDate.super.plus(amountToAdd, unit); in plus() 224 public D minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 225 return (D) ChronoLocalDate.super.minus(amountToSubtract, unit); in minus() 376 public long until(Temporal endExclusive, TemporalUnit unit) { in until() argument 379 if (unit instanceof ChronoUnit) { in until() 380 switch ((ChronoUnit) unit) { in until() [all …]
|
D | ChronoPeriod.java | 137 long get(TemporalUnit unit); in get() argument 173 for (TemporalUnit unit : getUnits()) { in isZero() 174 if (get(unit) != 0) { in isZero() 187 for (TemporalUnit unit : getUnits()) { in isNegative() 188 if (get(unit) < 0) { in isNegative()
|
D | ChronoLocalDateTimeImpl.java | 304 public ChronoLocalDateTimeImpl<D> plus(long amountToAdd, TemporalUnit unit) { in plus() argument 305 if (unit instanceof ChronoUnit) { in plus() 306 ChronoUnit f = (ChronoUnit) unit; in plus() 316 return with(date.plus(amountToAdd, unit), time); in plus() 318 … return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), unit.addTo(this, amountToAdd)); in plus() 371 public long until(Temporal endExclusive, TemporalUnit unit) { in until() argument 375 if (unit instanceof ChronoUnit) { in until() 376 if (unit.isTimeBased()) { in until() 378 switch ((ChronoUnit) unit) { in until() 387 return Math.addExact(amount, time.until(end.toLocalTime(), unit)); in until() [all …]
|
D | ChronoLocalDateTime.java | 250 default boolean isSupported(TemporalUnit unit) { in isSupported() argument 251 if (unit instanceof ChronoUnit) { in isSupported() 252 return unit != FOREVER; in isSupported() 254 return unit != null && unit.isSupportedBy(this); in isSupported() 293 ChronoLocalDateTime<D> plus(long amountToAdd, TemporalUnit unit); in plus() argument 311 default ChronoLocalDateTime<D> minus(long amountToSubtract, TemporalUnit unit) { in minus() argument 312 …ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); in minus()
|
/libcore/ojluni/src/test/java/time/tck/java/time/temporal/ |
D | TCKChronoUnit.java | 123 …public void test_unitType(ChronoUnit unit, boolean isDateBased, boolean isTimeBased, boolean isDur… in test_unitType() argument 124 assertEquals(unit.isDateBased(), isDateBased); in test_unitType() 125 assertEquals(unit.isTimeBased(), isTimeBased); in test_unitType() 126 assertEquals(unit.isDurationEstimated(), isDurationEstimated); in test_unitType() 169 …public void test_unitAndTemporal(ChronoUnit unit, Temporal base, boolean isSupportedBy, long amoun… in test_unitAndTemporal() argument 170 assertEquals(unit.isSupportedBy(base), isSupportedBy); in test_unitAndTemporal() 172 Temporal result = unit.addTo(base, amount); in test_unitAndTemporal() 174 assertEquals(unit.between(base, result), amount); in test_unitAndTemporal() 183 for (ChronoUnit unit : ChronoUnit.values()) { in test_valueOf() 184 assertEquals(ChronoUnit.valueOf(unit.name()), unit); in test_valueOf() local
|
/libcore/luni/src/test/java/libcore/java/time/ |
D | OffsetTimeTest.java | 70 private static void assertPlusIsNoop(long amount, TemporalUnit unit) { in assertPlusIsNoop() argument 71 assertSame(NOON_UTC, NOON_UTC.plus(amount, unit)); in assertPlusIsNoop() 76 for (ChronoUnit unit : EnumSet.range(ChronoUnit.DAYS, ChronoUnit.FOREVER)) { in test_plus_minus_invalidUnits() 78 NOON_UTC.plus(1, unit); in test_plus_minus_invalidUnits() 79 fail("Adding 1 " + unit + " should have failed."); in test_plus_minus_invalidUnits() 83 NOON_UTC.minus(1, unit); in test_plus_minus_invalidUnits() 84 fail("Subtracting 1 " + unit + " should have failed."); in test_plus_minus_invalidUnits()
|
/libcore/ojluni/src/test/java/nio/file/attribute/ |
D | FileTimeTest.java | 116 for (TimeUnit unit: TimeUnit.values()) { in main() 117 for (int i=0; i<100; i++) { to(rand.nextLong(), unit); } in main() local 118 to(Long.MIN_VALUE, unit); in main() 119 to(Long.MAX_VALUE, unit); in main() 124 for (TimeUnit unit : EnumSet.allOf(TimeUnit.class)) { in main() 127 FileTime ft = FileTime.from(value, unit); in main() 130 eqTime(value, unit, instant); in main() 134 for (TimeUnit unit : EnumSet.allOf(TimeUnit.class)) { in main() 136 FileTime ft = FileTime.from(value, unit); in main() 138 if (unit.compareTo(TimeUnit.SECONDS) < 0) { in main() [all …]
|
/libcore/ojluni/src/main/java/java/util/concurrent/ |
D | BlockingDeque.java | 324 boolean offerFirst(E e, long timeout, TimeUnit unit) in offerFirst() argument 346 boolean offerLast(E e, long timeout, TimeUnit unit) in offerLast() argument 380 E pollFirst(long timeout, TimeUnit unit) in pollFirst() argument 396 E pollLast(long timeout, TimeUnit unit) in pollLast() argument 513 boolean offer(E e, long timeout, TimeUnit unit) in offer() argument 564 E poll(long timeout, TimeUnit unit) in poll() argument
|
D | ScheduledExecutorService.java | 111 long delay, TimeUnit unit); in schedule() argument 127 long delay, TimeUnit unit); in schedule() argument 171 TimeUnit unit); in scheduleAtFixedRate() argument 211 TimeUnit unit); in scheduleWithFixedDelay() argument
|
D | Executors.java | 635 public boolean awaitTermination(long timeout, TimeUnit unit) 637 return e.awaitTermination(timeout, unit); 653 long timeout, TimeUnit unit) 655 return e.invokeAll(tasks, timeout, unit); 662 long timeout, TimeUnit unit) 664 return e.invokeAny(tasks, timeout, unit); 690 public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { 691 return e.schedule(command, delay, unit); 693 public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { 694 return e.schedule(callable, delay, unit); [all …]
|
D | ScheduledThreadPoolExecutor.java | 240 public long getDelay(TimeUnit unit) { in getDelay() argument 241 return unit.convert(time - System.nanoTime(), NANOSECONDS); in getDelay() 520 private long triggerTime(long delay, TimeUnit unit) { in triggerTime() argument 521 return triggerTime(unit.toNanos((delay < 0) ? 0 : delay)); in triggerTime() 555 TimeUnit unit) { in schedule() argument 556 if (command == null || unit == null) in schedule() 560 triggerTime(delay, unit), in schedule() 572 TimeUnit unit) { in schedule() argument 573 if (callable == null || unit == null) in schedule() 577 triggerTime(delay, unit), in schedule() [all …]
|
/libcore/ojluni/src/main/java/java/lang/ |
D | Process.java | 186 public boolean waitFor(long timeout, TimeUnit unit) in waitFor() argument 190 long rem = unit.toNanos(timeout); in waitFor() 201 rem = unit.toNanos(timeout) - (System.nanoTime() - startTime); in waitFor()
|
/libcore/ojluni/src/main/java/sun/nio/ch/ |
D | AsynchronousSocketChannelImpl.java | 219 TimeUnit unit, in implRead() argument 228 TimeUnit unit, in read() argument 276 return implRead(isScatteringRead, dst, dsts, timeout, unit, att, handler); in read() 289 TimeUnit unit, in read() argument 297 read(false, dst, null, timeout, unit, attachment, handler); in read() 305 TimeUnit unit, in read() argument 318 read(true, null, bufs, timeout, unit, attachment, handler); in read() 328 TimeUnit unit, in implWrite() argument 337 TimeUnit unit, in write() argument 382 return implWrite(isGatheringWrite, src, srcs, timeout, unit, att, handler); in write() [all …]
|