java.io.Serializablepublic class Wheel
extends java.lang.Object
implements java.io.Serializable
| Constructor | Description |
|---|---|
Wheel() |
Create an empty wheel.
|
Wheel(Block block) |
Create a wheel from a single block.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addBlock(Block block) |
Add a block to this wheel.
|
java.lang.Double |
calculateLikelihood(java.util.List<java.lang.Character> inputCharacters) |
Calculate the probability of a portion of the given string being generated by this wheel.
|
boolean |
equals(java.lang.Object obj) |
|
static Wheel |
fromJSONString(java.lang.String jsonString) |
Deserialize a wheel from a JSON string
|
java.lang.String |
generate(java.util.Random randomGenerator) |
Generate a random string based on this wheel.
|
java.lang.String |
generate(java.util.Random randomGenerator,
java.lang.Integer totalCount) |
Generate a random string based on this wheel and a total string count (i.e.
|
java.util.Map<BlockDefinition,Block> |
getBlocks() |
|
java.lang.Integer |
getTotalBlockCounts() |
|
int |
hashCode() |
|
void |
reduce(Wheel other) |
Combine another wheel into this one by aggregating counts at each level (wheel, block).
|
java.lang.String |
toJSONString() |
Serialize this wheel to a JSON string.
|
java.lang.String |
toString() |
public Wheel()
public Wheel(Block block)
block - the initial blockpublic java.util.Map<BlockDefinition,Block> getBlocks()
public void addBlock(Block block)
block - new block to include in this wheelpublic java.lang.Integer getTotalBlockCounts()
public void reduce(Wheel other)
other - the other wheel to combinepublic java.lang.String generate(java.util.Random randomGenerator,
java.lang.Integer totalCount)
randomGenerator - random number generator to usetotalCount - total number of non-null strings (from the sequence);
used to determine if the result should be an empty stringpublic java.lang.String generate(java.util.Random randomGenerator)
randomGenerator - random number generator to usepublic java.lang.Double calculateLikelihood(java.util.List<java.lang.Character> inputCharacters)
inputCharacters - characters to matchpublic java.lang.String toJSONString()
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static Wheel fromJSONString(java.lang.String jsonString) throws org.codehaus.jettison.json.JSONException
jsonString - the JSON stringorg.codehaus.jettison.json.JSONExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object