public class PatternRandomField extends Object implements RandomField
RND
Constructor and Description |
---|
PatternRandomField(String pattern)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponent(String key,
RandomField randomField)
Adds a component that can be accessed by
nextValue() . |
void |
addComponents(Map<String,RandomField> addedComponents)
Adds components that can be accessed by
nextValue() . |
double |
getNullProbability()
Returns the probability for this field returning null.
|
String |
getPattern()
Returns the pattern with keys that get replaced during
nextValue() . |
String |
nextValue()
Returns a random value.
|
PatternRandomField |
nullProbability(double newNullProbability)
Sets the probability for this field returning null.
|
PatternRandomField |
pattern(String newPattern)
Sets the pattern with keys that get replaced during
nextValue() . |
void |
removeComponent(String key)
Removes a component that can be accessed by
nextValue() . |
void |
removeComponents(Set<String> keys)
Removes components that can be accessed by
nextValue() . |
void |
setNullProbability(double nullProbability)
Sets the probability for this field returning null.
|
void |
setPattern(String pattern)
Sets the pattern with keys that get replaced during
nextValue() . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
init
public PatternRandomField(String pattern)
pattern
- the pattern to filladdComponent(String, RandomField)
public String nextValue()
RandomField
nextValue
in interface RandomField
public void addComponent(String key, RandomField randomField)
nextValue()
.key
- the key that is replaced "as is"randomField
- the random field to replace this key withpublic void addComponents(Map<String,RandomField> addedComponents)
nextValue()
.addedComponents
- with keys and random fieldsaddComponent(String, RandomField)
public void removeComponent(String key)
nextValue()
.key
- the key that is replaced "as is"public void removeComponents(Set<String> keys)
nextValue()
.keys
- the keysremoveComponent(String)
public String getPattern()
nextValue()
.public PatternRandomField pattern(String newPattern)
nextValue()
.newPattern
- the patternpublic void setPattern(String pattern)
nextValue()
.pattern
- the patternpublic double getNullProbability()
nextValue()
is null, if it is 1 then every nextValue()
is null.public PatternRandomField nullProbability(double newNullProbability)
nextValue()
is null, if it is 1 then every nextValue()
is null.newNullProbability
- the probability between 0 and 1public void setNullProbability(double nullProbability)
nextValue()
is null, if it is 1 then every nextValue()
is null.nullProbability
- the probability between 0 and 1Copyright © 2020. All rights reserved.