/* */ package com.ibm.icu.impl.duration;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class OneOrTwoUnitBuilder
/* */ extends PeriodBuilderImpl
/* */ {
/* */ OneOrTwoUnitBuilder(BasicPeriodBuilderFactory.Settings settings)
/* */ {
/* 421 */ super(settings);
/* */ }
/* */
/* */ public static OneOrTwoUnitBuilder get(BasicPeriodBuilderFactory.Settings settings) {
/* 425 */ if (settings == null) {
/* 426 */ return null;
/* */ }
/* 428 */ return new OneOrTwoUnitBuilder(settings);
/* */ }
/* */
/* */ protected PeriodBuilder withSettings(BasicPeriodBuilderFactory.Settings settingsToUse) {
/* 432 */ return get(settingsToUse);
/* */ }
/* */
/* */ protected Period handleCreate(long duration, long referenceDate, boolean inPast)
/* */ {
/* 437 */ Period period = null;
/* 438 */ short uset = this.settings.effectiveSet();
/* 439 */ for (int i = 0; i < TimeUnit.units.length; i++) {
/* 440 */ if (0 != (uset & 1 << i)) {
/* 441 */ TimeUnit unit = TimeUnit.units[i];
/* 442 */ long unitDuration = approximateDurationOf(unit);
/* 443 */ if ((duration >= unitDuration) || (period != null)) {
/* 444 */ double count = duration / unitDuration;
/* 445 */ if (period == null) {
/* 446 */ if (count >= 2.0D) {
/* 447 */ period = Period.at((float)count, unit);
/* 448 */ break;
/* */ }
/* 450 */ period = Period.at(1.0F, unit).inPast(inPast);
/* 451 */ duration -= unitDuration;
/* */ } else {
/* 453 */ if (count < 1.0D) break;
/* 454 */ period = period.and((float)count, unit); break;
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* 461 */ return period;
/* */ }
/* */ }
/* Location: C:\Users\Ethan\Desktop\FontZip\FontTool\sfnttool.jar!\com\ibm\icu\impl\duration\OneOrTwoUnitBuilder.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/