Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. @Override
  2. public int compare(CentralTask o1, CentralTask o2) {
  3. if (o1 instanceof DownloadJobEntryTask && o2 instanceof DownloadJobEntryTask)
  4. return Long.compare(o1.createTime, o2.createTime);
  5. else if (o1 instanceof DownloadJobEntryTask || o2 instanceof DownloadJobEntryTask) {
  6. return o1 instanceof DownloadJobEntryTask ? -1 : 1;
  7. }
  8.  
  9. if (o1 instanceof DownloadCameraIntervalTask && o2 instanceof DownloadCameraIntervalTask) {
  10. DownloadCameraIntervalTask d1 = (DownloadCameraIntervalTask)o1;
  11. DownloadCameraIntervalTask d2 = (DownloadCameraIntervalTask)o2;
  12. if (d1.getPriority() == d2.getPriority())
  13. return Long.compare(d1.createTime, d2.createTime);
  14. else
  15. return d1.getPriority() < d2.getPriority() ? 1 : -1;
  16. } else if (o1 instanceof DownloadCameraIntervalTask || o2 instanceof DownloadCameraIntervalTask)
  17. return o1 instanceof DownloadCameraIntervalTask ? -1 : 1;
  18.  
  19. return Long.compare(o1.createTime, o2.createTime);
  20. }
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement