java.io.Serializablepublic class Sequence
extends java.lang.Object
implements java.io.Serializable
| Constructor | Description |
|---|---|
Sequence() |
Create an empty sequence.
|
Sequence(java.lang.String input) |
Create a sequence from a single string and no block definitions.
|
Sequence(java.lang.String input,
java.util.List<BlockDefinition> definitions) |
Create a sequence from a single string.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addNullCount(java.lang.Integer count) |
|
void |
addTotalCount(java.lang.Integer count) |
|
void |
addWheel(Wheel nextWheel) |
|
java.lang.Double |
calculateLikelihood(java.lang.String input) |
Calculate the probability of a given string being generated by this sequence.
|
static Sequence |
deserialize(byte[] byteArray) |
Deserialize a sequence from a byte array.
|
boolean |
equals(java.lang.Object obj) |
|
static Sequence |
fromJSONString(java.lang.String jsonString) |
Deserialize a sequence from a JSON string
|
java.lang.String |
generate() |
Generate a random string based on this sequence, using the current random generator.
|
java.lang.String |
generate(java.lang.String input) |
Generate a random string based on this sequence, using a new random generator created with the specified seed.
|
java.lang.String |
generate(java.lang.String input,
java.lang.String salt) |
Generate a random string based on this sequence, using a new random generator created with the specified seed.
|
java.lang.String |
generate(java.util.Random randomGenerator) |
Generate a random string based on this sequence, using the specified random generator.
|
java.lang.Integer |
getNullCount() |
|
java.lang.Integer |
getTotalCount() |
|
java.util.List<Wheel> |
getWheels() |
|
int |
hashCode() |
|
void |
reduce(Sequence other) |
Combine another sequence into this one by aggregating counts at each level (sequence, wheel, block).
|
void |
resetGenerator() |
Resets the random number generator used by this sequence with a random seed.
|
void |
resetGenerator(java.lang.Integer seed) |
Resets the random number generator used by this sequence.
|
void |
resetGenerator(java.lang.String input) |
Resets the random number generator used by this sequence.
|
byte[] |
serialize() |
Serialize this sequence to a byte array.
|
java.lang.String |
toJSONString() |
Serialize this sequence to a JSON string.
|
java.lang.String |
toString() |
public Sequence()
public Sequence(java.lang.String input,
java.util.List<BlockDefinition> definitions)
input - string to characterizedefinitions - block definitions used to segment string into blockspublic Sequence(java.lang.String input)
input - string to characterizepublic java.lang.Integer getTotalCount()
public void addTotalCount(java.lang.Integer count)
count - number of additional strings to addpublic java.lang.Integer getNullCount()
public void addNullCount(java.lang.Integer count)
count - number of additional null strings to addpublic java.util.List<Wheel> getWheels()
public void addWheel(Wheel nextWheel)
nextWheel - wheel to appendpublic void resetGenerator(java.lang.Integer seed)
seed - seed for the generatorpublic void resetGenerator(java.lang.String input)
input - seed for the generatorpublic void resetGenerator()
public void reduce(Sequence other)
other - the other sequence to combinepublic java.lang.String generate()
public java.lang.String generate(java.util.Random randomGenerator)
randomGenerator - random number generator to usepublic java.lang.String generate(java.lang.String input)
input - seed for the random generatorpublic java.lang.String generate(java.lang.String input,
java.lang.String salt)
input - base seed for the random generatorsalt - salt to append to the seedpublic java.lang.Double calculateLikelihood(java.lang.String input)
input - the string to considerpublic java.lang.String toJSONString()
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static Sequence fromJSONString(java.lang.String jsonString) throws org.codehaus.jettison.json.JSONException
jsonString - the JSON stringorg.codehaus.jettison.json.JSONExceptionpublic byte[] serialize()
throws java.io.IOException
java.io.IOExceptionpublic static Sequence deserialize(byte[] byteArray) throws java.io.IOException, java.lang.ClassNotFoundException
byteArray - the byte arrayjava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic 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