/** * 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()); }
/** * 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()); }
/** * 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 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 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 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()); }
/** * 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()); }
/** * Constructs discrete weighted value with specified <code>values</code> and <code>weights</code>. * * @param countValuePairs List of values with their corresponding weights. */ public ExactWeightedValue(List<CountValuePair<T>> countValuePairs) { if (countValuePairs == null || countValuePairs.isEmpty()) { throw new IllegalArgumentException("List of count value pairs cannot be null nor empty."); } this.distribution = new UniformDistribution(); this.counts = new ArrayList<>(); this.currentNumberOfValues = new ArrayList<>(); this.values = new ArrayList<>(); this.currentTotalCount = 0; for (CountValuePair<T> pair : countValuePairs) { currentTotalCount += pair.getCount(); counts.add(pair.getCount()); currentNumberOfValues.add(0L); values.add(pair.getValue()); } this.totalCount = currentTotalCount; }
/** * Constructs discrete weighted value with specified <code>values</code> and <code>weights</code>. * * @param countValuePairs List of values with their corresponding weights. */ public ExactWeightedValue(List<CountValuePair<T>> countValuePairs) { if (countValuePairs == null || countValuePairs.isEmpty()) { throw new IllegalArgumentException("List of count value pairs cannot be null nor empty."); } this.distribution = new UniformDistribution(); this.counts = new ArrayList<>(); this.currentNumberOfValues = new ArrayList<>(); this.values = new ArrayList<>(); this.currentTotalCount = 0; for (CountValuePair<T> pair : countValuePairs) { currentTotalCount += pair.getCount(); counts.add(pair.getCount()); currentNumberOfValues.add(0L); values.add(pair.getValue()); } this.totalCount = currentTotalCount; }
/** * Constructs random content string value with specified <code>lengthValue</code> and specified * <code>charRanges</code>. * * @param lengthValue Value that returns integer which represents length of generated string. It should never * generate length that is less than 1. * @param charRanges Ranges of characters from which string will be constructed. */ public RandomContentStringValue(Value<Integer> lengthValue, List<Range<Character>> charRanges) { if (lengthValue == null) { throw new IllegalArgumentException("lengthValue cannot be null."); } this.lengthValue = lengthValue; Set<Character> chars = new HashSet<>(); for (Range<Character> range : charRanges) { if (!range.isIncreasing()) { throw new IllegalArgumentException("All ranges must be increasing."); } for (Character c = range.getBeginning(); c <= range.getEnd(); c++) { chars.add(c); } } possibleCharacters = new ArrayList<>(chars); distribution = new UniformDistribution(); }
/** * Constructs random content string value with specified <code>lengthValue</code> and specified * <code>charRanges</code>. * * @param lengthValue Value that returns integer which represents length of generated string. It should never * generate length that is less than 1. * @param charRanges Ranges of characters from which string will be constructed. */ public RandomContentStringValue(Value<Integer> lengthValue, List<Range<Character>> charRanges) { if (lengthValue == null) { throw new IllegalArgumentException("lengthValue cannot be null."); } this.lengthValue = lengthValue; Set<Character> chars = new HashSet<>(); for (Range<Character> range : charRanges) { if (!range.isIncreasing()) { throw new IllegalArgumentException("All ranges must be increasing."); } for (Character c = range.getBeginning(); c <= range.getEnd(); c++) { chars.add(c); } } possibleCharacters = new ArrayList<>(chars); distribution = new UniformDistribution(); }
/** * Uniform distribution definition. * * @return Uniform distribution definition rule. */ public Rule uniformDistribution() { return Sequence(function("uniform"), push(new UniformDistribution())); }
/** * Uniform distribution definition. * * @return Uniform distribution definition rule. */ public Rule uniformDistribution() { return Sequence(function("uniform"), push(new UniformDistribution())); }