com.azalient.apo.basics
Class UTime

java.lang.Object
  extended by com.azalient.apo.basics.UTime
Direct Known Subclasses:
UTimeConstant

public class UTime
extends Object

A time value, formatted to hours, minutes, seconds and milliseconds for display when required.

This class is much smaller than java.util.Date.


Nested Class Summary
static class UTime.Format
           
 
Field Summary
static double eINFS
           
static UTime.Format HHMM
           
static UTime.Format HHMMSS
           
static UTime INF
           
static double INFS
           
static UTime.Format MMSS
           
static UTime ZERO
           
 
Constructor Summary
UTime(double seconds)
           
UTime(double seconds, UTime.Format format)
           
UTime(int hours, int minutes, int seconds)
           
UTime(int hours, int minutes, int seconds, UTime.Format fmt)
           
UTime(UTime.Format format, double seconds)
           
UTime(UTime that)
           
 
Method Summary
static String asTimeFileName(int t)
           
 int day()
           
 boolean equals(UTime that)
           
 int hour()
          Return the whole number of hours, in range 0 to 23
 void inc(double step)
           
 int minute()
          Return the whole number of minutes, in range 0 to 59
 int ms()
          Return the whole number of milliseconds, in range 0 to 999
static UTime newTime(UTime time1, UTime time2)
           
static UTime parse(UTime.Format format, String text)
           
 double parseDouble(String text)
           
static double parseDouble(UTime.Format format, String text)
           
 int parseInt(String text)
           
static int parseInt(UTime.Format format, String text)
           
 int second()
          Return the whole number of seconds, in range 0 to 59
 void set(double seconds)
           
 void set(int seconds)
           
 void set(int minutes, int seconds)
           
 void set(int hours, int minutes, int seconds)
           
 void set(int days, int hours, int minutes, int seconds)
           
 void set(int year, int days, int hours, int minutes, int seconds)
           
 void set(String text)
           
 void set(UTime t)
           
 double time()
           
 int timeInt()
           
static String timeStr(double sec)
           
 String toString()
           
 String toString(Boolean showMS)
           
 String toString(Boolean showMS, boolean showDays)
           
 String toString(Boolean showMS, boolean showDays, boolean showYearsDays)
           
 String toString(UTime.Format format, Boolean showMS)
           
 String toString(UTime.Format format, Boolean showMS, boolean showDays)
           
 String toString(UTime.Format format, Boolean showMS, boolean showDays, boolean showYearsDays)
           
 String toStringTimeOfDay(boolean useAMPM, boolean showMS)
          Override standard implementation get AM or PM displayed (for US times).
 int year()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final UTime ZERO

INFS

public static final double INFS
See Also:
Constant Field Values

eINFS

public static final double eINFS
See Also:
Constant Field Values

INF

public static final UTime INF

HHMMSS

public static final UTime.Format HHMMSS

HHMM

public static final UTime.Format HHMM

MMSS

public static final UTime.Format MMSS
Constructor Detail

UTime

public UTime(UTime.Format format,
             double seconds)

UTime

public UTime(double seconds,
             UTime.Format format)

UTime

public UTime(double seconds)

UTime

public UTime(int hours,
             int minutes,
             int seconds,
             UTime.Format fmt)

UTime

public UTime(int hours,
             int minutes,
             int seconds)

UTime

public UTime(UTime that)
Method Detail

year

public int year()

day

public int day()

hour

public int hour()
Return the whole number of hours, in range 0 to 23


minute

public int minute()
Return the whole number of minutes, in range 0 to 59


second

public int second()
Return the whole number of seconds, in range 0 to 59


ms

public int ms()
Return the whole number of milliseconds, in range 0 to 999


set

public void set(UTime t)

set

public void set(int seconds)

inc

public void inc(double step)

set

public void set(double seconds)

time

public double time()

timeInt

public int timeInt()

set

public void set(int minutes,
                int seconds)

set

public void set(int hours,
                int minutes,
                int seconds)

set

public void set(int days,
                int hours,
                int minutes,
                int seconds)

set

public void set(int year,
                int days,
                int hours,
                int minutes,
                int seconds)

set

public void set(String text)

parseInt

public int parseInt(String text)

parseDouble

public double parseDouble(String text)

timeStr

public static String timeStr(double sec)

asTimeFileName

public static String asTimeFileName(int t)

newTime

public static UTime newTime(UTime time1,
                            UTime time2)

parse

public static UTime parse(UTime.Format format,
                          String text)

parseInt

public static int parseInt(UTime.Format format,
                           String text)

parseDouble

public static double parseDouble(UTime.Format format,
                                 String text)

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(Boolean showMS)
Parameters:
showMS - set to null to show ms only if non-zero
Returns:
the formatted time as a string

toString

public String toString(Boolean showMS,
                       boolean showDays)

toString

public String toString(Boolean showMS,
                       boolean showDays,
                       boolean showYearsDays)

toString

public String toString(UTime.Format format,
                       Boolean showMS)

toString

public String toString(UTime.Format format,
                       Boolean showMS,
                       boolean showDays)

toString

public String toString(UTime.Format format,
                       Boolean showMS,
                       boolean showDays,
                       boolean showYearsDays)

toStringTimeOfDay

public String toStringTimeOfDay(boolean useAMPM,
                                boolean showMS)
Override standard implementation get AM or PM displayed (for US times). This makes sense for a time of day, but not for a duration.


equals

public boolean equals(UTime that)