Example #1
0
  @Override
  public int compareTo(Request<T> other) {
    Priority left = this.getPriority();
    Priority right = other.getPriority();

    return left == right ? this.mSequence - other.mSequence : right.ordinal() - left.ordinal();
  }
Example #2
0
  /**
   * Our comparator sorts from high to low priority, and secondarily by sequence number to provide
   * FIFO ordering.
   */
  @Override
  public int compareTo(Request<T> other) {
    Priority left = this.getPriority();
    Priority right = other.getPriority();

    // High-priority requests are "lesser" so they are sorted to the front.
    // Equal priorities are sorted by sequence number to provide FIFO ordering.
    return left == right ? this.mSequence - other.mSequence : right.ordinal() - left.ordinal();
  }
Example #3
0
  public void setPriority(Priority p) {
    priorityDB = p.ordinal();
    priority = p;
    //        Log.v("TodoItem-Priority = ", String.valueOf(priorityDB));

  }