SP
- state property typeTP
- transition property type@ParametersAreNonnullByDefault public class RandomICAutomatonGenerator<SP,TP> extends Object
The object state of instances of this class only determines how state and
transition properties are assigned. These can be set conveniently using
the with...
methods in a fluent interface-like manner.
For conveniently generating initially connected deterministic automata of
certain types, consider using the static methods defined in class
RandomAutomata
, such as
RandomAutomata.randomICDFA(Random, int, Alphabet, boolean)
.
Constructor and Description |
---|
RandomICAutomatonGenerator() |
Modifier and Type | Method and Description |
---|---|
static RandomICAutomatonGenerator<Boolean,Void> |
forDFA()
Creates a random IC automaton generator instance for generating DFAs.
|
static RandomICAutomatonGenerator<Boolean,Void> |
forDFA(double acceptingRatio)
Creates a random IC automaton generator instance for generating DFAs.
|
<I,A extends MutableDeterministic<?,I,?,? super SP,? super TP>> |
generateICDeterministicAutomaton(int numStates,
Alphabet<I> alphabet,
AutomatonCreator<? extends A,I> creator,
Random r)
Generates an initially-connected (IC) deterministic automaton with the given parameters.
|
<I,A extends MutableDeterministic<?,I,?,? super SP,? super TP>> |
generateICDeterministicAutomaton(int numStates,
Collection<? extends I> inputs,
A result,
Random r)
Generates an initially connected (IC) deterministic automaton with the given
parameters.
|
RandomICAutomatonGenerator<SP,TP> |
withStateProperties(Collection<? extends SP> possibleSps)
Sets the possible state properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withStateProperties(Function<? super Random,? extends SP> spFunc)
Sets the function for supplying state properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withStateProperties(SP... possibleSps)
Sets the possible state properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withStateProperties(Supplier<? extends SP> spSupplier)
Sets the supplier for state properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withTransitionProperties(Collection<? extends TP> possibleTps)
Sets the possible transition properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withTransitionProperties(Function<? super Random,? extends TP> tpFunc)
Sets the function for supplying transition properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withTransitionProperties(Supplier<? extends TP> tpSupplier)
Sets the supplier for transition properties, and returns
this . |
RandomICAutomatonGenerator<SP,TP> |
withTransitionProperties(TP... possibleTps)
Sets the possible transition properties, and returns
this . |
public static RandomICAutomatonGenerator<Boolean,Void> forDFA()
public static RandomICAutomatonGenerator<Boolean,Void> forDFA(double acceptingRatio)
acceptingRatio
parameter controls the probability of a state in a generated automaton being an accepting state.acceptingRatio
- the (approximate) ratio of accepting states in generated automatapublic RandomICAutomatonGenerator<SP,TP> withStateProperties(Supplier<? extends SP> spSupplier)
this
.
Using this function is discouraged, as it ignores the Random
instance passed to the generation
functions. If possible, use withStateProperties(Function)
.
spSupplier
- the supplier for state propertiesthis
public RandomICAutomatonGenerator<SP,TP> withStateProperties(Function<? super Random,? extends SP> spFunc)
this
.spFunc
- the function that supplies state properties, using a Random
object as a source
for randomnessthis
public RandomICAutomatonGenerator<SP,TP> withStateProperties(Collection<? extends SP> possibleSps)
this
. The collection is internally converted into
a list, from which state properties are selected using RandomUtil.choose(List, Random)
. If the
collection is empty, null
will always be chosen as the state property.
Note that if the collection contains elements several times, the probability of these elements being selected is proportionally higher.
possibleSps
- the collection of possible state propertiesthis
@SafeVarargs public final RandomICAutomatonGenerator<SP,TP> withStateProperties(SP... possibleSps)
this
. State properties are selected from this
array using RandomUtil.choose(Object[], Random)
. If the array is empty, null
will always
be chosen as the state property.possibleSps
- the possible state propertiesthis
public RandomICAutomatonGenerator<SP,TP> withTransitionProperties(Supplier<? extends TP> tpSupplier)
this
.
Using this function is discouraged, as it ignores the Random
instance passed to the generation
functions. If possible, use withTransitionProperties(Function)
.
tpSupplier
- the supplier for transition propertiesthis
public RandomICAutomatonGenerator<SP,TP> withTransitionProperties(Function<? super Random,? extends TP> tpFunc)
this
.tpFunc
- the function that supplies transition properties, using a Random
object as a source
for randomnessthis
public RandomICAutomatonGenerator<SP,TP> withTransitionProperties(Collection<? extends TP> possibleTps)
this
. The collection is internally converted into
a list, from which transition properties are selected using RandomUtil.choose(List, Random)
. If the
collection is empty, null
will always be chosen as the transition property.
Note that if the collection contains elements several times, the probability of these elements being selected is proportionally higher.
possibleTps
- the collection of possible transition propertiesthis
@SafeVarargs public final RandomICAutomatonGenerator<SP,TP> withTransitionProperties(TP... possibleTps)
this
. Transition properties are selected from this
array using RandomUtil.choose(Object[], Random)
. If the array is empty, null
will always
be chosen as the state property.possibleTps
- the possible transition propertiesthis
public <I,A extends MutableDeterministic<?,I,?,? super SP,? super TP>> A generateICDeterministicAutomaton(int numStates, Collection<? extends I> inputs, A result, Random r)
numStates
- the number of states of the resulting automatoninputs
- the input symbols to consider during generationresult
- the result automaton (should be empty)r
- the randomness sourcepublic <I,A extends MutableDeterministic<?,I,?,? super SP,? super TP>> A generateICDeterministicAutomaton(int numStates, Alphabet<I> alphabet, AutomatonCreator<? extends A,I> creator, Random r)
creator
. Note that the
resulting automaton will not be minimized.numStates
- the number of states of the resulting automatonalphabet
- the input alphabet of the resulting automatoncreator
- an AutomatonCreator
for instantiating the result automatonr
- the randomness sourceCopyright © 2015. All rights reserved.