com.ds.fw.types.data
Class FwTimestamp

java.lang.Object
  |
  +--com.ds.fw.types.FwSimpleObject
        |
        +--com.ds.fw.types.data.FwTimestamp
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, FwCopyableIF, FwDisplayableIF, FwSimpleObjectIF, FwTimestampIF, java.io.Serializable

public class FwTimestamp
extends FwSimpleObject
implements FwTimestampIF

See Also:
Serialized Form

Field Summary
 com.ds.fw.types.data.FwDateIF _date
           
 com.ds.fw.types.data.FwTimeIF _time
           
 
Constructor Summary
FwTimestamp()
           
 
Method Summary
 com.ds.fw.types.data.FwDateIF _getDate()
          Gets the date
 com.ds.fw.types.data.FwTimeIF _getTime()
          Gets the time
 void addHours(int n)
          Adds hours to the FwTimestamp object
 void addMilliseconds(int n)
          Adds milliseconds to the FwTimestamp object
 void addMinutes(int n)
          Adds minutes to the FwTimestamp object
 void addSeconds(int n)
          Adds seconds to the FwTimestamp object
 void beNow()
          Sets the date and time to the current
 void changeTimeZone(java.lang.String oldId, java.lang.String newId)
          Change the time zone
 int compareTo(java.lang.Object e)
          Compare the date and the time of two FwTimestampIF
static com.ds.fw.types.data.FwTimestampIF createNow()
          Create a new date with the current date and time.
 boolean equals(java.lang.Object o)
          Compares if two objects of this type are equals
 com.ds.fw.types.data.FwDateIF getDate()
          Gets the copy of the date
 int getDay()
          Gets the day
 int getHour()
          Gets the hour
 java.util.Date getJavaDate()
          Gets the date
 java.util.Date getJavaDate(java.util.Calendar c, boolean millis)
          Gets the date
 java.util.Date getJavaDateWithoutMilliseconds()
          Gets the date
 int getMillisecond()
          Gets the milliseconds
 int getMinute()
          Gets the minute
 int getMonth()
          Gets the month
 int getSecond()
          Gets the seconds
 com.ds.fw.types.data.FwTimeIF getTime()
          Gets the copy of the time
 int getYear()
          Gets the year
 int hashCode()
          Generate an unique code for the date and the time
 boolean isAfter(com.ds.fw.types.data.FwTimestampIF ts)
          Check if the date and the time are after the date and the time of the given as parameter FwTimestampIF
 boolean isBefore(com.ds.fw.types.data.FwTimestampIF ts)
          Check if the date and time are before the date and the time of the given as parameter FwTimestampIF
 void postCopy()
          This should never be called directly from a client.
 void setDay(int o)
          Sets the day
 void setHour(int o)
          Sets the hour
 void setJavaDate(java.util.Date d)
          Sets the date
 void setJavaDate(java.util.Date d, java.util.Calendar c)
          Sets the date
 void setMillisecond(int o)
          Sets the milliseconds
 void setMinute(int o)
          Sets the minutes
 void setMonth(int o)
          Sets the month
 void setSecond(int o)
          Sets the seconds
 void setYear(int o)
          Sets the year
 long subtract(com.ds.fw.types.data.FwTimestampIF ts)
          Gets the difference between two FwTimestamp objects.
 java.lang.String toStringValue()
          Return a string representation of FwTimestamp
 
Methods inherited from class com.ds.fw.types.FwSimpleObject
getClassName, getClone, getCopy, getCopy, getDeepCopy, getDisplayString, getDisplayStringFor, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ds.fw.types.FwSimpleObjectIF
getClassName, getClone, getCopy, getCopy, getDeepCopy, getDisplayString, getDisplayStringFor, toString
 

Field Detail

_date

public com.ds.fw.types.data.FwDateIF _date

_time

public com.ds.fw.types.data.FwTimeIF _time
Constructor Detail

FwTimestamp

public FwTimestamp()
Method Detail

createNow

public static com.ds.fw.types.data.FwTimestampIF createNow()
Create a new date with the current date and time.


_getDate

public com.ds.fw.types.data.FwDateIF _getDate()
Gets the date

Specified by:
_getDate in interface FwTimestampIF
Returns:
the date

_getTime

public com.ds.fw.types.data.FwTimeIF _getTime()
Gets the time

Specified by:
_getTime in interface FwTimestampIF
Returns:
the time

getDay

public int getDay()
Gets the day

Specified by:
getDay in interface FwTimestampIF
Returns:
the day as number

setDay

public void setDay(int o)
Sets the day

Specified by:
setDay in interface FwTimestampIF
Parameters:
o - - the new day

getMonth

public int getMonth()
Gets the month

Specified by:
getMonth in interface FwTimestampIF
Returns:
the month

setMonth

public void setMonth(int o)
Sets the month

Specified by:
setMonth in interface FwTimestampIF
Parameters:
o - - the new month

getYear

public int getYear()
Gets the year

Specified by:
getYear in interface FwTimestampIF
Returns:
the year

setYear

public void setYear(int o)
Sets the year

Specified by:
setYear in interface FwTimestampIF
Parameters:
o - - the new year

getHour

public int getHour()
Gets the hour

Specified by:
getHour in interface FwTimestampIF
Returns:
the hour

setHour

public void setHour(int o)
Sets the hour

