Greymerk/minecraft-roguelike — pull request #3 by RobertLeahy (2013-10-26 23:18:10+00:00)
Title: Configuration Fixes/Improvements

Fixed a bug which allowed NullPointerException to be thrown from the methods that get and parse configurations -- either to ints or doubles.

Fixed an oversight which caused the constructor of ConfigFile to throw if the file-in-question didn't exist. It is desirable to be able to create a ConfigFile even if the corresponding file does not exist. This allows for improved workflow as the ConfigFile object can be used to manage configurations even if no corresponding physical file exists.

Made several improvements/additions:

- ConfigurationProvider now contains and manages its own Hashtable and manages it, which removes that responsibility from the base class and allows for better code reuse.
- ConfigurationProvider is now iterable. ConfigurationProviderIterator coalesces the entries in the underlying Hashtable into Configuration objects.
- ConfigurationParser -- and the implementation INIParser -- now provide a method for serialization as well as parsing.
- ConfigurationProviders may now be written to disk using the Write static method of the ConfigFileWriter class.
- ConfigFile now remembers the filename and ConfigurationParser it was constructed with, and has a member method Write which writes all configurations back to that same file in the same format.
- ConfigurationProviders now allow for new configurations to be added through the Set overloads.
- ConfigurationProviders now allow for configurations to be removed through the Unset method.