com.ihr.xbrl.om.instance
Class XBRLPeriod

java.lang.Object
  extended by com.ihr.xbrl.om.XMLFragment
      extended by com.ihr.xbrl.om.instance.XBRLPeriod
All Implemented Interfaces:
XBRLRelationshipPoint, XMLHasParent, java.lang.Cloneable, javax.xml.namespace.NamespaceContext

public class XBRLPeriod
extends XMLFragment
implements java.lang.Cloneable

A period information according to the content of the context container in the XBRL 2.1 specification.

Author:
Ignacio

Field Summary
static int DATE_END
          Constant to refer to the END date or datetime of this period
static int DATE_INSTANT
          Constant to refer to the INSTANT date or datetime of this period
static int DATE_START
          Constant to refer to the START date or datetime of this period
static javax.xml.namespace.QName periodNode
          Constant xbrli:period used during serialization of periods
static com.ihr.xbrl.om.instance.XBRLPeriod.TimeSorter TimeSorterInstance
           
 
Fields inherited from class com.ihr.xbrl.om.XMLFragment
CONCEPT_LABEL, CONCEPT_QNAME, EMPTYRELATIONSHIPSITERATORINSTANCE, EMPTYXMLFRAGMENTITERATORINSTANCE, FACT_CONCEPT_DATATYPE, FACT_CONCEPT_LABEL, FACT_QNAME, idQName, NO_POSITION, OrderComparator, PERIOD_TYPE, PERIOD_VALUE, SHORT_TEXT, SOURCE_DOCUMENT, XPATH, XPOINTER
 
Constructor Summary
XBRLPeriod(DTSContainer dts)
          Creates a FOREVER period
XBRLPeriod(DTSContainer dts, java.util.GregorianCalendar instant, boolean bHasTimeZone, boolean bHasTime)
          Creates a INSTANT period with the instant date The date value will be set to the Gregorian Calender used in the parameter
XBRLPeriod(DTSContainer dts, java.util.GregorianCalendar start, java.util.GregorianCalendar end, boolean bHasTimeZone, boolean bHasTime)
           
XBRLPeriod(DTSContainer dts, java.lang.String instantDate)
          Creates a INSTANT period with the instantDate Note: As dates are in ISO 8601 format, the date representation "2007-08-31" is assumed to be in the NO_TIMEZONE time zone.
XBRLPeriod(DTSContainer dts, java.lang.String startDate, java.lang.String endDate)
          Creates a DURATION period with the startDate and endDate Note: As dates are in ISO 8601 format, the date representation "2007-08-31" is assumed to be in the NO_TIMEZONE time zone.
XBRLPeriod(DTSContainer dts, net.sf.saxon.s9api.XdmNode node)
          Creates a XBRLPeriod reading the content of the XdmNode node supplied as a parameter
XBRLPeriod(XBRLPeriod other)
          Creates an new period as a copy of the current period.
 
Method Summary
static java.util.GregorianCalendar adjust24h(java.util.GregorianCalendar calendar, boolean sign)
           
 void clear()
          Frees-up used memory This method should not be invoqued on live objects in the DTS.
 XBRLPeriod clone()
           
 XBRLPeriod clone(DTSContainer newDTS)
           
 boolean equals(java.lang.Object other)
          Sets a new XPathFunctionResolver for this object
 org.jdom.Element generateNode(boolean relativize, java.net.URI base)
          Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
 java.util.GregorianCalendar getComparableDate()
           
 java.lang.String getDate(int type)
          String representation of the date in the period. adjusted according to XBRL specification rules.
 java.util.Iterator<XMLFragment> getElements()
          For complex type resources this returns an iterator with all children XML fragments Tthis method may be overwriten by other classes in the hierarchy
 java.lang.String getFriendlyName()
          Returns a string description that represents the element content in a form that users can understand.
 java.lang.String getFriendlyName(int modifiers, LabelsProvider lp)
          Returns a string description that represents the element content in a form that users can understand.
 java.util.GregorianCalendar getGregorianCalendarDate(int type)
          Returns the value of the date for the type requested.
 java.lang.String getLocalizedPeriodType()
          Returns a localized string representing the period type. this is, in English "instant" or "duration".
