1 25 26 29 package net.killingar.forum.internal; 30 31 import java.util.Date ; 32 33 public class Todo extends IDItemImpl implements OwnerIDItem 34 { 35 public long ownerID = -1; 36 public int priority, type; 37 public String message; 38 public Date date; 39 40 public Todo(long _ID, long _ownerID, int _priority, int _type, String _message, Date _date) 41 { 42 super(_ID); 43 ownerID = _ownerID; 44 priority = _priority; 45 type = _type; 46 message = _message; 47 date = _date; 48 } 49 50 public Todo(long _ownerID, int _priority, int _type, String _message) 51 { 52 super(-1); 53 ownerID = _ownerID; 54 priority = _priority; 55 type = _type; 56 message = _message; 57 } 58 59 public int compareTo(Object o) 60 { 61 Todo todo = (Todo)o; 62 if (todo.type != type)throw new ClassCastException ("type mismatch"); 63 if (todo.priority == priority) 64 return message.compareToIgnoreCase(todo.message); 65 else if (todo.priority < priority) 66 return -1; 67 else 68 return 1; 69 } 70 71 public long getOwnerID() { return ownerID; } 72 public int getPriority() { return priority; } 73 public int getType() { return type; } 74 public String getMessage() { return message; } 75 public Date getDate() { return date; } 76 } | Popular Tags |