public class BuildertextJavaclass extends java.lang.Object implements NonsenseGenerator
This class makes use of several array resources:
R.array#asNonsenseBenedict
R.array#asNonsensePrefixBene
R.array#asNonsenseSuffixDict
R.array#asNonsenseCumberbatch
R.array#asNonsensePrefixCumber
R.array#asNonsenseSuffixBatch
Applications using this class may define competing resources which will override the defaults when the APK is compiled.
NonsenseGenerator.Utils
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
m_asBenedict
Caches one of the resource arrays.
|
protected java.lang.String[] |
m_asCumberbatch
Caches one of the resource arrays.
|
protected java.lang.String[] |
m_asPrefixBene
Caches one of the resource arrays.
|
protected java.lang.String[] |
m_asPrefixCumber
Caches one of the resource arrays.
|
protected java.lang.String[] |
m_asSuffixBatch
Caches one of the resource arrays.
|
protected java.lang.String[] |
m_asSuffixDict
Caches one of the resource arrays.
|
protected boolean |
m_bCached
Indicates whether the resource arrays are cached.
|
protected android.content.Context |
m_ctx
A context in which the string resources are available.
|
protected static java.util.Random |
RANDOM
The internal RNG of the builder.
|
Constructor and Description |
---|
BuildertextJavaclass(android.content.Context ctx) |
Modifier and Type | Method and Description |
---|---|
protected BuildertextJavaclass |
cacheArrays()
Caches the resource arrays in this instance.
|
java.lang.String |
getString()
Generates the nonsense string.
|
NonsenseGenerator |
setContext(android.content.Context ctx)
Sets the context in which string resources can be fetched.
|
protected static final java.util.Random RANDOM
protected android.content.Context m_ctx
protected boolean m_bCached
protected java.lang.String[] m_asBenedict
protected java.lang.String[] m_asPrefixBene
protected java.lang.String[] m_asSuffixDict
protected java.lang.String[] m_asCumberbatch
protected java.lang.String[] m_asPrefixCumber
protected java.lang.String[] m_asSuffixBatch
public NonsenseGenerator setContext(android.content.Context ctx)
NonsenseGenerator
setContext
in interface NonsenseGenerator
ctx
- the context in which string resources are availableprotected BuildertextJavaclass cacheArrays()
getString()
, so that we don't bother building arrays
until the first time the class is actually used.public java.lang.String getString()
NonsenseGenerator
getString
in interface NonsenseGenerator