static java.lang.String getLocalizedPeriodType(XBRLItem.PeriodType periodType)
          Returns a localized string representing the period type. this is, in English "instant" or "duration".
 XBRLItem.PeriodType getPeriodType()
          Returns XBRLItem.DURATION or XBRLItem.INSTANT depending on the context period information.
 java.lang.String getRawDate(int type)
          String representation of the date in the period.
 java.util.Date getRawDateUtil(int code)
          Returns the raw date (the one specified by syntax) in the context.
 java.util.GregorianCalendar getRawGregorianCalendarDate(int type)
          Returns the value of the date for the type requested.
 int hashCode()
           
 boolean isDuration()
           
 boolean isForever()
           
 boolean isInstant()
           
static java.lang.String iso8601(java.util.GregorianCalendar c, boolean hasTimezone, boolean hasTime)
          Returns a string representation in iso8601 standard with the value of variable c yyyy-MM-dd'T'HH:mm:ss.SSSZ is the complete patters that can be used some parts of this pattern can be omited according to the values of hasTimezone and hasTime below.
static java.util.GregorianCalendar iso8601(java.lang.String value, boolean bAdd24h)
          Converts a string of the format yyyy-MM-dd to the apropriate GregorianCalendar object.
 boolean s_equal2(java.lang.Object other)
          Resolves s_equal2 comparison of this node against the other node.
 void setDate(int type, java.lang.String strDate)
          Sets the value of the specified field
 java.lang.String toString()
          Returns the XML representation of this object as an String
 XBRLValidationReport validate()
          Produces a XBRLValidationReport object for this period object.
 
Methods inherited from class com.ihr.xbrl.om.XMLFragment
addAttribute, addChild, addFromRelationship, addNamespace, addNamespace, addToRelationship, addXMLChild, changeBase, checkBase, delAttribute, delAttribute, equalXdmValues, evaluateBoolean, evaluateList, evaluateNode, evaluateNumber, evaluateString, generateId, generateNodeNamespacesAndAttributes, generateNodeValue, generatePrefix, getAttribute, getAttributeQNameValue, getAttributes, getAttributes, getAttributeStringValue, getAttributeValue, getBase, getBase, getBaseURI, getBooleanValue, getChild, getContainer, getContainerDocumentURI, getDeclaredNamespaces, getDocument, getFragment, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getId, getLang, getNamespaceURI, getNodeName, getNumberOfElements, getNumberOfFromRelationships, getNumberOfToRelationships, getOrGenerateId, getParent, getPrefix, getPrefixes, getQNameValue, getRelationshipsBases, getRelationshipsChain, getRelationshipTypes, getStaticNamespace, getStringValue, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getValue, getXPathNamespaceContext, getXPathToNode, getXPathToRoot, getXPointerElementScheme, getXPointerElementScheme, getXPointerShorthandScheme, getXPointerToNode, isDead, isNamespaceDefined, objEquals, objHashCode, qNameToString, removeAttribute, removeChild, removeChild, removeFromRelationship, removeToRelationship, removeXMLChild, resetElements, resetHash, resolveHRef, resolveHRef, s_equal2, setAttributes, setBase, setDocument, setDocumentAndReload, setElements, setId, setLang, setNamespaceContext, setNamespaces, setNode, setNodeName, setParent, setValue, setValue, setVariablesDefined, valueEquals, xEqual
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TimeSorterInstance

public static com.ihr.xbrl.om.instance.XBRLPeriod.TimeSorter TimeSorterInstance

periodNode

public static final javax.xml.namespace.QName periodNode
Constant xbrli:period used during serialization of periods


DATE_INSTANT

public static final int DATE_INSTANT
Constant to refer to the INSTANT date or datetime of this period

See Also:
Constant Field Values

DATE_START

public static final int DATE_START
Constant to refer to the START date or datetime of this period

See Also:
Constant Field Values

DATE_END

public static final int DATE_END
Constant to refer to the END date or datetime of this period

See Also:
Constant Field Values
Constructor Detail

XBRLPeriod

public XBRLPeriod(DTSContainer dts,
                  net.sf.saxon.s9api.XdmNode node)
Creates a XBRLPeriod reading the content of the XdmNode node supplied as a parameter

Parameters:
dts - DTSContainer for this new period
node - XdmNode XML node s9api where data will be read from

XBRLPeriod

public XBRLPeriod(DTSContainer dts)
Creates a FOREVER period

Parameters:
dts - DTSContainer

XBRLPeriod

public XBRLPeriod(DTSContainer dts,
                  java.lang.String startDate,
                  java.lang.String endDate)
Creates a DURATION period with the startDate and endDate Note: As dates are in ISO 8601 format, the date representation "2007-08-31" is assumed to be in the NO_TIMEZONE time zone. If you don't want this, you may specify a date in the format 2007-08-31+0100 or 2007-08-31T01:00:00.000+0000

