Modifier and Type | Class and Description |
---|---|
(package private) static class |
StochasticList.WeightedRuleChooser
Inner class, to handle chooser logic
|
Modifier and Type | Field and Description |
---|---|
private StochasticList.WeightedRuleChooser |
chooser |
private java.util.Set<java.lang.Character> |
premises |
private java.util.Map<java.lang.Character,java.util.List<WeightedRule>> |
weightedRules |
Constructor and Description |
---|
StochasticList()
Default Constructor, initialises collections and instance of
stochastic rule chooser
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(char pre,
java.lang.String rule) |
void |
addRule(char pre,
java.lang.String rule,
float weight) |
void |
clear()
Dereference chooser and empty the
collections, is called by dispose
|
java.lang.String |
getRule(char pre) |
private java.lang.String |
getStochasticRule(java.util.List<WeightedRule> weightedRules)
Uses inner class chooser instance to handle random choice logic
|
boolean |
hasRule(char pre) |
java.lang.StringBuilder |
toStringBuilder() |
private java.util.Set<java.lang.Character> premises
private java.util.Map<java.lang.Character,java.util.List<WeightedRule>> weightedRules
private StochasticList.WeightedRuleChooser chooser
public StochasticList()
public void addRule(char pre, java.lang.String rule)
public void addRule(char pre, java.lang.String rule, float weight)
private java.lang.String getStochasticRule(java.util.List<WeightedRule> weightedRules)
weightedRules
- List of WeightedRulepublic java.lang.String getRule(char pre)
public java.lang.StringBuilder toStringBuilder()
toStringBuilder
in interface RuleList
public void clear()