com.continuent.tungsten.common.config
Class Interval

java.lang.Object
  extended by com.continuent.tungsten.common.config.Interval

public class Interval
extends java.lang.Object

Implements a time interval, which is expressed in milliseconds. Intervals can be manipulated as long values but also translate to strings of the form

NNN{d|h|m|s}

where NNN is a number and the letter following denotes a time unit of days, hours, minutes, or seconds, respectively. If the time unit is left off the value is assumed to be milliseconds.

Version:
1.0
Author:
Robert Hodges

Constructor Summary
Interval(long duration)
           
Interval(java.lang.String duration)
          Creates an interval from a string.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 long longValue()
          Return interval as millisecond value.
 boolean overInterval(long startMillis, long endMillis)
          Returns true if the start and end times are greater than the duration of this interval.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Interval

public Interval(long duration)

Interval

public Interval(java.lang.String duration)
         throws java.lang.NumberFormatException
Creates an interval from a string.

Throws:
java.lang.NumberFormatException
Method Detail

longValue

public long longValue()
Return interval as millisecond value.


overInterval

public boolean overInterval(long startMillis,
                            long endMillis)
Returns true if the start and end times are greater than the duration of this interval.

Parameters:
startMillis - Start time in milliseconds
endMillis - End time in milliseconds
Returns:
true if the given interval is greater that this instance one, false otherwise

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)