public Head(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.limit = getConfigs().getLong(config, "limit", -1); if (limit < -1) { throw new MorphlineCompilationException("Illegal limit: " + limit, config); } validateArguments(); }
public Head(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.limit = getConfigs().getLong(config, "limit", -1); if (limit < -1) { throw new MorphlineCompilationException("Illegal limit: " + limit, config); } validateArguments(); }
public Sample(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.probability = getConfigs().getDouble(config, "probability", 1.0); if (probability < 0.0) { throw new MorphlineCompilationException("Probability must not be negative: " + probability, config); } if (probability >= 1.0) { this.prng = null; } else { if (config.hasPath("seed")) { long seed = getConfigs().getLong(config, "seed"); this.prng = new Well19937c(seed); // non-secure & fast } else { Random rand = new SecureRandom(); int[] seed = new int[624]; for (int i = 0; i < seed.length; i++) { seed[i] = rand.nextInt(); } this.prng = new Well19937c(seed); // non-secure & fast } } validateArguments(); }
public Sample(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.probability = getConfigs().getDouble(config, "probability", 1.0); if (probability < 0.0) { throw new MorphlineCompilationException("Probability must not be negative: " + probability, config); } if (probability >= 1.0) { this.prng = null; } else { if (config.hasPath("seed")) { long seed = getConfigs().getLong(config, "seed"); this.prng = new Well19937c(seed); // non-secure & fast } else { Random rand = new SecureRandom(); int[] seed = new int[624]; for (int i = 0; i < seed.length; i++) { seed[i] = rand.nextInt(); } this.prng = new Well19937c(seed); // non-secure & fast } } validateArguments(); }