I'm trying to cast an Object to a type Procedure (a class I wrote) in order to access a method in the Procedure class. Problem is, Procedure is a subclass of Object, and it requires a run-time check to verify that the object that I'm trying to cast as a Procedure object is actually a Procedure object in the first place. How do I go about implementing this run-time check?
The code is an implementation of the method compareTo() in the interface Comparable. It requires that an Object be passed, so passing an actual Procedure instance is out of the question. I need to cast it back into a Procedure object from an Object.