duke-compsci308-spring2013/vooga — pull request #45 by drjamesdaazn (2013-04-27 20:41:08+00:00)
Title: Added State and two State-specific exceptions to the class utils package

Repost from first pull request--I fixed it so the only changes are the added State utils in class util package:

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.

Additionally, added a getSize() method in Pixmap to support change #2 described above.

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.