static enum TimeScale implements PcpScale<Duration> { NANOSECOND(0, SI.SECOND.divide(1000000000)), MICROSECOND(1, SI.SECOND.divide(1000000)), MILLISECOND(2, SI.SECOND.divide(1000)), SECOND(3, SI.SECOND), MINUTE(4, NonSI.MINUTE), HOUR(5, NonSI.HOUR); private final int pmUnitsValue; private final Unit<Duration> unit; private TimeScale(int pmUnitsValue, Unit<Duration> unit) { this.pmUnitsValue = pmUnitsValue; this.unit = unit; } @Override public Unit<Duration> getUnit() { return unit; } @Override public int getPmUnitsValue() { return pmUnitsValue; } }
/** * Returns {@code true} if the specified unit is compatible with {@linkplain SI#SECOND seconds}. * This method is invoked at construction time for checking units compatibility. * * @since 2.2 */ @Override protected boolean isCompatibleUnit(final AxisDirection direction, final Unit<?> unit) { return SI.SECOND.isCompatible(unit); }