duke-compsci308-spring2013/vooga — pull request #44 by drjamesdaazn (2013-04-27 06:05:32+00:00)
Title: Refactored State into a util class, and added two State-specific exceptions

I modified the code that I pulled from master (or so I thought), so I'm not sure why there are so many files in this request from fighter.. might've made a mistake in the pull ><

But basically the classes to look at are util/State, util/StateExpiredException, and util/StateParameterDisabledException.

Changes to State:

1) Removed priority and depth to cut on clutter.
2) Added convenience method for populating state sizes based on image file sizes.
3) Added booleans for disabling parameters (hitbox, image, and/or size), in case an Object does not have a reason to include some parameter.
4) Fixed State(State other) constructor to properly deep copy other State.
5) Refactored some method names for clarity purposes.
6) Added two custom Exceptions for State, one for attempting to update a non-looping state that has completed and one for attempting to access disabled parameters.

Couple of questions I have.

1) Is it better to use the new Exceptions that I created or to just return null in cases where a disabled parameter is accessed?
2) If I should use Exceptions, is my implementation of them okay? It seems kinda derpy since my classes are literally the same as the Exception superclass except they have specialized class names. I checked the java source code and found other exceptions that looked like this (e.g. IndexOutOfBoundsException is created solely for its class name), so I figured it'd be okay, but I just wanted to ask.

Anyway, please post feedback.