View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.rng.examples.sampling;
18  
19  import picocli.CommandLine;
20  
21  /**
22   * Executes testing utilities for the samplers in the Commons RNG library.
23   *
24   * <p>Functionality includes:</p>
25   *
26   * <ul>
27   *   <li>Creating a PDF approximation using sample data from a distribution
28   *   <li>Sampling from a small range from a distribution to visually inspect sampling density
29   * </ul>
30   */
31  public final class ExamplesSamplingApplication {
32      /** No public constructor. */
33      private ExamplesSamplingApplication() {}
34  
35      /**
36       * Run the RNG examples stress command line application.
37       *
38       * @param args Application's arguments.
39       */
40      public static void main(String[] args) {
41          // Build the command line manually so we can configure options.
42          final CommandLine cmd = new CommandLine(new ExamplesSamplingCommand())
43                  .addSubcommand("density", new ProbabilityDensityApproximationCommand())
44                  .addSubcommand("visual", new UniformSamplingVisualCheckCommand())
45                  // Call last to apply to all sub-commands
46                  .setCaseInsensitiveEnumValuesAllowed(true);
47  
48          // Parse the command line and invokes the Callable program
49          cmd.execute(args);
50      }
51  }