org.nuiton.util
Class PeriodDates

java.lang.Object
  extended by org.nuiton.util.PeriodDates
All Implemented Interfaces:
Serializable

public class PeriodDates
extends Object
implements Serializable

TODO tchemit 2010-08-25 JAVADOC + I18N PeriodDates.java

Created on 2009-08-13

Version:
$Id: PeriodDates.java 2360 2012-06-11 10:24:36Z tchemit $
Author:
fdesbois
See Also:
Serialized Form

Constructor Summary
PeriodDates()
           
PeriodDates(Calendar fromCalendar, Calendar thruCalendar)
           
PeriodDates(Date fromDate, Date thruDate)
           
 
Method Summary
 boolean afterBegin(Calendar calendar)
           
 boolean afterBegin(Date date)
           
 boolean afterEnd(Calendar calendar)
           
 boolean afterEnd(Date date)
           
 boolean beforeEnd(Calendar calendar)
           
 boolean beforeEnd(Date date)
           
 boolean between(Calendar calendar)
           
 boolean between(Date date)
           
static PeriodDates createMonthsPeriodFromToday(int monthAfter)
          Create a period from the date of today.
 List<String> getFormatedMonths()
           
 Date getFromDate()
           
 int getFromMonth()
           
 List<Date> getMonths()
           
 String getPattern()
           
 Date getThruDate()
           
 void initDayOfMonthExtremities()
          Set first day of month for dateFrom and last day of month for dateThru
 void setFromDate(Date fromDate)
           
 void setPattern(String pattern)
           
 void setThruDate(Date thruDate)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PeriodDates

public PeriodDates()

PeriodDates

public PeriodDates(Date fromDate,
                   Date thruDate)
            throws IllegalArgumentException
Throws:
IllegalArgumentException

PeriodDates

public PeriodDates(Calendar fromCalendar,
                   Calendar thruCalendar)
            throws IllegalArgumentException
Throws:
IllegalArgumentException
Method Detail

createMonthsPeriodFromToday

public static PeriodDates createMonthsPeriodFromToday(int monthAfter)
Create a period from the date of today. If monthAfter is negative, the current day will be the thruDate of the period. The period extremities will be initialized (first day of month for fromDate and last day of month for thruDate). Time is set to 0 for both dates.
 Ex 1 :
 Today = 12/05/2009
 monthAfter = 5
 Period = 01/05/2009 to 31/10/2009
 Ex 2 :
 Today = 12/05/2009
 monthAfter = -4
 Period = 01/01/2009 to 31/05/2009
 

Parameters:
monthAfter - the number of month from the current one
Returns:
a new PeriodDates

getPattern

public String getPattern()

setPattern

public void setPattern(String pattern)

initDayOfMonthExtremities

public void initDayOfMonthExtremities()
Set first day of month for dateFrom and last day of month for dateThru


setFromDate

public void setFromDate(Date fromDate)

getFromDate

public Date getFromDate()

getFromMonth

public int getFromMonth()

setThruDate

public void setThruDate(Date thruDate)

getThruDate

public Date getThruDate()

getMonths

public List<Date> getMonths()

getFormatedMonths

public List<String> getFormatedMonths()

beforeEnd

public boolean beforeEnd(Calendar calendar)

afterEnd

public boolean afterEnd(Calendar calendar)

afterBegin

public boolean afterBegin(Calendar calendar)

between

public boolean between(Calendar calendar)

beforeEnd

public boolean beforeEnd(Date date)

afterEnd

public boolean afterEnd(Date date)

afterBegin

public boolean afterBegin(Date date)

between

public boolean between(Date date)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2012 CodeLutin. All Rights Reserved.