/** * Constructs range value with specified <code>range</code> and <code>useEdgeCases</code>. * <code>distribution</code> is set to {@link UniformDistribution}. * * @param beginning The beginning of the range. * @param end The end of the range. * @param useEdgeCases Indicates whether to create edge cases as first two values or not. */ public RangeValueLocalDate(LocalDate beginning, LocalDate end, boolean useEdgeCases) { this(beginning, end, useEdgeCases, new UniformDistribution()); }
private double normalize(double value, double normalizationLowerBound, double normalizationUpperBound) { double boundedValue = boundValue(value); // normalize boundedValue to new range double normalizedRange = normalizationUpperBound - normalizationLowerBound; return (((boundedValue - lower) * normalizedRange) / innerRange) + normalizationLowerBound; }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = end - 1; return; } val = distribution.nextInt(beginning, end); } }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = end - EPSILON; return; } val = (float) distribution.nextDouble(beginning, end); } }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = end - 1; return; } val = distribution.nextLong(beginning, end); } }
/** * Constructs random length list value out of specified values. * * @param minLength Minimum list length * @param maxLength Maximum list length * @param elementGenerator Element generator */ public RandomLengthListValue(int minLength, int maxLength, Value<T> elementGenerator) { this(minLength, maxLength, elementGenerator, new UniformDistribution()); }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = end - 1; return; } val = distribution.nextInt(beginning, end); } }
private double normalize(double value, double normalizationLowerBound, double normalizationUpperBound) { double boundedValue = boundValue(value); // normalize boundedValue to new range double normalizedRange = normalizationUpperBound - normalizationLowerBound; return (((boundedValue - lower) * normalizedRange) / innerRange) + normalizationLowerBound; }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = end - EPSILON; return; } val = (float) distribution.nextDouble(beginning, end); } }
/** * Constructs range value with specified <code>range</code> and <code>useEdgeCases</code>. <code>distribution</code> * is set to {@link UniformDistribution}. * * @param beginning The beginning of the range. * @param end The end of the range. * @param useEdgeCases Indicates whether to create edge cases as first two values or not. */ public RangeValueLocalDateTime(LocalDateTime beginning, LocalDateTime end, boolean useEdgeCases) { this(beginning, end, useEdgeCases, new UniformDistribution()); }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = (byte) (end - 1); return; } val = (byte) distribution.nextInt(beginning, end); } }
/** * Constructs discrete value with specified <code>values</code>, <code>distribution</code> is set to Uniform * distribution. * * @param values List of possible values. */ public DiscreteValue(List<Value<T>> values) { this(values, new UniformDistribution()); }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = (short) (end - 1); return; } val = (short) distribution.nextInt(beginning, end); } }
/** * Default value for <code>distribution</code> property. * * @return Default value for <code>distribution</code> property. */ public static Distribution defaultDistrbution() { return new UniformDistribution(); } }
@Override protected void eval() { if (useEdgeCases && !beginningEdgeCaseUsed) { beginningEdgeCaseUsed = true; val = beginning; return; } if (useEdgeCases && !endEdgeCaseUsed) { endEdgeCaseUsed = true; val = (short) (end - 1); return; } val = (short) distribution.nextInt(beginning, end); } }
/** * Constructs random length list value out of specified values. * * @param minLength Minimum list length * @param maxLength Maximum list length * @param elementGenerator Element generator */ public RandomLengthListValue(int minLength, int maxLength, Value<T> elementGenerator) { this(minLength, maxLength, elementGenerator, new UniformDistribution()); }
/** * Constructs discrete value with specified <code>values</code>, <code>distribution</code> is set to Uniform * distribution. * * @param values List of possible values. */ public DiscreteValue(List<Value<T>> values) { this(values, new UniformDistribution()); }
/** * Default value for <code>distribution</code> property. * * @return Default value for <code>distribution</code> property. */ public static Distribution defaultDistrbution() { return new UniformDistribution(); } }
/** * Constructs range value with specified <code>range</code> and <code>useEdgeCases</code>. <code>distribution</code> * is set to {@link UniformDistribution}. * * @param beginning The beginning of the range. * @param end The end of the range. * @param useEdgeCases Indicates whether to create edge cases as first two values or not. */ public RangeValueLocalDateTime(LocalDateTime beginning, LocalDateTime end, boolean useEdgeCases) { this(beginning, end, useEdgeCases, new UniformDistribution()); }
/** * Constructs range value with specified <code>range</code> and <code>useEdgeCases</code>. * <code>distribution</code> is set to {@link UniformDistribution}. * * @param beginning The beginning of the range. * @param end The end of the range. * @param useEdgeCases Indicates whether to create edge cases as first two values or not. */ public RangeValueLocalDate(LocalDate beginning, LocalDate end, boolean useEdgeCases) { this(beginning, end, useEdgeCases, new UniformDistribution()); }