com.ihr.xbrl.dts

## Class ColumnPeriod

- java.lang.Object
- - 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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ColumnPeriod.ColumnPeriodDurationComparator` The Class ColumnPeriodDurationComparator.
    `static class` | `ColumnPeriod.ColumnPeriodEndComparator` The Class ColumnPeriodEndComparator.
    `static class` | `ColumnPeriod.ColumnPeriodStartComparator` The Class ColumnPeriodStartComparator.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ColumnPeriod.ColumnPeriodDurationComparator` | `COLUMN_PERIOD_DURATION_COMPARATOR` The Constant COLUMN_PERIOD_DURATION_COMPARATOR.
    `static ColumnPeriod.ColumnPeriodEndComparator` | `COLUMN_PERIOD_END_COMPARATOR` The Constant COLUMN_PERIOD_END_COMPARATOR.
    `static ColumnPeriod.ColumnPeriodStartComparator` | `COLUMN_PERIOD_START_COMPARATOR` The Constant COLUMN_PERIOD_START_COMPARATOR.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `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)` Instantiates a new column period.
    `ColumnPeriod(HasBoySupport hb, XBRLPeriod p)` Instantiates a new column period.
    `ColumnPeriod(HasBoySupport boyManager, XBRLPeriod p, int dateStep, HandleDateStep.InstantMode instantMode)` Creates a column period using an XBRLPeriod, as source.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsDate(java.util.GregorianCalendar date)` Contains 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)` Gets the best fit date step of two dates.
    `HasBoySupport` | `getBoySupport()` Gets the boy support.
    `javax.xml.datatype.Duration` | `getDuration()` Returns a Duration object representing the total length of this column.
    `java.util.GregorianCalendar` | `getEnd()` Gets the end.
    `java.util.GregorianCalendar` | `getStart()` Gets the start.
    `java.lang.String` | `getStringColumnPeriod()` Gets the string column period.
    `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` | `isDuration()` Checks if is duration.
    `boolean` | `isEnd(java.util.GregorianCalendar date)` Checks if is end.
    `boolean` | `isEnd(XBRLPeriod p)` Checks if is end.
    `boolean` | `isForever()` Checks if is forever.
    `boolean` | `isInstant()` If the ColumnPeriod is for the same start and end date, then it is an instant column period.
    `boolean` | `isStart(java.util.GregorianCalendar date)` Checks if is start.
    `boolean` | `isStart(XBRLPeriod p)` Checks if is start.
    `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.
    `XBRLPeriod` | `toPeriod(DTSContainer dts)` Transforms back this column period into an XBRLPeriod.
    `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

      The Constant COLUMN_PERIOD_START_COMPARATOR.

    - #### COLUMN_PERIOD_END_COMPARATOR

          public static final ColumnPeriod.ColumnPeriodEndComparator COLUMN_PERIOD_END_COMPARATOR

      The Constant COLUMN_PERIOD_END_COMPARATOR.

    - #### COLUMN_PERIOD_DURATION_COMPARATOR

          public static final ColumnPeriod.ColumnPeriodDurationComparator COLUMN_PERIOD_DURATION_COMPARATOR

      The Constant COLUMN_PERIOD_DURATION_COMPARATOR.

  - ### Constructor Detail

    - #### ColumnPeriod

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

      Instantiates a new column period.
      Parameters:
        `boyManager` - the boy manager
        `pStart` - the start
        `dateStep` - the date step

    - #### 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)

      Instantiates a new column period.
      Parameters:
        `hb` - the hb
        `p` - the 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` - the boy manager
        `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:
        `boyManager` - the boy manager
        `period` - the period
        `dateStep` - the date step

  - ### Method Detail

    - #### toPeriod

          public XBRLPeriod toPeriod(DTSContainer dts)

      Transforms back this column period into an XBRLPeriod. Requires a DTSContainer in the dts parameter
      Parameters:
        `dts` - the dts
      Returns:
        the XBRL period

    - #### 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` - the date
        `dateStep` - the date step
      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` - the date
        `dateStep` - the date step
      Returns:
        GregorianCalendar

    - #### getStart

          public java.util.GregorianCalendar getStart()

      Gets the start.
      Returns:
        the start

    - #### getEnd

          public java.util.GregorianCalendar getEnd()

      Gets the end.
      Returns:
        the end

    - #### getBoySupport

          public HasBoySupport getBoySupport()

      Gets the boy support.
      Returns:
        the boy support

    - #### isEnd

          public boolean isEnd(java.util.GregorianCalendar date)

      Checks if is end.
      Parameters:
        `date` - the date
      Returns:
        true, if is end

    - #### isEnd

          public boolean isEnd(XBRLPeriod p)

      Checks if is end.
      Parameters:
        `p` - the p
      Returns:
        true, if is end

    - #### isStart

          public boolean isStart(XBRLPeriod p)

      Checks if is start.
      Parameters:
        `p` - the p
      Returns:
        true, if is start

    - #### isInstant

          public boolean isInstant()

      If the ColumnPeriod is for the same start and end date, then it is an instant column period.
      Returns:
        boolean value indicating this condition

    - #### isDuration

          public boolean isDuration()

      Checks if is duration.
      Returns:
        true, if is duration

    - #### isStart

          public boolean isStart(java.util.GregorianCalendar date)

      Checks if is start.
      Parameters:
        `date` - the date
      Returns:
        true, if is start

    - #### 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()

      Gets the string column period.
      Returns:
        the string column period

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### isForever

          public boolean isForever()

      Checks if is forever.
      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)

      Contains date.
      Parameters:
        `date` - the date
      Returns:
        true, if successful

    - #### 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)

      Gets the best fit date step of two dates.
      Parameters:
        `start` - the start
        `end` - the end
      Returns:
        the best fit date step of two dates

    - #### 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 GregorianCalendar in the same time zone from the inDate parameter, then the fields related to the year,month,day will be set. Time will be set to 00:00:00
      Parameters:
        `inDate` - the in date
      Returns:
        the gregorian calendar