Parameters:
dts - - DTSContainer
startDate - - Date string in ISO 8601 format
endDate - - Date string in ISO 8601 format

XBRLPeriod

public XBRLPeriod(DTSContainer dts,
                  java.lang.String instantDate)
Creates a INSTANT period with the instantDate Note: As dates are in ISO 8601 format, the date representation "2007-08-31" is assumed to be in the NO_TIMEZONE time zone. If you don't want this, you may specify a date in the format 2007-08-31+01:00 or 2007-08-31T01:00:00.000+00:00

Parameters:
dts - - DTSContainer
instantDate - - Date string in ISO 8601 format

XBRLPeriod

public XBRLPeriod(DTSContainer dts,
                  java.util.GregorianCalendar instant,
                  boolean bHasTimeZone,
                  boolean bHasTime)
Creates a INSTANT period with the instant date The date value will be set to the Gregorian Calender used in the parameter

Parameters:
dts - - DTSContainer
instant - - Gregorian Calendar

XBRLPeriod

public XBRLPeriod(DTSContainer dts,
                  java.util.GregorianCalendar start,
                  java.util.GregorianCalendar end,
                  boolean bHasTimeZone,
                  boolean bHasTime)

XBRLPeriod

public XBRLPeriod(XBRLPeriod other)
Creates an new period as a copy of the current period. This is the constructor used by clone() method but make public for convenience

Parameters:
other - XBRLPeriod
Method Detail

getComparableDate

public java.util.GregorianCalendar getComparableDate()
Returns:

clear

public void clear()
           throws java.lang.Throwable
Description copied from class: XMLFragment
Frees-up used memory

This method should not be invoqued on live objects in the DTS. It is automatically invoqued by the API when an object is no longer used and referenced by other objects. It is save not to call it directly.

Overrides:
clear in class XMLFragment
Throws:
java.lang.Throwable

clone

public XBRLPeriod clone()
Overrides:
clone in class XMLFragment

clone

public XBRLPeriod clone(DTSContainer newDTS)
Overrides:
clone in class XMLFragment

getPeriodType

public XBRLItem.PeriodType getPeriodType()
Returns XBRLItem.DURATION or XBRLItem.INSTANT depending on the context period information. Forever periods are considered DURATION.

Returns:
XBRLItem.PeriodType

getFriendlyName

public java.lang.String getFriendlyName()
Description copied from class: XMLFragment
Returns a string description that represents the element content in a form that users can understand. This method may be overridden by parent classes.

Remarks, this method may return very long names not suitable for user interface

Overrides:
getFriendlyName in class XMLFragment
Returns:
Non empty String. Internationalization is enabled

getFriendlyName

public java.lang.String getFriendlyName(int modifiers,
                                        LabelsProvider lp)
Description copied from class: XMLFragment
Returns a string description that represents the element content in a form that users can understand. This method may be override by parent classes.

This function accepts flags that are defined as constants in XMLFragment in order to modify the output.

Overrides:
getFriendlyName in class XMLFragment
Parameters:
modifiers - integer
Returns:
Non empty String. Internationalization is enabled

isInstant

public boolean isInstant()
Returns:
true if this period is of the XBRL instant type

isDuration

public boolean isDuration()
Returns:
true if this period is of the XBRL duration type. Forever periods are duration

isForever

public boolean isForever()
Returns:
true if this period is forever

getDate

public java.lang.String getDate(int type)
String representation of the date in the period. adjusted according to XBRL specification rules. That is, adding 24 hours to period end and instant dates and keeping the date on period start dates.

Parameters:
type - code indicating what to obtain. DATE_INSTANT, DATE_START or DATE_END
Returns:
String

getRawDate

public java.lang.String getRawDate(int type)
String representation of the date in the period. NOT adjusted according to XBRL specification rules. That is, not adding 24 hours to any date

Parameters:
type - code indicating what to obtain. DATE_INSTANT, DATE_START or DATE_END
Returns:
String

getGregorianCalendarDate

public java.util.GregorianCalendar getGregorianCalendarDate(int type)
Returns the value of the date for the type requested. returned values are adjusted according to XBRL specification rules Valid types are: XBRLPeriod.DATE_END XBRLPeriod.DATE_START XBRLPeriod.DATE_INSTANT

Parameters:
type - one of the constants below
Returns:
a GregorianCalendar

getRawGregorianCalendarDate

