consciouscode.util
Class MinuteTimeFormat

java.lang.Object
  extended by java.text.Format
      extended by consciouscode.util.MinuteTimeFormat
All Implemented Interfaces:
Serializable, Cloneable

public class MinuteTimeFormat
extends Format

A Format that renders time-of-day from a value representing minutes since midnight.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
Format.Field
 
Constructor Summary
MinuteTimeFormat()
          Create a new format rendering civilian time.
MinuteTimeFormat(boolean militaryTime)
           
 
Method Summary
 String format(int minuteOfDay)
          Render the given time into a new String.
 StringBuffer format(int minuteOfDay, StringBuffer buffer, FieldPosition pos)
          Render the given time into a buffer.
 StringBuffer format(Object object, StringBuffer buffer, FieldPosition pos)
           
static String formatCivilianTime(int minuteOfDay)
          Generate a string displaying the time.
static MinuteTimeFormat getInstance()
          Get the global default instance (using civilian time).
 boolean isMilitaryTime()
           
 Object parseObject(String source, ParsePosition status)
          Not implemented.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinuteTimeFormat

public MinuteTimeFormat()
Create a new format rendering civilian time.


MinuteTimeFormat

public MinuteTimeFormat(boolean militaryTime)
Method Detail

getInstance

public static MinuteTimeFormat getInstance()
Get the global default instance (using civilian time).


formatCivilianTime

public static String formatCivilianTime(int minuteOfDay)
Generate a string displaying the time. Sample outputs are "12:00 AM" and "1:23 PM".


isMilitaryTime

public boolean isMilitaryTime()

format

public String format(int minuteOfDay)
Render the given time into a new String.

Parameters:
minuteOfDay - must be between 0 and 1440 inclusive.

format

public StringBuffer format(int minuteOfDay,
                           StringBuffer buffer,
                           FieldPosition pos)
Render the given time into a buffer.

Parameters:
minuteOfDay - must be between 0 and 1440 inclusive.
pos - is ignored.

format

public StringBuffer format(Object object,
                           StringBuffer buffer,
                           FieldPosition pos)
Specified by:
format in class Format
Parameters:
object - must be an Integer between 0 and 1440 inclusive.
pos - is ignored.

parseObject

public Object parseObject(String source,
                          ParsePosition status)
Not implemented.

Specified by:
parseObject in class Format
Throws:
UnsupportedOperationException - on every call.


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.