net.sf.xmlmatcher.tools
Class SimpleTimeOfDayFormat

java.lang.Object
  extended by net.sf.xmlmatcher.tools.SimpleTimeOfDayFormat
All Implemented Interfaces:
TimeOfDayFormat

public class SimpleTimeOfDayFormat
extends java.lang.Object
implements TimeOfDayFormat

Formats time of day based on the specified options.


Nested Class Summary
static class SimpleTimeOfDayFormat.TimeOfDayParseException
           
 
Constructor Summary
SimpleTimeOfDayFormat(boolean showSeconds, boolean military, java.lang.String separator)
          Creates an instance of SimpleTimeOfDayFormat.
 
Method Summary
 java.lang.String format(int seconds)
           
static int parse(java.lang.String text)
          Thread-Safe method to parse time of day.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTimeOfDayFormat

public SimpleTimeOfDayFormat(boolean showSeconds,
                             boolean military,
                             java.lang.String separator)
Creates an instance of SimpleTimeOfDayFormat.

Parameters:
showSeconds - Whether to show seconds at all.
military - Whether to display 24-hour format or 12-hour format.
separator - The separator to use between values, such as ":".
Method Detail

format

public java.lang.String format(int seconds)
Specified by:
format in interface TimeOfDayFormat

parse

public static int parse(java.lang.String text)
                 throws SimpleTimeOfDayFormat.TimeOfDayParseException

Thread-Safe method to parse time of day. No trailing or leading spaces are allowed. Digit groups may defined using one or two digits.

Time of day string format: H[H][:M[M][:S[S]]] [am|pm|AM|PM] , for example:

Returns:
number of seconds since midnight represented by given time of day string
Throws:
SimpleTimeOfDayFormat.TimeOfDayParseException


Copyright © 2007. All Rights Reserved.