예제 #1
0
파일: Kock.java 프로젝트: bar0n/CoursesDemo
  public int compareTo(Delayed o) {

    if (this.getDelay(time) < o.getDelay(time)) return -1;

    if (this.getDelay(time) > o.getDelay(time)) return 1;

    return 0;
  }
 public int compareTo(Delayed other) {
   if (this == other) {
     return 0;
   }
   long diff = getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS);
   return (diff == 0 ? 0 : ((diff < 0) ? -1 : 1));
 }
예제 #3
0
 @Override
 public int compareTo(Delayed delayed) {
   if (delayed == this) {
     return 0;
   }
   long d = (getDelay(TimeUnit.MILLISECONDS) - delayed.getDelay(TimeUnit.MILLISECONDS));
   return ((d == 0) ? 0 : ((d < 0) ? -1 : 1));
 }
 @Override
 public int compareTo(Delayed another) {
   if (another == this) {
     return 0;
   }
   long d = (getDelay(TimeUnit.MILLISECONDS) - another.getDelay(TimeUnit.MILLISECONDS));
   return ((d == 0) ? 0 : ((d < 0) ? -1 : 1));
 }
예제 #5
0
 /**
  * Compare the age of this wrapper element with another. The priority is not used for the
  * comparision.
  *
  * @param o the other wrapper element to compare with.
  * @return less than zero if this wrapper is older, zero if both wrapper elements have the same
  *     age, greater than zero if the parameter wrapper element is older.
  */
 public int compareTo(Delayed o) {
   long diff = (getDelay(TimeUnit.MILLISECONDS) - o.getDelay(TimeUnit.MILLISECONDS));
   if (diff > 0) {
     return 1;
   } else if (diff < 0) {
     return -1;
   } else {
     return 0;
   }
 }
예제 #6
0
 @Override
 public int compareTo(Delayed other) {
   if (this == other) {
     return 0;
   }
   if (other instanceof GridmixJob) {
     final long otherNanos = ((GridmixJob) other).submissionTimeNanos;
     if (otherNanos < submissionTimeNanos) {
       return 1;
     }
     if (otherNanos > submissionTimeNanos) {
       return -1;
     }
     return id() - ((GridmixJob) other).id();
   }
   final long diff = getDelay(TimeUnit.NANOSECONDS) - other.getDelay(TimeUnit.NANOSECONDS);
   return 0 == diff ? 0 : (diff > 0 ? 1 : -1);
 }
    @SuppressWarnings("rawtypes")
    @Override
    public int compareTo(Delayed other) {
      // Since getDelay may return different values for each call,
      // this check is required to correctly implement Comparable
      if (other == this) {
        return 0;
      }

      // If we are considering other sponge tasks, we can order by
      // their internal tasks
      if (other instanceof SpongeTaskFuture) {
        ScheduledTask otherTask = ((SpongeTaskFuture) other).task;
        return ComparisonChain.start()
            .compare(this.task.nextExecutionTimestamp(), otherTask.nextExecutionTimestamp())
            .compare(this.task.getUniqueId(), otherTask.getUniqueId())
            .result();
      }

      return Long.compare(
          this.getDelay(TimeUnit.NANOSECONDS), other.getDelay(TimeUnit.NANOSECONDS));
    }
예제 #8
0
 public int compareTo(Delayed other) {
   if (other == null || this.hashCode() > other.hashCode()) return 1;
   if (this.hashCode() == other.hashCode()) return 0;
   return -1;
 }
예제 #9
0
파일: Leases.java 프로젝트: RonghaiMa/hbase
    public int compareTo(Delayed o) {
      long delta = this.getDelay(TimeUnit.MILLISECONDS) - o.getDelay(TimeUnit.MILLISECONDS);

      return this.equals(o) ? 0 : (delta > 0 ? 1 : -1);
    }
 @Override
 public int compareTo(Delayed o) {
   return Long.compare(getDelay(TimeUnit.MILLISECONDS), o.getDelay(TimeUnit.MILLISECONDS));
 }
    public int compareTo(Delayed o) {
      if (o instanceof DelayedMessage)
        return new Long(createdClock).compareTo(((DelayedMessage) o).createdClock);

      return new Long(getDelay(TimeUnit.NANOSECONDS)).compareTo(o.getDelay(TimeUnit.NANOSECONDS));
    }
예제 #12
0
 @Override
 public int compareTo(Delayed arg0) {
   return (int) (arg0.getDelay(TimeUnit.MILLISECONDS) - getDelay(TimeUnit.MILLISECONDS));
 }
예제 #13
0
 public int compareTo(Delayed o) {
   if (o == null) throw new RuntimeException("????????????");
   if (!(o instanceof DelayedObj))
     throw new RuntimeException("?????????????? cls : " + o.getClass());
   return this.level.compareTo(((DelayedObj) o).getLevel());
 }