com.avian.util
Class MilliTimeString

java.lang.Object
  extended by com.avian.util.MilliTimeString

public class MilliTimeString
extends java.lang.Object

Utility object that provides several convenience methods for converting and displaying long values as unformatted or formatted Strings. Unfortunately, long numbers produce way too many digits in a String for the human brain to comprehend easily or manage conveniently. This utility object provides several convenience methods to display long numbers as Strings, including one unformatted String and two formatted Strings. Formatting reduces the number of digits and inserts punctuation to separate the digits into smaller groups that are easier to understand.

It is common to have these types of utilities provided as static methods to improve system efficiency. However, using statics would require that all of the methods be synchronized so that two birds don't access the same method at the same time and corrput each other's results.


Constructor Summary
MilliTimeString()
           
 
Method Summary
 java.lang.String getShortMilliTimeString()
          Gets the current system millisecond time and returns a shortened formatted String.
 java.lang.String toMilliTimeString()
          Gets the current system millisecond time and returns the whole thing as an unformatted String.
 java.lang.String toShortMilliTimeString(long t)
          Receives a long number and returns a shortened formatted String that represent that long number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MilliTimeString

public MilliTimeString()
Method Detail

toMilliTimeString

public java.lang.String toMilliTimeString()
Gets the current system millisecond time and returns the whole thing as an unformatted String. This method is good when you want a quick snapshot of the system Time but the time will be somewhat difficult to use because there are so many digits in the resulting number String.

Returns:
String of numerical digits that represent the long number that was obtained from call to System.currentTimeMillis.

getShortMilliTimeString

public java.lang.String getShortMilliTimeString()
Gets the current system millisecond time and returns a shortened formatted String. It shortens the time to the last 8 digits, which works out to be approx 99 hours, which is good enough for most uses. It breaks the time String into groups of numbers that are separated by punctuation marks. It also puts angle brackets at the front and rear of the formatted number String to make the number stand out.

Returns:
String that contains a shortened formatted representation of the current System time.

toShortMilliTimeString

public java.lang.String toShortMilliTimeString(long t)
Receives a long number and returns a shortened formatted String that represent that long number. It shortens the number to the last 8 digits and formats it as a time (or similiar to the way time is represented) because it is expecting that the long number passed in represents a time. Its not required to give it a time as a long, but it won't recognize if a non-time is supplied to it - it will simply insert the punctuation marks.

Parameters:
t - A long number to be converted into a String and formatted and shortened.
Returns:
String that contains a shortened formatted representation of the current System time.