Get rid of ObjectType enum.

It was only used for equals() and that's more easily done using
double dispatch.
Move object casting methods out of Object.

This is to get rid of a monolithic pile of interconnected object
classes. I want to move the IO object classes into a separate file
and not have Object itself be aware of them.