public class Domains extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Domains.Adaptor<S,T>
Provides a simple mechanism for adapting one domain for another return type.
|
| Modifier and Type | Field and Description |
|---|---|
static Domain |
EMPTY
A simple constant representing the empty domain.
|
| Constructor and Description |
|---|
Domains() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Domain<List<T>> |
append(Domain<List<T>> domain,
T item)
Map every element in a given domain of lists to a corresponding domain of
lists where each element has a given item appended onto the end.
|
static <T> void |
apply(Domain<T> domain,
long n,
java.util.function.Consumer<T> consumer)
Apply a given lambda consumer to exactly
n elements of a domain
chosen uniformly at random according to Knuth's algorithm S. |
static <T> void |
apply(Domain<T> domain,
java.util.function.Predicate<T> condition,
java.util.function.Consumer<T> consumer)
Apply a given lambda consumer to all elements matching a given condition of a
domain.
|
static Domain<Boolean> |
Bool()
A simple domain for boolean values.
|
static <T> Domain<T> |
Constrained(Domain<T> domain,
java.util.function.Predicate<T> constraint)
A domain constructed from all values in a given domain meeting a given
constraint.
|
static <T> Domain<T> |
Finite(T... items)
A domain constructed from a finite set of values.
|
static Domain<Integer> |
Int(int lower,
int upper)
A domain for integers based on a range which includes all values between a
given lower bound and a given upper bound (inclusive).
|
static <T> Domain<List<T>> |
List(int min,
int max,
Domain<T> generator)
Return a domain which generates lists whose length is between a given minimum
and maximum value.
|
static void |
main(String[] args) |
static <T> Domain<T> |
ParallelConstrained(Domain<T> domain,
java.util.function.Predicate<T> constraint)
An experimental domain constructed from all values in a given domain meeting
a given constraint.
|
static <T> Domain<T[]> |
Product(Domain<? extends T>[] fields,
T... dummy)
A domain construct from the cartesian product of a given set of fields.
|
static <T> Domain<T> |
Sample(Domain<T> domain,
int n)
Constraint a domain which contains exactly
n elements of a domain
chosen uniformly at random according to Knuth's algorithm S. |
static <T> Domain<T> |
Union(Domain<? extends T>... subdomains)
A domain constructed from the union of one or more other domain.
|
public static final Domain EMPTY
public static <T> void apply(Domain<T> domain, long n, java.util.function.Consumer<T> consumer)
n elements of a domain
chosen uniformly at random according to Knuth's algorithm S.domain - n - consumer - public static <T> Domain<T> Sample(Domain<T> domain, int n)
n elements of a domain
chosen uniformly at random according to Knuth's algorithm S.domain - n - consumer - public static <T> void apply(Domain<T> domain, java.util.function.Predicate<T> condition, java.util.function.Consumer<T> consumer)
domain - n - consumer - public static Domain<Integer> Int(int lower, int upper)
lower - The lower bound of integers to generateupper - The upper bound of integers to generatepublic static <T> Domain<List<T>> List(int min, int max, Domain<T> generator)
public static <T> Domain<List<T>> append(Domain<List<T>> domain, T item)
1 to the domain of integer lists gives the
following mappings.
[] => [1] [0] => [0,1] [0,1] => [0,1,1]
domain - item - public static <T> Domain<T> Union(Domain<? extends T>... subdomains)
T - public static <T> Domain<T[]> Product(Domain<? extends T>[] fields, T... dummy)
fields - The subdomains for each field of the product.dummy - This can be left empty (it is used to aid creating generated
areas).public static <T> Domain<T> Finite(T... items)
T - public static <T> Domain<T> Constrained(Domain<T> domain, java.util.function.Predicate<T> constraint)
domain - constraint - public static <T> Domain<T> ParallelConstrained(Domain<T> domain, java.util.function.Predicate<T> constraint)
domain - constraint - public static void main(String[] args)
Copyright © 2019. All rights reserved.