test_class.declarator: tmp = new TemporaryFolder()
test_class.modifier: public @Rule
test_class.original_string: public @Rule TemporaryFolder tmp = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: tmp
test_class.file: cli/src/test/java/com/github/olivergondza/dumpling/cli/SampleCommandTest.java
test_class.identifier: SampleCommandTest
test_class.superclass: extends AbstractCliTest
test_case.body: @Test
      public void parseInterval() throws Exception {
          SampleCommand sc = new SampleCommand();
          sc.setInterval("50");
          assertThat(sc.interval, equalTo(50000L));
  
          sc.setInterval("1s");
          assertThat(sc.interval, equalTo(1000L));
  
          sc.setInterval("100ms");
          assertThat(sc.interval, equalTo(100L));
  
          sc.setInterval("5m");
          assertThat(sc.interval, equalTo(1000L * 60 * 5));
  
          sc.setInterval("1h");
          assertThat(sc.interval, equalTo(1000L * 60 * 60));
  
          try {
              sc.setInterval("1d");
          } catch (CmdLineException ex) {
  
          }
      }
test_case.class_method_signature: SampleCommandTest.parseInterval()
test_case.full_signature: @Test public void parseInterval()
test_case.identifier: parseInterval
test_case.invocations: setInterval assertThat equalTo setInterval assertThat equalTo setInterval assertThat equalTo setInterval assertThat equalTo setInterval assertThat equalTo setInterval
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void parseInterval()
focal_class.declarator: number = -1
focal_class.modifier: private
focal_class.original_string: private int number = -1;
focal_class.type: int
focal_class.var_name: number
focal_class.declarator: output
focal_class.modifier: @Option(name = "--out", aliases = {"-o"}, usage = "Output files to write the result")
      public
focal_class.original_string: @Option(name = "--out", aliases = {"-o"}, usage = "Output files to write the result")
      public String output;
focal_class.type: String
focal_class.var_name: output
focal_class.declarator: interval = -1
focal_class.modifier: public
focal_class.original_string: public long interval = -1;
focal_class.type: long
focal_class.var_name: interval
focal_class.declarator: handler
focal_class.modifier: @Argument(required = true, metaVar = "COMMAND")
      private
focal_class.original_string: @Argument(required = true, metaVar = "COMMAND")
      private CliCommand handler;
focal_class.type: CliCommand
focal_class.var_name: handler
focal_class.file: cli/src/main/java/com/github/olivergondza/dumpling/cli/SampleCommand.java
focal_class.identifier: SampleCommand
focal_class.interfaces: implements CliCommand
focal_class.class_method_signature: SampleCommand.setNumber(int number)
focal_class.full_signature: @Option(name = "--number", aliases = {"-n"}, usage = "Number of samples to take") public void setNumber(int number)
focal_class.identifier: setNumber
focal_class.modifiers: @Option(name = "--number", aliases = {"-n"}, usage = "Number of samples to take") public
focal_class.parameters: (int number)
focal_class.return: void
focal_class.signature: void setNumber(int number)
focal_class.class_method_signature: SampleCommand.setInterval(String interval)
focal_class.full_signature: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public void setInterval(String interval)
focal_class.identifier: setInterval
focal_class.modifiers: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public
focal_class.parameters: (String interval)
focal_class.return: void
focal_class.signature: void setInterval(String interval)
focal_class.class_method_signature: SampleCommand.getName()
focal_class.full_signature: @Override @Nonnull public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override @Nonnull public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: SampleCommand.getDescription()
focal_class.full_signature: @Override @Nonnull public String getDescription()
focal_class.identifier: getDescription
focal_class.modifiers: @Override @Nonnull public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getDescription()
focal_class.class_method_signature: SampleCommand.run(@Nonnull ProcessStream process)
focal_class.full_signature: @Override public int run(@Nonnull ProcessStream process)
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: (@Nonnull ProcessStream process)
focal_class.return: int
focal_class.signature: int run(@Nonnull ProcessStream process)
focal_class.class_method_signature: SampleCommand.getOutStream(int i)
focal_class.full_signature: @CheckForNull private PrintStream getOutStream(int i)
focal_class.identifier: getOutStream
focal_class.modifiers: @CheckForNull private
focal_class.parameters: (int i)
focal_class.return: PrintStream
focal_class.signature: PrintStream getOutStream(int i)
focal_method.body: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample")
      public void setInterval(String interval) throws CmdLineException {
          Matcher matcher = Pattern.compile("^(\\d+)([a-z]*)$").matcher(interval);
          if (!matcher.find()) throw new CmdLineException("Invalid interval specified: " + interval);
  
          int number = Integer.parseInt(matcher.group(1));
          String unit = matcher.group(2);
  
          if (unit.isEmpty() || "s".equals(unit)) {
              this.interval = TimeUnit.SECONDS.toMillis(number);
          } else if ("ms".equals(unit)) {
              this.interval = number; // Milliseconds already
          } else if ("m".equals(unit)) {
              this.interval = TimeUnit.MINUTES.toMillis(number);
          } else if ("h".equals(unit)) {
              this.interval = TimeUnit.HOURS.toMillis(number);
          }
      }
focal_method.class_method_signature: SampleCommand.setInterval(String interval)
focal_method.full_signature: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public void setInterval(String interval)
focal_method.identifier: setInterval
focal_method.invocations: matcher compile find parseInt group group isEmpty equals toMillis equals equals toMillis equals toMillis
focal_method.modifiers: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public
focal_method.parameters: (String interval)
focal_method.return: void
focal_method.signature: void setInterval(String interval)