public java.util.GregorianCalendar getRawGregorianCalendarDate(int type)
Returns the value of the date for the type requested. NOT adjusted to XBRL interpretation. returned values are NOT adjusted according to XBRL specification rules Valid types are: XBRLPeriod.DATE_END XBRLPeriod.DATE_START XBRLPeriod.DATE_INSTANT

Parameters:
type - one of the constants below
Returns:
a GregorianCalendar

adjust24h

public static java.util.GregorianCalendar adjust24h(java.util.GregorianCalendar calendar,
                                                    boolean sign)
Parameters:
calendar -
sign - boolean (true) to add 24 hours (false) to substract 24 hours
Returns:
a new GregorianCalendar object. The original object is not modified

validate

public XBRLValidationReport validate()
Produces a XBRLValidationReport object for this period object.

Returns:
XBRLValidationReport

equals

public boolean equals(java.lang.Object other)
Description copied from class: XMLFragment
Sets a new XPathFunctionResolver for this object

Overrides:
equals in class XMLFragment

s_equal2

public boolean s_equal2(java.lang.Object other)
Description copied from class: XMLFragment
Resolves s_equal2 comparison of this node against the other node.

Overrides:
s_equal2 in class XMLFragment
Parameters:
other - The other node (preferably an XMLFragment) that contains a non null NodeInfo document.
Returns:
boolean

hashCode

public int hashCode()
Overrides:
hashCode in class XMLFragment

generateNode

public org.jdom.Element generateNode(boolean relativize,
                                     java.net.URI base)
                              throws XBRLSerializationException
Description copied from class: XMLFragment
Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class

Overrides:
generateNode in class XMLFragment
Parameters:
relativize - boolean indicating if URIs should be relativized to the base URI (see next argument)
base - the URI to which some attributes of this object should be relativided
Returns:
a clone of the surrounding jdom Element so it can be incorporated into multiple trees
Throws:
XBRLSerializationException

iso8601

public static java.lang.String iso8601(java.util.GregorianCalendar c,
                                       boolean hasTimezone,
                                       boolean hasTime)
Returns a string representation in iso8601 standard with the value of variable c yyyy-MM-dd'T'HH:mm:ss.SSSZ is the complete patters that can be used some parts of this pattern can be omited according to the values of hasTimezone and hasTime below. By default only yyy-MM-dd is used. if hasTime is true, then 'T'HH:mm:ss.SSS" is added if hasTimezone is true, then Z is added

Parameters:
c - GregorianCalendar
hasTimezone - boolean value, true means c has time zone information
hasTime - boolean value, true means c has time information
Returns:
String

iso8601

public static java.util.GregorianCalendar iso8601(java.lang.String value,
                                                  boolean bAdd24h)
Converts a string of the format yyyy-MM-dd to the apropriate GregorianCalendar object. Returns null if there are errors in the string

Parameters:
value - string in the format yyyy-MM-dd
bAdd24h - for period end dates this must be set to true
Returns:
GregorianCalendar

setDate

public void setDate(int type,
                    java.lang.String strDate)
             throws XBRLValidationException
Sets the value of the specified field

Parameters:
type - this is the field, DATE_END, DATE_INSTANT, DATE_START
strDate - iso8601 date string
Throws:
XBRLValidationException

getRawDateUtil

public java.util.Date getRawDateUtil(int code)
Returns the raw date (the one specified by syntax) in the context. "raw" means no +1PD will be assumed for instance dates or endDate dates The return value is a Date in this case.

Parameters:
code - this is the field, DATE_END, DATE_INSTANT, DATE_START
Returns:
a java.util.Date

toString

public java.lang.String toString()
Description copied from class: XMLFragment
Returns the XML representation of this object as an String

Overrides:
toString in class XMLFragment

getElements

public java.util.Iterator<XMLFragment> getElements()
Description copied from class: XMLFragment
For complex type resources this returns an iterator with all children XML fragments Tthis method may be overwriten by other classes in the hierarchy

Overrides:
getElements in class XMLFragment
Returns:
Iterator

getLocalizedPeriodType

public java.lang.String getLocalizedPeriodType()
Returns a localized string representing the period type. this is, in English "instant" or "duration". Forever contexts are returned as duration.

Returns:
localized string

getLocalizedPeriodType

public static java.lang.String getLocalizedPeriodType(XBRLItem.PeriodType periodType)
Returns a localized string representing the period type. this is, in English "instant" or "duration". Forever contexts are returned as duration.

Parameters:
periodType - constant indicating XBRLItem.INSTANT or XBRLItem.DURATION
Returns:
localized string


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