Specified by:
setHour in interface FwTimestampIF
Parameters:
o - - the new hour

getMinute

public int getMinute()
Gets the minute

Specified by:
getMinute in interface FwTimestampIF
Returns:
the minutes

setMinute

public void setMinute(int o)
Sets the minutes

Specified by:
setMinute in interface FwTimestampIF
Parameters:
o - - the value for the minutes

getSecond

public int getSecond()
Gets the seconds

Specified by:
getSecond in interface FwTimestampIF
Returns:
the seconds

setSecond

public void setSecond(int o)
Sets the seconds

Specified by:
setSecond in interface FwTimestampIF
Parameters:
o - - the new value for the seconds

getMillisecond

public int getMillisecond()
Gets the milliseconds

Specified by:
getMillisecond in interface FwTimestampIF
Returns:
the milliseconds

setMillisecond

public void setMillisecond(int o)
Sets the milliseconds

Specified by:
setMillisecond in interface FwTimestampIF
Parameters:
o - - the new value for the milliseconds

beNow

public void beNow()
Sets the date and time to the current

Specified by:
beNow in interface FwTimestampIF

getJavaDate

public java.util.Date getJavaDate()
Gets the date

Specified by:
getJavaDate in interface FwTimestampIF
Returns:
the date as java.util.Date object with milliseconds included

getJavaDateWithoutMilliseconds

public java.util.Date getJavaDateWithoutMilliseconds()
Gets the date

Specified by:
getJavaDateWithoutMilliseconds in interface FwTimestampIF
Returns:
the date as java.util.Date object without milliseconds included

getJavaDate

public java.util.Date getJavaDate(java.util.Calendar c,
                                  boolean millis)
Gets the date

Parameters:
c - - a calendar object
millis - - if true the return date is with milliseconds included
Returns:
the date as java.util.Date object

setJavaDate

public void setJavaDate(java.util.Date d)
Sets the date

Specified by:
setJavaDate in interface FwTimestampIF
Parameters:
d - - the new date

setJavaDate

public void setJavaDate(java.util.Date d,
                        java.util.Calendar c)
Sets the date

Parameters:
d - - the new date
c - - a calendar object

changeTimeZone

public void changeTimeZone(java.lang.String oldId,
                           java.lang.String newId)
Change the time zone

Specified by:
changeTimeZone in interface FwTimestampIF
Parameters:
oldId -
newId -

getDate

public com.ds.fw.types.data.FwDateIF getDate()
Gets the copy of the date

Specified by:
getDate in interface FwTimestampIF
Returns:

getTime

public com.ds.fw.types.data.FwTimeIF getTime()
Gets the copy of the time

Specified by:
getTime in interface FwTimestampIF
Returns:

postCopy

public void postCopy()
Description copied from interface: FwCopyableIF
This should never be called directly from a client. This method is used to make a clone independent from its original. Subclasses that override this method should always call super.postCopy().

Specified by:
postCopy in interface FwSimpleObjectIF
Overrides:
postCopy in class FwSimpleObject

equals

public boolean equals(java.lang.Object o)
Compares if two objects of this type are equals

Overrides:
equals in class java.lang.Object
Parameters:
o -
Returns:
true if they are equal

hashCode

public int hashCode()
Generate an unique code for the date and the time

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code generated

isBefore

public boolean isBefore(com.ds.fw.types.data.FwTimestampIF ts)
Check if the date and time are before the date and the time of the given as parameter FwTimestampIF

Specified by:
isBefore in interface FwTimestampIF
Parameters:
ts -
Returns:
true if they are before, false - otherwise

isAfter

public boolean isAfter(com.ds.fw.types.data.FwTimestampIF ts)
Check if the date and the time are after the date and the time of the given as parameter FwTimestampIF

Specified by:
isAfter in interface FwTimestampIF
Parameters:
ts -
Returns:
true if they are after

compareTo

public int compareTo(java.lang.Object e)
Compare the date and the time of two FwTimestampIF

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
e -
Returns:
0 if they are equal, -1 if the first is before the FwTimestampIF , given as parameter 1 - if it is after

toStringValue

public java.lang.String toStringValue()
Return a string representation of FwTimestamp

Specified by:
toStringValue in interface FwSimpleObjectIF
Overrides:
toStringValue in class FwSimpleObject
Returns:
the string representation of the date , followed by the time

addMilliseconds

public void addMilliseconds(int n)
Adds milliseconds to the FwTimestamp object

Specified by:
addMilliseconds in interface FwTimestampIF
Parameters:
n - - the number of the milliseconds which we want to add

addSeconds

public void addSeconds(int n)
Adds seconds to the FwTimestamp object

Specified by:
addSeconds in interface FwTimestampIF
Parameters:
n - - the number of the seconds which we want to add

addMinutes

public void addMinutes(int n)
Adds minutes to the FwTimestamp object

Specified by:
addMinutes in interface FwTimestampIF
Parameters:
n - - the number of the minutes which we want to add

addHours

public void addHours(int n)
Adds hours to the FwTimestamp object

Specified by:
addHours in interface FwTimestampIF
Parameters:
n - - the number of the hours which we want to add

subtract

public long subtract(com.ds.fw.types.data.FwTimestampIF ts)
Gets the difference between two FwTimestamp objects.

Specified by:
subtract in interface FwTimestampIF
Parameters:
ts -
Returns:
the number of milliseconds