shoddybattle.util
Class TimeInterval

java.lang.Object
  extended by shoddybattle.util.TimeInterval

public class TimeInterval
extends java.lang.Object

This class represents a difference between two times, rather than an an absolute value of time. It allows formatting of the interval as such.


Constructor Summary
TimeInterval(long length)
          Create a time interval with the given length.
 
Method Summary
 java.lang.String getApproximation()
          Format the interval as a string, giving a fairly good approximation of the length of the interval.
static TimeInterval getDeltaInterval(java.util.Date future)
          Create a time interval based on the absolute value of the difference between the given Date and the current time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeInterval

public TimeInterval(long length)
Create a time interval with the given length.

Parameters:
length - the length of the time interval in milliseconds
Method Detail

getDeltaInterval

public static TimeInterval getDeltaInterval(java.util.Date future)
Create a time interval based on the absolute value of the difference between the given Date and the current time.


getApproximation

public java.lang.String getApproximation()
Format the interval as a string, giving a fairly good approximation of the length of the interval. This is only an approximation to avoid the length of the string becoming too long.