net.kwfgrid.gwes.jaxen
Class TimeScheme

java.lang.Object
  extended by net.kwfgrid.gwes.jaxen.TimeScheme
All Implemented Interfaces:
Cloneable, Comparable

public class TimeScheme
extends Object
implements Comparable, Cloneable

TimeScheme is a class for storing the time in different formats.

Version:
$Id: TimeScheme.java 1419 2010-11-01 14:12:17Z hoheisel $
Author:
Andreas Hoheisel (www.andreas-hoheisel.de)

Field Summary
 Calendar cal
          time format: Gregorian Calendar
 Date dat
          time format: Date
 long ms
          time format: number of milliseconds since January 1, 1970, 00:00:00 GMT
 
Constructor Summary
TimeScheme()
          Constructs a default TimeScheme using the current time in the default time zone with the default locale.
TimeScheme(int year, int month, int date)
          Constructs a TimeScheme with the given date set in the default time zone with the default locale.
TimeScheme(int year, int month, int date, int hour, int minute)
          Constructs a TimeScheme with the given date and time set in the default time zone with the default locale.
TimeScheme(int year, int month, int date, int hour, int minute, int second)
          Constructs a TimeScheme with the given date and time set in the default time zone with the default locale.
TimeScheme(long msSince1970)
          Constructs a TimeScheme with the given date set in the default time zone with the default locale.
TimeScheme(String dateTime)
           
 
Method Summary
 void calToMs()
          update ms and dat when cal is given.
protected  Object clone()
          Creates a deep copy of the TimeScheme
 int compareTo(Object o)
          Compares the TimeScheme to another object.
 Calendar getCal()
           
 Date getDat()
           
 String getDateTime()
           
 long getMs()
           
 void msToCal()
          update cal and dat when ms is given.
 void setCal(Calendar cal)
           
 void setDat(Date dat)
           
 void setMs(long ms)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cal

public Calendar cal
time format: Gregorian Calendar


dat

public Date dat
time format: Date


ms

public long ms
time format: number of milliseconds since January 1, 1970, 00:00:00 GMT

Constructor Detail

TimeScheme

public TimeScheme()
Constructs a default TimeScheme using the current time in the default time zone with the default locale.


TimeScheme

public TimeScheme(long msSince1970)
Constructs a TimeScheme with the given date set in the default time zone with the default locale.

Parameters:
msSince1970 - the value in ms since 1970 used to set the date

TimeScheme

public TimeScheme(String dateTime)
           throws ParseException
Throws:
ParseException

TimeScheme

public TimeScheme(int year,
                  int month,
                  int date)
Constructs a TimeScheme with the given date set in the default time zone with the default locale.

Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.

TimeScheme

public TimeScheme(int year,
                  int month,
                  int date,
                  int hour,
                  int minute)
Constructs a TimeScheme with the given date and time set in the default time zone with the default locale.

Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.
hour - the value used to set the HOUR_OF_DAY time field in the calendar.
minute - the value used to set the MINUTE time field in the calendar.

TimeScheme

public TimeScheme(int year,
                  int month,
                  int date,
                  int hour,
                  int minute,
                  int second)
Constructs a TimeScheme with the given date and time set in the default time zone with the default locale.

Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.
hour - the value used to set the HOUR_OF_DAY time field in the calendar.
minute - the value used to set the MINUTE time field in the calendar.
second - the value used to set the SECOND time field in the calendar.
Method Detail

msToCal

public void msToCal()
update cal and dat when ms is given.


calToMs

public void calToMs()
update ms and dat when cal is given.


getDateTime

public String getDateTime()

getCal

public Calendar getCal()

setCal

public void setCal(Calendar cal)

getDat

public Date getDat()

setDat

public void setDat(Date dat)

getMs

public long getMs()

setMs

public void setMs(long ms)

compareTo

public int compareTo(Object o)
Compares the TimeScheme to another object. Throws ClassCastException if the specified object's type prevents it from being compared to this TimeScheme.

Specified by:
compareTo in interface Comparable

clone

protected Object clone()
Creates a deep copy of the TimeScheme

Overrides:
clone in class Object
Returns:
the copy

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.