-2
// This is java code 
//  it is saying comparable is a raw type, references to generic type comparable 
  <T> should be parameterized. I have never recieved this error before so I    
   don't know how to resolve the issue.  



package edu.swosu.wordcraft.timers;


    /** The base (and abstract) class for timer events */
    public abstract class Event implements Comparable {
protected long time;
 protected long delay;

/** Constructs new timer.  
 * This determines current system time and adds the appropriate 
       time based on the delay parameter. 
 * 
 * Note that this does not automatically add itself to the timer thread
 * 
 * @param delay     Delay for the timed event (in milliseconds) 
 */
public Event(long delay) {
    time = System.currentTimeMillis() + delay;
    this.delay = delay;
}

/** Implements Comparable interface - compares value of time parameter 
 * 
 */
public int compareTo(Object otherEvent) {
    if(!(otherEvent instanceof Event)) {
        //this really shouldn't happen
        throw new ClassCastException("Invalid Onject during Even compare");
    }

    long otherTime = ((Event)otherEvent).getTime(); 

    if (this.time > otherTime) {
        return 1;
    }
    else {
        if (this.time < otherTime) {
            return -1;
        }
        else {
            return 0;
        }
    }
}

public long getTime() {
    return time;
}

/** method to be called when timer fires
 *  
 */

public abstract void execute();
  }
Marko Topolnik
  • 179,046
  • 25
  • 276
  • 399

1 Answers1

3

Basically, it informs you, that you have to provide the class to which the class implementing Comparable could been compared with. In your case, if you want to compare Event with Event, you could simply write

implements Comparable<Event>
Smutje
  • 16,300
  • 3
  • 20
  • 36