## org.ggf.drmaa
Class PartialTimestampFormat

    java.lang.Object
      java.text.Format
          org.ggf.drmaa.PartialTimestampFormat

All Implemented Interfaces:
  java.lang.Cloneable, java.io.Serializable

public class PartialTimestampFormat
extends java.text.Format

This class coverts a PartialTimestamp to and from the DRMAA specified time string. In order to represent a PartialTimestamp object as a string, the PartialTimestamp object cannot have an unset field that is less significant than the most significant set field. That is to say that if `CENTURY` is set, `YEAR`, `MONTH`, and `DAY_OF_MONTH` must also be set. `SECONDS` and `ZONE_OFFSET` are always optional.

Example:

       PartialTimestamp date = new PartialTimestamp ();
       PartialTimestampFormat ptf = new PartialTimestampFormat ();

       date.set (PartialTimestamp.HOUR_OF_DAY, 11);
       date.set (PartialTimestamp.MINUTE, 30);

       String timeString = ptf.format (date);

       PartialTimestamp date2 = ptf.parse (timeString);

       assert (date.equals (date2));

Since:
  0.5
Author:
  dan.templeton@sun.com
See Also:
  `PartialTimestamp`, Serialized Form

Nested Class Summary

Nested classes inherited from class java.text.Format
`java.text.Format.Field`

Constructor Summary
`PartialTimestampFormat()` Creates a new instance of PartialTimestampFormat

Method Summary
`java.lang.Object` `clone()` Creates a copy of this object.
`java.lang.StringBuffer` `format(java.lang.Object obj, java.lang.StringBuffer stringBuffer, java.text.FieldPosition fieldPosition)` Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer.
`java.lang.String` `format(PartialTimestamp obj)` Translates the PartialTimestamp into a DRMAA specified time string.
`java.lang.StringBuffer` `format(PartialTimestamp obj, java.lang.StringBuffer stringBuffer, java.text.FieldPosition fieldPosition)` Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer.
`PartialTimestamp` `parse(java.lang.String str)` Translates a DRMAA specified time string into a PartialTimestamp object.
`PartialTimestamp` `parse(java.lang.String str, java.text.ParsePosition parsePosition)` Translates a DRMAA specified time string into a PartialTimestamp object.
`java.lang.Object` `parseObject(java.lang.String str, java.text.ParsePosition parsePosition)` Translates a DRMAA specified time string into a PartialTimestamp object.

Methods inherited from class java.text.Format
`format, formatToCharacterIterator, parseObject`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PartialTimestampFormat

    public PartialTimestampFormat()

  Creates a new instance of PartialTimestampFormat

Method Detail

### clone

    public java.lang.Object clone()

  Creates a copy of this object. In reality, this method just creates a new PartialTimestampFormat object since PartialTimestampFormat contains no state.

  Returns:
    a copy of this object

### format

    public java.lang.StringBuffer format(java.lang.Object obj,
                                         java.lang.StringBuffer stringBuffer,
                                         java.text.FieldPosition fieldPosition)

  Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. Since the PartialTimestampFormat class doesn't use fields, the fieldPosition parameter is ignored. This method is equivalent to `stringBuffer.append (format (obj))`.

  In order to represent a PartialTimestamp object as a string, the PartialTimestamp object cannot have an unset field that is less significant than the most significant set field. TThat is to say that if `CENTURY` is set, `YEAR`, `MONTH`, and `DAY_OF_MONTH` must also be set. `SECONDS` and `ZONE_OFFSET` are always optional.

  Parameters:
    `obj` - the object to format
    `stringBuffer` - the StringBuffer to which to append the results
    `fieldPosition` - ignored
  Returns:
    the stringBuffer parameter

### format

    public java.lang.StringBuffer format(PartialTimestamp obj,
                                         java.lang.StringBuffer stringBuffer,
                                         java.text.FieldPosition fieldPosition)

  Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. Since the PartialTimestampFormat class doesn't use fields, the fieldPosition parameter is ignored. This method is equivalent to `stringBuffer.append (format (obj))`.

  In order to represent a PartialTimestamp object as a string, the PartialTimestamp object cannot have an unset field that is less significant than the most significant set field. That is to say that if `CENTURY` is set, `YEAR`, `MONTH`, and `DAY_OF_MONTH` must also be set. `SECONDS` and `ZONE_OFFSET` are always optional.

  Parameters:
    `obj` - the object to format
    `stringBuffer` - the StringBuffer to which to append the results
    `fieldPosition` - ignored
  Returns:
    the stringBuffer parameter

### format

    public java.lang.String format(PartialTimestamp obj)

  Translates the PartialTimestamp into a DRMAA specified time string. This method is equivalent to `format (obj, new StringBuffer (), new FieldPosition (0)).toString ()`.

  In order to represent a PartialTimestamp object as a string, the PartialTimestamp object cannot have an unset field that is less significant than the most significant set field. That is to say that if `CENTURY` is set, `YEAR`, `MONTH`, and `DAY_OF_MONTH` must also be set. `SECONDS` and `ZONE_OFFSET` are always optional.

  Parameters:
    `obj` - the object to format
  Returns:
    the DRMAA specified time string

### parse

    public PartialTimestamp parse(java.lang.String str)
                           throws java.text.ParseException

  Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible, but after successfully parsing the `HOUR_OF_DAY` and `MINUTE` fields, if it encounters unparsable text, it will stop and will not throw a java.text.ParseException.

  Parameters:
    `str` - a DRMAA specified time string
  Returns:
    a PartialTimestamp object
  Throws:
    `java.text.ParseException` - thrown if the string is not parsable.

### parse

    public PartialTimestamp parse(java.lang.String str,
                                  java.text.ParsePosition parsePosition)

  Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible. Upon completion, the parse position object will contain the index of the last character parsed.

  Parameters:
    `str` - a DRMAA specified time string
    `parsePosition` - the parse position object
  Returns:
    a PartialTimestamp object

### parseObject

    public java.lang.Object parseObject(java.lang.String str,
                                        java.text.ParsePosition parsePosition)

  Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible. Upon completion, the parse position object will contain the index of the last character parsed.

  Parameters:
    `str` - a DRMAA specified time string
    `parsePosition` - the parse position object
  Returns:
    a PartialTimestamp object