com.atlassian.scheduler.core.util
Class TimeIntervalQuantizer

java.lang.Object
  extended by com.atlassian.scheduler.core.util.TimeIntervalQuantizer

public class TimeIntervalQuantizer
extends Object

Tool for quantizing millisecond time intervals to a broader resolution while guarding against sign overflows.

Since:
v1.0

Constructor Summary
TimeIntervalQuantizer()
           
 
Method Summary
static long quantize(long intervalInMilliseconds, int resolution)
          Quantizes millisecond time intervals to the specified resolution, rounding up.
static long quantizeToMinutes(long intervalInMilliseconds)
          Quantizes millisecond time intervals to a one minute resolution, rounding up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeIntervalQuantizer

public TimeIntervalQuantizer()
Method Detail

quantize

public static long quantize(long intervalInMilliseconds,
                            int resolution)
Quantizes millisecond time intervals to the specified resolution, rounding up. Examples:

Parameters:
intervalInMilliseconds - the time interval to be quantized
resolution - the time resolution to honour, in milliseconds.
Returns:
the quantized time interval, in milliseconds with the specified resolution

quantizeToMinutes

public static long quantizeToMinutes(long intervalInMilliseconds)
Quantizes millisecond time intervals to a one minute resolution, rounding up. Examples:

Parameters:
intervalInMilliseconds - the time interval to be quantized
Returns:
the quantized time interval, in milliseconds with one minute resolution


Copyright © 2014 Atlassian. All Rights Reserved.