Alachisoft.NCache.Common.Threading.EventQueueComparer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-common Show documentation
Show all versions of nc-common Show documentation
Internal package of Alachisoft.
package Alachisoft.NCache.Common.Threading;
// public class RepeatEvent : QueuedEvent
// {
// private int iNumberOfShots; // -1 = continuous
//
// public RepeatEvent(long sched, int interval, int qty) : base(sched, interval, true)
// {
// iNumberOfShots = qty;
// }
//
// public override bool ReQueue()
// {
// base.ReQueue();
// if (iNumberOfShots != -1)
// iNumberOfShots--;
// return (iNumberOfShots != 0);
// }
//
//
// public override string ToString()
// {
// if (iNumberOfShots == -1)
// return "RepeatEvent fired at " + sched.ToString() + " (no limit)";
// else
// return "RepeatEvent fired at " + sched.ToString() + " with "+(iNumberOfShots)+" shots left";
// }
//
// }
//
// public class OneShotEvent : RepeatEvent
// {
// public OneShotEvent(long sched) : base(sched, 0, 1)
// {}
//
// public override string ToString()
// {
// return "OneShotEvent fired at " + sched.ToString();
// }
// }
//
// the comparer
//C# TO JAVA CONVERTER TODO TASK: The interface type was changed to the closest equivalent Java type, but the methods implemented will need adjustment:
public class EventQueueComparer implements java.util.Comparator {
public final int compare(Object x, Object y) {
QueuedEvent xx = (QueuedEvent) ((x instanceof QueuedEvent) ? x : null);
QueuedEvent yy = (QueuedEvent) ((y instanceof QueuedEvent) ? y : null);
return xx.getSchedTime().compareTo(yy.getSchedTime());
}
}