Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.pjsofts.eurobudget.data
Class Period  view Period download Period.java

java.lang.Object
  extended bycom.pjsofts.eurobudget.data.Period
Direct Known Subclasses:
PeriodicPeriod

public class Period
extends java.lang.Object

Define a period of Date more complex (abstract than a simple date) Used as a search parameter for example Always based on a date (current one most of the time) ? could be : - {a computed date (last,next day, day of end of the year ..)} - a user entry date - a user entry range (date min, date max) - a computed range (last/next day,week,month,quarter,semester,year)


Field Summary
static Period ANYTIME
           
private  java.util.Calendar cal
           
private  boolean calendarView
          Point of view (calendar or date basis) true: current year from calendar point of view (1st January to 31st December) false: current YEAR from this date (date-1 year, date) if false, then date is the end of current period
private static java.util.List choicesList
          one list of PeriodChoice lazy instanciated
static Period CURRENT_MONTH
           
static Period CURRENT_QUARTER
           
static Period CURRENT_YEAR
           
private  java.util.Date date
          base date for computation
private  java.util.Date dateMax
           
private  java.util.Date dateMin
          final result included (resetted: time set to 0:00am000ms) should use null or Date.setTime(0) and Date.setTime(Long.MAX_VALUE) ??
private static java.text.DateFormat DF
           
private  int freq
          freq value
private static java.util.ResourceBundle i18n
           
static int IND_CURRENT
           
static int IND_LAST
           
static int IND_NEXT
           
private  int kind
          kind value KIND_xxx
static int KIND_DAY
           
static int KIND_MONTH
           
static int KIND_QUARTER
          a Quarter is not same as 3 months as it is based on the befinning of the year
static int KIND_SEMESTER
          a Quarter is not same as 6 months as it is based on the befinning of the year
static int KIND_WEEK
           
static int KIND_YEAR
           
static int MILLISECONDS_IN_ONE_DAY
           
private static java.text.SimpleDateFormat MONTH_FORMAT
           
static java.util.Date TODAY
           
private  int type
          keep type value as TYPE_xxx
static int TYPE_COMP_RANGE
           
static int TYPE_ENTRY_RANGE
           
 
Constructor Summary
Period(java.util.Date date)
          define a user entry for one date
Period(java.util.Date min, java.util.Date max)
          define a user entry for a range (if wrong order max
Period(java.util.Date date, int kind, int freq, boolean calView)
           
 
Method Summary
private  java.util.Date computeMax(java.util.Date date, int kind, int freq, boolean calView)
           
private  java.util.Date computeMin(java.util.Date date, int kind, int freq, boolean calView)
           
 boolean contains(java.util.Date date)
           
 java.util.Date getDateMax()
           
 java.util.Date getDateMin()
           
static java.util.List getPeriodChoices(java.util.Date date)
          lazy instanciation
static void main(java.lang.String[] args)
          tester/debugger
 Period next()
          No partly null period accepted
 Period previous()
          No partly null period
 void setDateMax(java.util.Date dateMax)
          Setter for property dateMax.
 void setDateMin(java.util.Date dateMin)
          Setter for property dateMin.
private static void test(java.util.Date d)
           
private static void test(Period p)
           
 java.lang.String toString()
          nice string complex representation (year 2000, week 34, quarter 1,..)
static java.lang.String toString(int kind)
           
private  java.lang.String toString(int i, int size)
           
 java.lang.String toStringCalendar(boolean appendYear)
           
 java.lang.String toStringDateInterval()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DF

private static final java.text.DateFormat DF

i18n

private static final java.util.ResourceBundle i18n

KIND_DAY

public static final int KIND_DAY
See Also:
Constant Field Values

KIND_WEEK

public static final int KIND_WEEK
See Also:
Constant Field Values

KIND_MONTH

public static final int KIND_MONTH
See Also:
Constant Field Values

KIND_QUARTER

public static final int KIND_QUARTER
a Quarter is not same as 3 months as it is based on the befinning of the year

See Also:
Constant Field Values

KIND_SEMESTER

public static final int KIND_SEMESTER
a Quarter is not same as 6 months as it is based on the befinning of the year

See Also:
Constant Field Values

KIND_YEAR

public static final int KIND_YEAR
See Also:
Constant Field Values

IND_LAST

public static final int IND_LAST
See Also:
Constant Field Values

IND_CURRENT

public static final int IND_CURRENT
See Also:
Constant Field Values

IND_NEXT

public static final int IND_NEXT
See Also:
Constant Field Values

TYPE_ENTRY_RANGE

public static final int TYPE_ENTRY_RANGE
See Also:
Constant Field Values

TYPE_COMP_RANGE

public static final int TYPE_COMP_RANGE
See Also:
Constant Field Values

MILLISECONDS_IN_ONE_DAY

public static final int MILLISECONDS_IN_ONE_DAY
See Also:
Constant Field Values

TODAY

public static final java.util.Date TODAY

ANYTIME

public static final Period ANYTIME

CURRENT_MONTH

public static final Period CURRENT_MONTH

CURRENT_QUARTER

public static final Period CURRENT_QUARTER

CURRENT_YEAR

public static final Period CURRENT_YEAR

MONTH_FORMAT

private static final java.text.SimpleDateFormat MONTH_FORMAT

choicesList

private static java.util.List choicesList
one list of PeriodChoice lazy instanciated


calendarView

private boolean calendarView
Point of view (calendar or date basis) true: current year from calendar point of view (1st January to 31st December) false: current YEAR from this date (date-1 year, date) if false, then date is the end of current period


type

private int type
keep type value as TYPE_xxx


kind

private int kind
kind value KIND_xxx


freq

private int freq
freq value


date

private java.util.Date date
base date for computation


dateMin

private java.util.Date dateMin
final result included (resetted: time set to 0:00am000ms) should use null or Date.setTime(0) and Date.setTime(Long.MAX_VALUE) ??


dateMax

private java.util.Date dateMax

cal

private java.util.Calendar cal
Constructor Detail

Period

public Period(java.util.Date date)
define a user entry for one date


Period

public Period(java.util.Date min,
              java.util.Date max)
define a user entry for a range (if wrong order max

Period

public Period(java.util.Date date,
              int kind,
              int freq,
              boolean calView)
Method Detail

computeMin

private java.util.Date computeMin(java.util.Date date,
                                  int kind,
                                  int freq,
                                  boolean calView)

computeMax

private java.util.Date computeMax(java.util.Date date,
                                  int kind,
                                  int freq,
                                  boolean calView)

getDateMin

public java.util.Date getDateMin()

getDateMax

public java.util.Date getDateMax()

contains

public boolean contains(java.util.Date date)

next

public Period next()
No partly null period accepted


previous

public Period previous()
No partly null period


toStringDateInterval

public java.lang.String toStringDateInterval()

toString

public static java.lang.String toString(int kind)

toStringCalendar

public java.lang.String toStringCalendar(boolean appendYear)

toString

public java.lang.String toString()
nice string complex representation (year 2000, week 34, quarter 1,..)


toString

private java.lang.String toString(int i,
                                  int size)

main

public static void main(java.lang.String[] args)
tester/debugger


test

private static void test(java.util.Date d)

test

private static void test(Period p)

getPeriodChoices

public static java.util.List getPeriodChoices(java.util.Date date)
lazy instanciation


setDateMin

public void setDateMin(java.util.Date dateMin)
Setter for property dateMin.


setDateMax

public void setDateMax(java.util.Date dateMax)
Setter for property dateMax.