fipaos.util
Class UTCContainer

java.lang.Object
  |
  +--fipaos.util.UTCContainer
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
UTCDuration, UTCTime

public class UTCContainer
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Simple container for UTC time data

See Also:
Serialized Form

Field Summary
protected  int[] _date_data
          Array to contain the date/time information
protected  boolean _use_millis
          Boolean to denote if milliseconds should be used
protected  boolean _use_seconds
          Boolean to denote if seconds should be used
static int DATE
          Constant to represent the date
static int HOUR
          Constant to represent the hour of day (24 hour format)
static int MILLISECOND
          Constant to represent the millisecond of the second
static int MINUTE
          Constant to represent the minute of the hour
static int MONTH
          Constant to represent the month
static int SECOND
          Constant to represent the second of the minute
static int YEAR
          Constant to represent the year
 
Constructor Summary
protected UTCContainer()
          Constructs a "blank" UTCContainer
  UTCContainer(int year, int month, int date, int hour, int minute, int second, int millis)
          Constructs a UTCContainer object from the given parameters
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(UTCContainer otherTime)
          Method to provide a mechanism for determining if two times are the same
 int get(int field)
          Method to allow retreival of individual fields from the time/date
 boolean isAfter(UTCContainer time)
          Method to provide a way of determining if a UTCContainer object represents a time before the time this UTCContainer instance represents.
 boolean isBefore(UTCContainer otherTime)
          Method to provide a way of determining if a UTCContainer object represents a time after the time this UTCContainer instance represents
 void set(int field, int value)
          Method to allow manual setting of date/time fields
 void setAccuracy(int accuracy)
          Method to change accuracy of UTCTime object.
 java.lang.String toString()
          Overrides default Object.toString()
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

YEAR

public static final int YEAR
Constant to represent the year

MONTH

public static final int MONTH
Constant to represent the month

DATE

public static final int DATE
Constant to represent the date

HOUR

public static final int HOUR
Constant to represent the hour of day (24 hour format)

MINUTE

public static final int MINUTE
Constant to represent the minute of the hour

SECOND

public static final int SECOND
Constant to represent the second of the minute

MILLISECOND

public static final int MILLISECOND
Constant to represent the millisecond of the second

_date_data

protected int[] _date_data
Array to contain the date/time information

_use_seconds

protected boolean _use_seconds
Boolean to denote if seconds should be used

_use_millis

protected boolean _use_millis
Boolean to denote if milliseconds should be used
Constructor Detail

UTCContainer

public UTCContainer(int year,
                    int month,
                    int date,
                    int hour,
                    int minute,
                    int second,
                    int millis)
Constructs a UTCContainer object from the given parameters
Parameters:
year - The year
month - The month (1 to 12)
date - The day of the month (1 to (28 thru 31))
hour - The hour of the day (0 to 23)
minute - The minute of the hour (0 to 59)
second - The second of the minute (0 to 59, or -1 for minute precision)
millis - The millisecond of the second (0 to 999, or -1 for second precision)

UTCContainer

protected UTCContainer()
Constructs a "blank" UTCContainer
Method Detail

get

public int get(int field)
Method to allow retreival of individual fields from the time/date
Parameters:
field - The field which is to be retreived
Returns:
The value of the given field

set

public void set(int field,
                int value)
Method to allow manual setting of date/time fields
Parameters:
field - The field which is to be changed
value - The new value to set the field to

isBefore

public boolean isBefore(UTCContainer otherTime)
Method to provide a way of determining if a UTCContainer object represents a time after the time this UTCContainer instance represents
Parameters:
time - A UTCContainer object to compare

isAfter

public boolean isAfter(UTCContainer time)
Method to provide a way of determining if a UTCContainer object represents a time before the time this UTCContainer instance represents.
Parameters:
time - A UTCContainer object to compare

equals

public boolean equals(UTCContainer otherTime)
Method to provide a mechanism for determining if two times are the same
Parameters:
time - The time to compare

toString

public java.lang.String toString()
Overrides default Object.toString()
Overrides:
toString in class java.lang.Object

setAccuracy

public void setAccuracy(int accuracy)
Method to change accuracy of UTCTime object. This can be changed to MINUTE, SECOND or MILLISECOND. NOTE: Internally the contents of unused fields will be reset to 0.
Parameters:
accuracy - One of the above constants

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object