Class Index | File Index

Classes


Class atropa.Babbler


Version 20130313.
This class represents a babbler
Defined in: <node_modules/atropa-Babbler/src/atropa-Babbler.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
atropa.Babbler(wrdCount)
This class represents a babbler.
Method Summary
Method Attributes Method Name and Description
 
generateBabble(wordsCt)
Generates babble to a user specified length in words.
 
generateSentence(sentenceMin, sentenceMax)
Generates a sentence of specified length in words.
 
generateWord(stringMin, stringMax)
Generates a word with a specified length.
 
Gets the last generated babble.
 
Gets the current word count.
 
Provides random punctuation.
 
Clears the stored babble.
 
resetWordCount(wordCount)
Resets the word count for this babbler.
 
setBabble(babbleString)
Sets the babble.
 
setWordCount(wrdCount)
Sets the word count.
Class Detail
atropa.Babbler(wrdCount)
This class represents a babbler. The babbler produces lorum ipsum text, to user specifications.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
var babbler = new atropa.Babbler(30);
// resets the word count
babbler.resetWordCount(10)
console.log(babbler.getWordCount());

// displays a 10 word sentence of nonsense words.
console.log(babbler.generateBabble(10));
// displays a 3 word sentence
console.log(babbler.generateBabble(3));

// displays the user stored or last generated babble
console.log(babbler.getBabble());

// clears the stored babble
babbler.resetBabble();
console.log(babbler.getBabble());

// sets the babble
babbler.setBabble('here be gibberish ');
console.log(babbler.getBabble());

// append more gibberish to the current babble
babbler.setBabble(babbler.getBabble() + babbler.generateBabble(5));
console.log(babbler.getBabble());

// generate a sentence
babbler.resetWordCount(10);
console.log(babbler.generateSentence(5, 20));

// generate random punctuation
console.log(babbler.punctuate());

// generate a word
console.log(babbler.generateWord(3,7));
console.log(babbler.generateWord(7,10));
Parameters:
{Number} wrdCount
The amount of "words" you would like the babbler to produce.
Returns:
{Babbler} Returns a babbler.
Requires:
atropa.random.integer
atropa.string.ucFirst
atropa.random.string
Method Detail
{String} generateBabble(wordsCt)
Generates babble to a user specified length in words. The word count will be zero after this and the stored babble will be set to the generated babble.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{Number} wordsCt
The desired word count for the generated babble.
Returns:
{String} Returns babble of specified length in words.
See:
atropa.Babbler#getWordCount

{String} generateSentence(sentenceMin, sentenceMax)
Generates a sentence of specified length in words. The quantity of words in the generated sentence will be between the minimum and maximum set, with the maximum capped at the current words count. The word count will be lowered by the quantity of words in the generated sentence. If the word count is 0 then there will be no words in the sentence. If the word count is 3 then the maximum possible number of words in the sentence will be three.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{Number} sentenceMin
The shortest sentence, in words, you would like returned.
{Number} sentenceMax
The longest sentence, in words, you would like returned.
Returns:
{String} Returns a "sentence" within the specified range of length.
Requires:
atropa.random.integer
atropa.string.ucFirst

{String} generateWord(stringMin, stringMax)
Generates a word with a specified length. Lowers the word count by one.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{Number} stringMin
the shortest word, in characters.
{Number} stringMax
The longest word, in characters.
Returns:
{String} Returns a random string of characters within the specified range of length.
Requires:
atropa.random.integer
atropa.random.string

{String} getBabble()
Gets the last generated babble.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Returns:
{String} Returns the stored babble.

{Number} getWordCount()
Gets the current word count.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Returns:
{Number} Returns the word count for this babbler.

{String} punctuate()
Provides random punctuation.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Returns:
{String} Returns a random punctuation character ( . ! or ? ).
Requires:
atropa.random.string

{String} resetBabble()
Clears the stored babble.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Returns:
{String} Returns the stored babble.

{Number} resetWordCount(wordCount)
Resets the word count for this babbler.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{Number} wordCount
The amount of "words" you would like to set for this babbler.
Returns:
{Number} Returns the set word count for this babbler.

{String} setBabble(babbleString)
Sets the babble.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{String} babbleString
Specified babble to set.
Returns:
{String} Returns the stored babble.

{Number} setWordCount(wrdCount)
Sets the word count.
Author: Matthew Christopher Kastor-Inare III
☭ Hial Atropa!! ☭.
Parameters:
{Number} wrdCount
The amount of "words" which you want the babbler to produce.
Returns:
{Number} Returns the set word count for this babbler.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 17 2022 14:29:55 GMT-0500 (Eastern Standard Time)