// IncredibleTask class, October 2001
//
// Designed to extend TimerTask in such a way that we can use java.util.Timer
// to execute methods of a class that already extends another class. Java
// doesn't allow multiple inheritance in the normal, intuitive way, so we have
// to create some messy classes and interfaces to get around that. I could rant
// about this for a while. If you'd like to hear some of it, please come talk
// to me.

import java.util.*;

public class IncredibleTask extends TimerTask {

  /*
   * CLASS VARIABLES
   */

  Runnable theObject;  // This is the object we will execute methods from.

  /*
   * CONSTRUCTOR
   */

  public IncredibleTask(Runnable r) {
  // Creates a new IncredibleTask.
  //
  // Precondition:
  //   r != null
  //
  // Postcondition:
  //   A new IncredibleTask is created.

    super();

    theObject = r;

  }

  /*
   * METHODS
   */

  public void run() {
  // Runs the run() method of theObject.
  //
  // Preconditions:
  //   none.
  //
  // Postcondition:
  //   theObject.run() is executed.

    theObject.run();

  }

}
