com.ihr.xbrl.dts
Class ColumnPeriod

java.lang.Object
  extended by com.ihr.xbrl.dts.ColumnPeriod

public class ColumnPeriod
extends java.lang.Object

This is a class representing a logical reporting period. Logical reporting period includes a start position and an end position.

The difference with an XBRLPeriod is that the interpretation of the reporting date for instant data. Instant data belongs to a period that may not match with the data in the XBRLPeriod context.

A ColumnPeriod does not contains contexts associated. Contexts are associated to FactColumns. There is a one to one relationship between a ColumnPeriod and a Factcolumns object.

Author:
Ignacio

Nested Class Summary
static class ColumnPeriod.ColumnPeriodDurationComparator
           
static class ColumnPeriod.ColumnPeriodEndComparator
           
static class ColumnPeriod.ColumnPeriodStartComparator
           
 
Field Summary
static ColumnPeriod.ColumnPeriodDurationComparator COLUMN_PERIOD_DURATION_COMPARATOR
           
static ColumnPeriod.ColumnPeriodEndComparator COLUMN_PERIOD_END_COMPARATOR
           
static ColumnPeriod.ColumnPeriodStartComparator COLUMN_PERIOD_START_COMPARATOR
           
 
Constructor Summary
ColumnPeriod(HasBoySupport boyManager, ColumnPeriod period, int dateStep)
          Creates a new ColumnPeriod that starts at the same date as the column period in the parameter but extends to the end of the dateStep in the second parameter
ColumnPeriod(HasBoySupport boyManager, java.util.GregorianCalendar pStart, java.util.GregorianCalendar pEnd)
          Creates a non standard column period with two dates.
ColumnPeriod(HasBoySupport boyManager, java.util.GregorianCalendar pStart, int dateStep)
           
ColumnPeriod(HasBoySupport hb, XBRLPeriod p)
           
ColumnPeriod(HasBoySupport boyManager, XBRLPeriod p, int dateStep, HandleDateStep.InstantMode instantMode)
          Creates a column period using an XBRLPeriod, as source.
 
Method Summary
 boolean containsDate(java.util.GregorianCalendar date)
           
 boolean containsExcl(XBRLPeriod p)
          Calculates whether or not this ColumnPeriod contains the Period passed as a parameter.
 boolean containsIncl(XBRLPeriod p)
          Calculates whether or not this ColumnPeriod contains the Period passed as a parameter.
 boolean equals(java.lang.Object obj)
           
 int getBestFitDateStep()
          Calculates the best fit date step for this column period
static int getBestFitDateStep(XBRLPeriod period, int instantValue)
          Returns the value of the dateStep that better suites the value of the period indicated as a parameter.
static int getBestFitDateStepOfTwoDates(java.util.GregorianCalendar start, java.util.GregorianCalendar end)
           
 javax.xml.datatype.Duration getDuration()
          Returns a Duration object representing the total length of this column
 java.util.GregorianCalendar getEnd()
           
 java.util.GregorianCalendar getStart()
           
 java.lang.String getStringColumnPeriod(int dateStep)
           
static java.lang.String getStringRepresentationOfDuration(javax.xml.datatype.Duration d, int dateStep)
          Returns a string representation of the duration object in the units indicated in the dateStep parameter.
 int hashCode()
           
 boolean isForever()
           
 java.util.GregorianCalendar normalizeDate(java.util.GregorianCalendar inDate)
          Normalizes a date without paying attention to the date step.
 java.util.GregorianCalendar normalizeEnd(java.util.GregorianCalendar date, int dateStep)
          Prepare a new GregorianCalendar that corresponds to the end date of period according to the value of the dateStep
 java.util.GregorianCalendar normalizeStart(java.util.GregorianCalendar date, int dateStep)
          Prepare a new GregorianCalendar that corresponds to the beginning date of period according to the value of the dateStep
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COLUMN_PERIOD_START_COMPARATOR

public static final ColumnPeriod.ColumnPeriodStartComparator COLUMN_PERIOD_START_COMPARATOR

COLUMN_PERIOD_END_COMPARATOR

public static final ColumnPeriod.ColumnPeriodEndComparator COLUMN_PERIOD_END_COMPARATOR

COLUMN_PERIOD_DURATION_COMPARATOR

public static final ColumnPeriod.ColumnPeriodDurationComparator COLUMN_PERIOD_DURATION_COMPARATOR
Constructor Detail

ColumnPeriod

public ColumnPeriod(HasBoySupport boyManager,
                    java.util.GregorianCalendar pStart,
                    int dateStep)

ColumnPeriod

public ColumnPeriod(HasBoySupport boyManager,
                    XBRLPeriod p,
                    int dateStep,
                    HandleDateStep.InstantMode instantMode)
Creates a column period using an XBRLPeriod, as source. If the period is forever, a "forever" column is created. If the column is duration, the context start date is used after normalization and the value of the dateStep is used during the normalization phase.

