Class MonsterDatabase
java.lang.Object
MonsterDatabase
Database of available monster types (singleton pattern).
- Since:
- 2014-07-18
-
Field Summary
Modifier and TypeFieldDescription(package private) static MonsterDatabase
The singleton class instance.(package private) static final String
Default file with monster information.(package private) static String
Name of file with monster information.List of Monster records. -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor (read from dedicated file). -
Method Summary
Modifier and TypeMethodDescriptionGet a monster by matching its race.static MonsterDatabase
Access the singleton class instance.Get a random monster from the database.iterator()
Implement the iterable interface.static void
Main test method.static void
setDatabaseFilename
(String filename) Set an alternate monster database filename.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
MONSTER_FILE_DEFAULT
Default file with monster information.- See Also:
-
monsterFile
Name of file with monster information. -
instance
The singleton class instance. -
monsterList
List of Monster records.
-
-
Constructor Details
-
MonsterDatabase
Constructor (read from dedicated file).- Throws:
IOException
-
-
Method Details
-
getInstance
Access the singleton class instance. -
iterator
Implement the iterable interface. -
getByRace
Get a monster by matching its race. -
getRandom
Get a random monster from the database. -
setDatabaseFilename
Set an alternate monster database filename. -
main
Main test method. Prints stat blocks for all monsters in database. Takes alternate database file from command line.
-