Package org.silverpeas.core.date.period
Class Period
- java.lang.Object
-
- org.silverpeas.core.date.period.Period
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
- Direct Known Subclasses:
DayPeriod
,MonthPeriod
,WeekPeriod
,YearPeriod
@Deprecated public class Period extends Object implements Comparable, Serializable, Cloneable
Deprecated.UsePeriod
Class representing a period between two dates and offering tools around it.User: Yohann Chastagnier Date: 19/04/13
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Period(DateTime beginDatable, DateTime endDatable)
Deprecated.Constructor : Constructs a newly allocatedperiod
.protected
Period(DateTime beginDatable, DateTime endDatable, TimeZone timeZone)
Deprecated.Constructor : Constructs a newly allocatedperiod
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Period
check(Period period)
Deprecated.Checks if the specified period and returns the specified one if defined, or the commonUNDEFINED
otherwise.Period
clone()
Deprecated.int
compareTo(Object o)
Deprecated.int
compareTo(Period period)
Deprecated.The comparison is at first time executed on the begin dates.boolean
contains(Date date)
Deprecated.Checks if the given date is included in the period.boolean
contains(Period period)
Deprecated.Checks if the given period is included in the period.boolean
containsPartOf(Period period)
Deprecated.Checks if the given period is partially included in the period.boolean
equals(Object o)
Deprecated.protected String
formatPeriodForTests()
Deprecated.static Period
from(Date beginDate, Date endDate)
Deprecated.Initialize a period from given dates.static Period
from(Date beginDate, Date endDate, TimeZone timeZone)
Deprecated.Initialize a period from given dates.static Period
from(Date referenceDate, TimeZone timeZone, PeriodType periodType)
Deprecated.static Period
from(Date referenceDate, TimeZone timeZone, PeriodType periodType, String locale)
Deprecated.static Period
from(Date referenceDate, PeriodType periodType)
Deprecated.Initialize a period from a date and a type of period.static Period
from(Date referenceDate, PeriodType periodType, String locale)
Deprecated.static Period
from(DateTime beginDatable, DateTime endDatable)
Deprecated.Initialize a period from given dates.static Period
from(DateTime referenceDatable, PeriodType periodType)
Deprecated.static Period
from(DateTime referenceDatable, PeriodType periodType, String locale)
Deprecated.DateTime
getBeginDatable()
Deprecated.Gets the begin date of the period represented as aTemporal
.Date
getBeginDate()
Deprecated.Gets the begin date of the period.Duration
getCoveredDaysTimeData()
Deprecated.Computes the number of whole or partial days covered by the period.Duration
getElapsedTimeData()
Deprecated.Computes the elapsed time between the begin and the end dates.DateTime
getEndDatable()
Deprecated.Gets the end date of the period represented as aTemporal
.Date
getEndDate()
Deprecated.Gets the end date of the period.PeriodType
getPeriodType()
Deprecated.Gets the type of the period.static Period
getPeriodWithUndefinedIfNull(Date beginDate, Date endDate)
Deprecated.Initialize a period from given dates (undefined dates are taken into account for null ones).TimeZone
getTimeZone()
Deprecated.The time zone has no meaning for a date.int
hashCode()
Deprecated.Period
inTimeZone(TimeZone timeZone)
Deprecated.The time zone for a period has no meaning.boolean
isBeginDefined()
Deprecated.This method is a shortcut ofisDefined()
call ongetBeginDatable()
.boolean
isBeginNotDefined()
Deprecated.This method is a shortcut ofisNotDefined()
call ongetBeginDatable()
.boolean
isDefined()
Deprecated.Indicates if one of begin date or end date is defined.boolean
isEndDefined()
Deprecated.This method is a shortcut ofisDefined()
call ongetEndDatable()
.boolean
isEndNotDefined()
Deprecated.This method is a shortcut ofisNotDefined()
call ongetEndDatable()
.boolean
isLongerThan(Period period)
Deprecated.boolean
isNotDefined()
Deprecated.Indicates the opssite ofisDefined()
.boolean
isValid()
Deprecated.void
setDate(Date dateReference, TimeZone timeZone, PeriodType periodType)
Deprecated.void
setDate(Date dateReference, PeriodType periodType)
Deprecated.void
setDate(DateTime referenceDatable, PeriodType periodType)
Deprecated.void
setDates(Date beginDate, Date endDate)
Deprecated.void
setDates(Date beginDate, Date endDate, TimeZone timeZone)
Deprecated.void
setDates(DateTime beginDatable, DateTime endDatable)
Deprecated.protected void
setPeriodType(PeriodType periodType)
Deprecated.Sets the type of the period.String
toString()
Deprecated.
-
-
-
Field Detail
-
UNDEFINED
public static final Period UNDEFINED
Deprecated.
-
-
Constructor Detail
-
Period
protected Period(DateTime beginDatable, DateTime endDatable)
Deprecated.Constructor : Constructs a newly allocatedperiod
. TimeZone is set from the begin date of the period.- Parameters:
beginDatable
- the date of the beginning of the period.endDatable
- the date of the ending of the period.
-
Period
protected Period(DateTime beginDatable, DateTime endDatable, TimeZone timeZone)
Deprecated.Constructor : Constructs a newly allocatedperiod
.- Parameters:
beginDatable
- the date of the beginning of the period.endDatable
- the date of the ending of the period.timeZone
- the time zone to set to this period.
-
-
Method Detail
-
check
public static Period check(Period period)
Deprecated.Checks if the specified period and returns the specified one if defined, or the commonUNDEFINED
otherwise.- Parameters:
period
- the period- Returns:
- the specified period is defined, the common
UNDEFINED
otherwise.
-
getPeriodWithUndefinedIfNull
public static Period getPeriodWithUndefinedIfNull(Date beginDate, Date endDate)
Deprecated.Initialize a period from given dates (undefined dates are taken into account for null ones). The treatment is trying to identify the type of the period (PeriodType
).- Parameters:
beginDate
- the date of the beginning of the period.endDate
- the date of the ending of the period.- Returns:
- the period between the two dates
-
from
public static Period from(Date beginDate, Date endDate)
Deprecated.Initialize a period from given dates. The treatment is trying to identify the type of the period (PeriodType
).- Parameters:
beginDate
- the date of the beginning of the period.endDate
- the date of the ending of the period.- Returns:
- the period between the two dates
-
from
public static Period from(Date beginDate, Date endDate, TimeZone timeZone)
Deprecated.Initialize a period from given dates. The treatment is trying to identify the type of the period (PeriodType
).- Parameters:
beginDate
- the date of the beginning of the period.endDate
- the date of the ending of the period.timeZone
- the time zone to set to this period.- Returns:
- the period between the two dates
-
from
public static Period from(DateTime beginDatable, DateTime endDatable)
Deprecated.Initialize a period from given dates. The treatment is trying to identify the type of the period (PeriodType
).- Parameters:
beginDatable
- the date of the beginning of the period.endDatable
- the date of the ending of the period.- Returns:
- the period between the two dates
-
from
public static Period from(Date referenceDate, PeriodType periodType)
Deprecated.Initialize a period from a date and a type of period.- Parameters:
referenceDate
- the date at which starts the periodperiodType
- the type of the period- Returns:
- the period
-
from
public static Period from(Date referenceDate, TimeZone timeZone, PeriodType periodType)
Deprecated.
-
from
public static Period from(DateTime referenceDatable, PeriodType periodType)
Deprecated.
-
from
public static Period from(Date referenceDate, PeriodType periodType, String locale)
Deprecated.
-
from
public static Period from(Date referenceDate, TimeZone timeZone, PeriodType periodType, String locale)
Deprecated.
-
from
public static Period from(DateTime referenceDatable, PeriodType periodType, String locale)
Deprecated.
-
isDefined
public boolean isDefined()
Deprecated.Indicates if one of begin date or end date is defined.- Returns:
- true if period is defined, false otherwise.
-
isNotDefined
public boolean isNotDefined()
Deprecated.Indicates the opssite ofisDefined()
.- Returns:
- true if period is not defined, false otherwise.
-
inTimeZone
public Period inTimeZone(TimeZone timeZone)
Deprecated.The time zone for a period has no meaning.- Parameters:
timeZone
- the time zone to set to this period.- Returns:
- itself
-
getTimeZone
public TimeZone getTimeZone()
Deprecated.The time zone has no meaning for a date.- Returns:
- the time zone in which this period is set.
-
getPeriodType
public PeriodType getPeriodType()
Deprecated.Gets the type of the period.- Returns:
- the period type
-
setPeriodType
protected void setPeriodType(PeriodType periodType)
Deprecated.Sets the type of the period.- Parameters:
periodType
- the period type
-
getBeginDate
public Date getBeginDate()
Deprecated.Gets the begin date of the period. It represents the begin date of the event if no recurrence exists, or the begin date of the first occurence of the event if a recurrence exists.- Returns:
- the beginning date
-
getEndDate
public Date getEndDate()
Deprecated.Gets the end date of the period.- Returns:
- the ending date
-
getBeginDatable
public DateTime getBeginDatable()
Deprecated.Gets the begin date of the period represented as aTemporal
. (seegetBeginDate()
for more details).- Returns:
- the beginning date
-
isBeginDefined
public boolean isBeginDefined()
Deprecated.This method is a shortcut ofisDefined()
call ongetBeginDatable()
.- Returns:
- true if
getBeginDatable()
returns defined date, false otherwise.
-
isBeginNotDefined
public boolean isBeginNotDefined()
Deprecated.This method is a shortcut ofisNotDefined()
call ongetBeginDatable()
.- Returns:
- true if
getBeginDatable()
returns a not defined date, false otherwise.
-
getEndDatable
public DateTime getEndDatable()
Deprecated.Gets the end date of the period represented as aTemporal
. (seegetEndDate()
for more details).- Returns:
- the ending date
-
isEndDefined
public boolean isEndDefined()
Deprecated.This method is a shortcut ofisDefined()
call ongetEndDatable()
.- Returns:
- true if
getEndDatable()
returns defined date, false otherwise.
-
isEndNotDefined
public boolean isEndNotDefined()
Deprecated.This method is a shortcut ofisNotDefined()
call ongetEndDatable()
.- Returns:
- true if
getEndDatable()
returns a not defined date, false otherwise.
-
setDate
public void setDate(Date dateReference, PeriodType periodType)
Deprecated.
-
setDate
public void setDate(Date dateReference, TimeZone timeZone, PeriodType periodType)
Deprecated.
-
setDate
public void setDate(DateTime referenceDatable, PeriodType periodType)
Deprecated.
-
getElapsedTimeData
public Duration getElapsedTimeData()
Deprecated.Computes the elapsed time between the begin and the end dates.- Returns:
- the elapsed time computed represented by
Duration
. To retrieve informations from this returned object :// Gets the elpased time in milliseconds
period.getElapsedTimeData().getTime();
// Gets the elpased time in seconds
period.getElapsedTimeData().getTimeConverted(TimeUnit.SEC);
// Gets the elpased time in years
period.getElapsedTimeData().getTimeConverted(TimeUnit.YEAR);
...
// Gets the elpased time in the best unit value
period.getElapsedTimeData().getBestValue();
-
getCoveredDaysTimeData
public Duration getCoveredDaysTimeData()
Deprecated.Computes the number of whole or partial days covered by the period.- Returns:
- the number of whole or partial days covered by the period. represented by
Duration
. To retrieve informations from this returned object :// Gets the number of days (in milliseconds)
period.getCoveredDaysTimeData().getTime();
// Gets the number of days (in days)
period.getCoveredDaysTimeData().getTimeConverted(TimeUnit.DAY);
...
// Gets the number of days (in best unit value)
period.getCoveredDaysTimeData().getBestValue();
-
compareTo
public int compareTo(Object o)
Deprecated.- Specified by:
compareTo
in interfaceComparable
-
compareTo
public int compareTo(Period period)
Deprecated.The comparison is at first time executed on the begin dates. If they are equals, then it is executed on the end dates.- Parameters:
period
- the period- Returns:
- the comparison result
-
isLongerThan
public boolean isLongerThan(Period period)
Deprecated.
-
isValid
public boolean isValid()
Deprecated.
-
formatPeriodForTests
protected String formatPeriodForTests()
Deprecated.
-
contains
public boolean contains(Date date)
Deprecated.Checks if the given date is included in the period.- Parameters:
date
- a date- Returns:
true
if the given date is included in the period.
-
contains
public boolean contains(Period period)
Deprecated.Checks if the given period is included in the period.- Parameters:
period
- a period- Returns:
true
if the given period is included in the period.
-
containsPartOf
public boolean containsPartOf(Period period)
Deprecated.Checks if the given period is partially included in the period.- Parameters:
period
- Une date- Returns:
true
if the given period is partially included in the period.
-
-