public class LetoPeriodStructureBean extends java.lang.Object implements LetoPeriodStructure
Constructor and Description |
---|
LetoPeriodStructureBean(LocaleStringId translatedName,
long totalLengthInDays,
LetoPeriodStructure[] subPeriods) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
java.lang.String |
getName(java.util.Locale locale)
Return the human readable name of this structure if one is available or just return null if no specific name
is defined.
|
java.util.Map<java.util.Locale,java.lang.String> |
getNameTranslations() |
LetoPeriodType |
getPeriodType()
Return a reference to the abstract period type, this strucutre describes.
|
LetoPeriodStructure[] |
getSubPeriods()
Return sub-periods information for the given structure of the period type.
|
long |
getTotalLengthInDays()
Total length in days of the period type.
|
long |
getTotalLengthInPeriodTypes(LetoPeriodType periodType)
This will return how many period types are contained in this type structure.
|
void |
setPeriodType(LetoPeriodType period)
Once the period is set (to something different than null) either by the constructor or the setPeriodType method,
it can no longer be reset to any value.
|
void |
setSubPeriods(LetoPeriodStructure[] subPeriods) |
void |
setTotalLengthInDays(long lengthInDays) |
void |
setTotalLengthInPeriodTypes(java.util.Map<LetoPeriodType,java.lang.Long> lengthsInPeriodTypes) |
java.lang.String |
toString() |
public LetoPeriodStructureBean(LocaleStringId translatedName, long totalLengthInDays, LetoPeriodStructure[] subPeriods)
public LetoPeriodType getPeriodType()
LetoPeriodStructure
getPeriodType
in interface LetoPeriodStructure
public void setPeriodType(LetoPeriodType period) throws LetoExceptionUnrecoverable
LetoPeriodStructure
setPeriodType
in interface LetoPeriodStructure
period
- The period type that has to be set to this strucutre.LetoExceptionUnrecoverable
- If the period type of this strucutre is already set.public void setSubPeriods(LetoPeriodStructure[] subPeriods)
public LetoPeriodStructure[] getSubPeriods()
LetoPeriodStructure
getTotalLengthInDays()
365 and the method
getSubPeriods()
will return the actual separation of this non-leap year into 12 months.
The result will be an array of 12 elements - an element for each month. Each of this 12 elements will
refer to the subtype "month".getSubPeriods
in interface LetoPeriodStructure
public void setTotalLengthInDays(long lengthInDays)
public void setTotalLengthInPeriodTypes(java.util.Map<LetoPeriodType,java.lang.Long> lengthsInPeriodTypes)
public long getTotalLengthInDays()
LetoPeriodStructure
getTotalLengthInDays
in interface LetoPeriodStructure
public long getTotalLengthInPeriodTypes(LetoPeriodType periodType)
LetoPeriodStructure
getTotalLengthInPeriodTypes
in interface LetoPeriodStructure
periodType
- We need to return how many periods of this type are available in this period structure.
For example if the type structure is a leap year and the period type is day, then it would return how
many days are inside a leap year. In that example - 366.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
getName
in interface LetoPeriodStructure
public java.lang.String getName(java.util.Locale locale)
LetoPeriodStructure
getName
in interface LetoPeriodStructure
locale
- The locale to be used to return the name of the structure. For example if locale is
java.util.Locale ENGLISH, then the implementation might output "January",
while if the Locale is Bulgarian, then it might output "Yanuary" or "Януари".
If the locale parameter is null, then the implementation should output some default value.public java.util.Map<java.util.Locale,java.lang.String> getNameTranslations()
getNameTranslations
in interface LetoPeriodStructure