Parameters:
boyManager - provides information about the month calendar a fiscal year begins.
p - XBRLPeriod
dateStep - constant indicating the period length.
instantMode - for instant values this is the matching strategy with duration contexts.

ColumnPeriod

public ColumnPeriod(HasBoySupport hb,
                    XBRLPeriod p)
Parameters:
hb -
p -

ColumnPeriod

public ColumnPeriod(HasBoySupport boyManager,
                    java.util.GregorianCalendar pStart,
                    java.util.GregorianCalendar pEnd)
Creates a non standard column period with two dates. If two dates are null, the column period will be forever.

Parameters:
boyManager -
pStart - Initial date for the column period
pEnd - End date for the column period

ColumnPeriod

public ColumnPeriod(HasBoySupport boyManager,
                    ColumnPeriod period,
                    int dateStep)
Creates a new ColumnPeriod that starts at the same date as the column period in the parameter but extends to the end of the dateStep in the second parameter

Parameters:
period -
dateStep -
Method Detail

normalizeStart

public java.util.GregorianCalendar normalizeStart(java.util.GregorianCalendar date,
                                                  int dateStep)
Prepare a new GregorianCalendar that corresponds to the beginning date of period according to the value of the dateStep

Parameters:
date -
dateStep -
Returns:
GregorianCalendar

normalizeEnd

public java.util.GregorianCalendar normalizeEnd(java.util.GregorianCalendar date,
                                                int dateStep)
Prepare a new GregorianCalendar that corresponds to the end date of period according to the value of the dateStep

Parameters:
date -
dateStep -
Returns:
GregorianCalendar

getStart

public java.util.GregorianCalendar getStart()

getEnd

public java.util.GregorianCalendar getEnd()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getStringColumnPeriod

public java.lang.String getStringColumnPeriod(int dateStep)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isForever

public boolean isForever()
Returns:
boolean

containsExcl

public boolean containsExcl(XBRLPeriod p)
Calculates whether or not this ColumnPeriod contains the Period passed as a parameter.

true if the period is instant and the instant date is inside the boundaries of the column period or the period is duration and both dates are inside the boundaries of the column period AND the period is not in the boundaries of none of the column periods inside this column period (This is the meaning of the Excl suffix to this method).

Parameters:
p - a period
Returns:
boolean value
See Also:
containsIncl(XBRLPeriod)

containsIncl

public boolean containsIncl(XBRLPeriod p)
Calculates whether or not this ColumnPeriod contains the Period passed as a parameter.

true if the period is instant and the instant date is inside the boundaries of the column period or the period is duration and both dates are inside the boundaries of the column period.

Parameters:
p - a period
Returns:
boolean value
See Also:
containsExcl(XBRLPeriod)

containsDate

public boolean containsDate(java.util.GregorianCalendar date)
Parameters:
end -
Returns:

getBestFitDateStep

public int getBestFitDateStep()
Calculates the best fit date step for this column period

Returns:
int constant defined in InstanceExplorer class

getBestFitDateStep

public static int getBestFitDateStep(XBRLPeriod period,
                                     int instantValue)
Returns the value of the dateStep that better suites the value of the period indicated as a parameter.

If the period is instant, the instantValue is returned. If the context is duration, then, depending on the duration length a value is returned.
If the value is 1 year then the value InstanceExplorer.YEARS is returned.
If the value is below 1 year and over 6 months then InstanceExplorer.HALVES is returned.
If the value is greater than a year the value -1 is returned (an error).
If the value is between 6 months and 3 months InstanceExplorer.QUARTERS is returned.
If the value is between 3 months and 1 months InstanceExplorer.QUARTERS is returned.
...

Parameters:
period - the XBRLPeriod to calculate the best fit duration
instantValue - the return value in case the period parameter is of instant type.
Returns:
int constant defined in InstanceExplorer class

getBestFitDateStepOfTwoDates

public static int getBestFitDateStepOfTwoDates(java.util.GregorianCalendar start,
                                               java.util.GregorianCalendar end)

getDuration

public javax.xml.datatype.Duration getDuration()
Returns a Duration object representing the total length of this column

Returns:
Duration

getStringRepresentationOfDuration

public static java.lang.String getStringRepresentationOfDuration(javax.xml.datatype.Duration d,
                                                                 int dateStep)
                                                          throws NotRepresentableDurationException
Returns a string representation of the duration object in the units indicated in the dateStep parameter.

Parameters:
d - a javax.xml.datatype.Duration instance
dateStep - the units that the parameter d has to be divided to and for which a string representation will be created
Returns:
string
Throws:
NotRepresentableDurationException - in case of problems

normalizeDate

public java.util.GregorianCalendar normalizeDate(java.util.GregorianCalendar inDate)
Normalizes a date without paying attention to the date step. This will create a new Gregorian calendar in the local time zone, then the fields related to the year,month,day will be set. Time will be set to 00:00:00

Parameters:
gregorianCalendarDate -
Returns:


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa