public static SettingsPopulation get(Map<String, String[]> clArgs, SettingsCommand command)
    {
        // set default size to number of commands requested, unless set to err convergence, then use 1M
        String defaultLimit = command.count <= 0 ? "1000000" : Long.toString(command.count);

        String[] params = clArgs.remove("-pop");
        if (params == null)
        {
            if (command instanceof SettingsCommandUser && ((SettingsCommandUser)command).hasInsertOnly())
            {
                return new SettingsPopulation(new SequentialOptions(defaultLimit));
            }

            // return defaults:
            switch(command.type)
            {
                case WRITE:
                case COUNTER_WRITE:
                    return new SettingsPopulation(new SequentialOptions(defaultLimit));
                default:
                    return new SettingsPopulation(new DistributionOptions(defaultLimit));
            }
        }
        GroupedOptions options = GroupedOptions.select(params, new SequentialOptions(defaultLimit), new DistributionOptions(defaultLimit));
        if (options == null)
        {
            printHelp();
            System.out.println("Invalid -pop options provided, see output for valid options");
            System.exit(1);
        }
        return options instanceof SequentialOptions ?
                new SettingsPopulation((SequentialOptions) options) :
                new SettingsPopulation((DistributionOptions) options);
    }
public static SettingsPopulation get ( Map < String , String [ ] > clArgs , SettingsCommand command ) { String defaultLimit = command . count <= 0 ? "1000000" : Long . toString ( command . count ) ; String [ ] params = clArgs . remove ( "-pop" ) ; if ( params == null ) { if ( command instanceof SettingsCommandUser && ( ( SettingsCommandUser ) command ) . hasInsertOnly ( ) ) { return new SettingsPopulation ( new SequentialOptions ( defaultLimit ) ) ; } switch ( command . type ) { case WRITE : case COUNTER_WRITE : return new SettingsPopulation ( new SequentialOptions ( defaultLimit ) ) ; default : return new SettingsPopulation ( new DistributionOptions ( defaultLimit ) ) ; } } GroupedOptions options = GroupedOptions . select ( params , new SequentialOptions ( defaultLimit ) , new DistributionOptions ( defaultLimit ) ) ; if ( options == null ) { printHelp ( ) ; System . out . println ( "Invalid -pop options provided, see output for valid options" ) ; System . exit ( 1 ) ; } return options instanceof SequentialOptions ? new SettingsPopulation ( ( SequentialOptions ) options ) : new SettingsPopulation ( ( DistributionOptions ) options ) ; }
CLI Utility Methods