test_class.declarator: df = TimeDurationFormatter.forLogging()
test_class.modifier: private
test_class.original_string: private TimeDurationFormatter df = TimeDurationFormatter.forLogging();
test_class.type: TimeDurationFormatter
test_class.var_name: df
test_class.declarator: dfu = new TimeDurationFormatter(Locale.GERMAN, 1, true)
test_class.modifier: private
test_class.original_string: private TimeDurationFormatter dfu = new TimeDurationFormatter(Locale.GERMAN, 1, true);
test_class.type: TimeDurationFormatter
test_class.var_name: dfu
test_class.file: oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/TimeDurationFormatterTest.java
test_class.identifier: TimeDurationFormatterTest
test_case.body: @Test
      public void defaultFormatter() {
          assertEquals("2.000 d", df.format(2, TimeUnit.DAYS));
          assertEquals("24.00 h", df.format(1, TimeUnit.DAYS));
          assertEquals("10.50 d", df.format(24 * 10 + 12, TimeUnit.HOURS));
          assertEquals("2.500 h", df.format(150, TimeUnit.MINUTES));
          assertEquals("10.00 min", df.format(10, TimeUnit.MINUTES));
          assertEquals("1234 us", df.format(1234, TimeUnit.MICROSECONDS));
          assertEquals("1234 ns", df.format(1234, TimeUnit.NANOSECONDS));
      }
test_case.class_method_signature: TimeDurationFormatterTest.defaultFormatter()
test_case.full_signature: @Test public void defaultFormatter()
test_case.identifier: defaultFormatter
test_case.invocations: assertEquals format assertEquals format assertEquals format assertEquals format assertEquals format assertEquals format assertEquals format
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void defaultFormatter()
focal_class.declarator: threshold
focal_class.modifier: private final
focal_class.original_string: private final int threshold;
focal_class.type: int
focal_class.var_name: threshold
focal_class.declarator: allowNonAscii
focal_class.modifier: private final
focal_class.original_string: private final boolean allowNonAscii;
focal_class.type: boolean
focal_class.var_name: allowNonAscii
focal_class.declarator: locale
focal_class.modifier: private final
focal_class.original_string: private final Locale locale;
focal_class.type: Locale
focal_class.var_name: locale
focal_class.declarator: UNITS = { TimeUnit.DAYS, TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS, TimeUnit.MILLISECONDS,
              TimeUnit.MICROSECONDS, TimeUnit.NANOSECONDS }
focal_class.modifier: private static
focal_class.original_string: private static TimeUnit[] UNITS = { TimeUnit.DAYS, TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS, TimeUnit.MILLISECONDS,
              TimeUnit.MICROSECONDS, TimeUnit.NANOSECONDS };
focal_class.type: TimeUnit[]
focal_class.var_name: UNITS
focal_class.declarator: DISPLAYUNIT
focal_class.modifier: private static
focal_class.original_string: private static Map<TimeUnit, String> DISPLAYUNIT;
focal_class.type: Map<TimeUnit, String>
focal_class.var_name: DISPLAYUNIT
focal_class.declarator: DISPLAYUNIT_ASCII
focal_class.modifier: private static
focal_class.original_string: private static Map<TimeUnit, String> DISPLAYUNIT_ASCII;
focal_class.type: Map<TimeUnit, String>
focal_class.var_name: DISPLAYUNIT_ASCII
focal_class.declarator: FOR_LOGGING = new TimeDurationFormatter(Locale.US, 2, false)
focal_class.modifier: private static
focal_class.original_string: private static TimeDurationFormatter FOR_LOGGING = new TimeDurationFormatter(Locale.US, 2, false);
focal_class.type: TimeDurationFormatter
focal_class.var_name: FOR_LOGGING
focal_class.file: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/TimeDurationFormatter.java
focal_class.identifier: TimeDurationFormatter
focal_class.class_method_signature: TimeDurationFormatter.forLogging()
focal_class.full_signature: public static TimeDurationFormatter forLogging()
focal_class.identifier: forLogging
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: TimeDurationFormatter
focal_class.signature: TimeDurationFormatter forLogging()
focal_class.class_method_signature: TimeDurationFormatter.TimeDurationFormatter(Locale locale, int threshold, boolean allowNonAscii)
focal_class.full_signature: public  TimeDurationFormatter(Locale locale, int threshold, boolean allowNonAscii)
focal_class.identifier: TimeDurationFormatter
focal_class.modifiers: public
focal_class.parameters: (Locale locale, int threshold, boolean allowNonAscii)
focal_class.signature:  TimeDurationFormatter(Locale locale, int threshold, boolean allowNonAscii)
focal_class.class_method_signature: TimeDurationFormatter.format(long amount, TimeUnit unit)
focal_class.full_signature: public String format(long amount, TimeUnit unit)
focal_class.identifier: format
focal_class.modifiers: public
focal_class.parameters: (long amount, TimeUnit unit)
focal_class.return: String
focal_class.signature: String format(long amount, TimeUnit unit)
focal_method.body: public String format(long amount, TimeUnit unit) {
          long nanos = unit.toNanos(amount);
  
          TimeUnit outputUnit = TimeUnit.NANOSECONDS;
          for (TimeUnit u : UNITS) {
              if (u.convert(nanos, TimeUnit.NANOSECONDS) >= this.threshold) {
                  outputUnit = u;
                  break;
              }
          }
  
          double convertedToUnit = ((double) nanos) / (TimeUnit.NANOSECONDS.convert(1, outputUnit));
  
          return String.format(this.locale, "%.4g %s", convertedToUnit,
                  this.allowNonAscii ? DISPLAYUNIT.get(outputUnit) : DISPLAYUNIT_ASCII.get(outputUnit));
      }
focal_method.class_method_signature: TimeDurationFormatter.format(long amount, TimeUnit unit)
focal_method.full_signature: public String format(long amount, TimeUnit unit)
focal_method.identifier: format
focal_method.invocations: toNanos convert convert format get get
focal_method.modifiers: public
focal_method.parameters: (long amount, TimeUnit unit)
focal_method.return: String
focal_method.signature: String format(long amount, TimeUnit unit)