Business Objects
Quark Platform Documentation
Version 1.7.1_0
Business Objects

org.openquark.cal.module.Cal.Data
Class CAL_BusinessCalendar.Functions

java.lang.Object
  extended by org.openquark.cal.module.Cal.Data.CAL_BusinessCalendar.Functions
Enclosing class:
CAL_BusinessCalendar

public static final class CAL_BusinessCalendar.Functions
extends Object

This inner class (Functions) contains constants and methods related to binding to CAL functions in the Cal.Data.BusinessCalendar module.


Field Summary
static QualifiedName canRollUpTimePeriod
          Name binding for function: canRollUpTimePeriod.
static QualifiedName getBasePeriod
          Name binding for function: getBasePeriod.
static QualifiedName getBasePeriodType
          Name binding for function: getBasePeriodType.
static QualifiedName getBasePeriodValue
          Name binding for function: getBasePeriodValue.
static QualifiedName getChildPeriodValues
          Name binding for function: getChildPeriodValues.
static QualifiedName getPeriodFromTime
          Name binding for function: getPeriodFromTime.
static QualifiedName getPeriodTimeRange
          Name binding for function: getPeriodTimeRange.
static QualifiedName getPeriodTypeName
          Name binding for function: getPeriodTypeName.
static QualifiedName getPeriodValue
          Name binding for function: getPeriodValue.
static QualifiedName getPeriodValueFromTime
          Name binding for function: getPeriodValueFromTime.
static QualifiedName getPeriodValueRange
          Name binding for function: getPeriodValueRange.
static QualifiedName getPeriodValues
          Name binding for function: getPeriodValues.
static QualifiedName getTimePartExpr
          Name binding for function: getTimePartExpr.
static QualifiedName getValidBasePeriodValues
          Name binding for function: getValidBasePeriodValues.
static QualifiedName getValidChildTimePeriods
          Name binding for function: getValidChildTimePeriods.
static QualifiedName getValidParentTimePeriods
          Name binding for function: getValidParentTimePeriods.
static QualifiedName intToPeriodType
          Name binding for function: intToPeriodType.
static QualifiedName makeBusinessCalendar
          Name binding for function: makeBusinessCalendar.
static QualifiedName makeChildPeriod
          Name binding for function: makeChildPeriod.
static QualifiedName makePeriod
          Name binding for function: makePeriod.
static QualifiedName periodDisplayName
          Name binding for function: periodDisplayName.
static QualifiedName periodTypeToInt
          Name binding for function: periodTypeToInt.
static QualifiedName setBasePeriodValue
          Name binding for function: setBasePeriodValue.
static QualifiedName shiftByNPeriods
          Name binding for function: shiftByNPeriods.
 
Constructor Summary
CAL_BusinessCalendar.Functions()
           
 
Method Summary
static SourceModel.Expr canRollUpTimePeriod(SourceModel.Expr childPeriod, SourceModel.Expr parentPeriod)
          Returns whether the specified child Cal.Data.BusinessCalendar.PeriodType can roll up into the parent Cal.Data.BusinessCalendar.PeriodType.
static SourceModel.Expr getBasePeriod(SourceModel.Expr period)
          Returns the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period and the corresponding value.
static SourceModel.Expr getBasePeriodType(SourceModel.Expr arg_1)
          Returns the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getBasePeriodValue(SourceModel.Expr arg_1)
          Returns the value for the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getChildPeriodValues(SourceModel.Expr businessCalendar, SourceModel.Expr parentPeriod, SourceModel.Expr periodType, SourceModel.Expr maybeMinValue, SourceModel.Expr maybeMaxValue)
          Returns the list of valid values (and the corresponding string representations) for the specified Cal.Data.BusinessCalendar.PeriodType in the given Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getPeriodFromTime(SourceModel.Expr businessCalendar, SourceModel.Expr time, SourceModel.Expr periodTypes)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to convert a time value into a Cal.Data.BusinessCalendar.Period with the specified Cal.Data.BusinessCalendar.PeriodTypes.
static SourceModel.Expr getPeriodTimeRange(SourceModel.Expr businessCalendar, SourceModel.Expr period)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the time range corresponding to the given Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getPeriodTypeName(SourceModel.Expr periodType)
          Returns a descriptive name for the Cal.Data.BusinessCalendar.PeriodType.
static SourceModel.Expr getPeriodValue(SourceModel.Expr period, SourceModel.Expr periodType)
          Returns the value of the specified Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getPeriodValueFromTime(SourceModel.Expr businessCalendar, SourceModel.Expr time, SourceModel.Expr periodType)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the value of a given Cal.Data.BusinessCalendar.PeriodType for the specified time.
static SourceModel.Expr getPeriodValueRange(SourceModel.Expr businessCalendar, SourceModel.Expr parentPeriod, SourceModel.Expr periodType)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine what range of values are possible for a specified Cal.Data.BusinessCalendar.PeriodType within a specified Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getPeriodValues(SourceModel.Expr period)
          Returns a list Cal.Data.BusinessCalendar.PeriodType-value pairs for the Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getTimePartExpr(SourceModel.Expr businessCalendar, SourceModel.Expr baseTimeExpr, SourceModel.Expr periodType)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the database expression to extract the value of the Cal.Data.BusinessCalendar.PeriodType from the specified time expression.
static SourceModel.Expr getValidBasePeriodValues(SourceModel.Expr businessCalendar, SourceModel.Expr period)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the range of possible values for the base Cal.Data.BusinessCalendar.PeriodType of a Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr getValidChildTimePeriods(SourceModel.Expr parentPeriod)
          Returns a list of the valid child Cal.Data.BusinessCalendar.PeriodType values which can roll up into the specified parent Cal.Data.BusinessCalendar.PeriodType.
static SourceModel.Expr getValidParentTimePeriods(SourceModel.Expr childPeriod)
          Returns a list of the valid parent Cal.Data.BusinessCalendar.PeriodType values into which a child Cal.Data.BusinessCalendar.PeriodType can roll up.
static SourceModel.Expr intToPeriodType(int intVal)
           
static SourceModel.Expr intToPeriodType(SourceModel.Expr intVal)
          Retrieves the Cal.Data.BusinessCalendar.PeriodType corresponding to a given ordinal.
static SourceModel.Expr makeBusinessCalendar(SourceModel.Expr periodValueRangeFn, SourceModel.Expr periodDisplayNameFn, SourceModel.Expr periodTimeRangeFn, SourceModel.Expr periodValueFromTimeFn, SourceModel.Expr timePartExprFn)
          Construct a new Cal.Data.BusinessCalendar.BusinessCalendar with the specified behavior.
static SourceModel.Expr makeChildPeriod(SourceModel.Expr parentPeriod, SourceModel.Expr childPeriodType, int childPeriodValue)
           
static SourceModel.Expr makeChildPeriod(SourceModel.Expr parentPeriod, SourceModel.Expr childPeriodType, SourceModel.Expr childPeriodValue)
          Constructs a Cal.Data.BusinessCalendar.Period from a containing Cal.Data.BusinessCalendar.Period value.
static SourceModel.Expr makePeriod(SourceModel.Expr periodValues)
          Constructs a Cal.Data.BusinessCalendar.Period from its Cal.Data.BusinessCalendar.Period values.
static SourceModel.Expr periodDisplayName(SourceModel.Expr businessCalendar, SourceModel.Expr parentPeriod, SourceModel.Expr periodType, int periodValue)
           
static SourceModel.Expr periodDisplayName(SourceModel.Expr businessCalendar, SourceModel.Expr parentPeriod, SourceModel.Expr periodType, SourceModel.Expr periodValue)
          Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the display string of a given Cal.Data.BusinessCalendar.PeriodType and value with a specified Cal.Data.BusinessCalendar.Period as context.
static SourceModel.Expr periodTypeToInt(SourceModel.Expr periodType)
          Retrieves the ordinal corresponding to a given Cal.Data.BusinessCalendar.PeriodType.
static SourceModel.Expr setBasePeriodValue(SourceModel.Expr period, int newBasePeriodValue)
           
static SourceModel.Expr setBasePeriodValue(SourceModel.Expr period, SourceModel.Expr newBasePeriodValue)
          Sets the value for the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period.
static SourceModel.Expr shiftByNPeriods(SourceModel.Expr businessCalendar, SourceModel.Expr origPeriod, SourceModel.Expr periodType, int shiftAmount)
           
static SourceModel.Expr shiftByNPeriods(SourceModel.Expr businessCalendar, SourceModel.Expr origPeriod, SourceModel.Expr periodType, SourceModel.Expr shiftAmount)
          Adds an offset to the specified period type of the period.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canRollUpTimePeriod

public static final QualifiedName canRollUpTimePeriod
Name binding for function: canRollUpTimePeriod.

See Also:
canRollUpTimePeriod(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getBasePeriod

public static final QualifiedName getBasePeriod
Name binding for function: getBasePeriod.

See Also:
getBasePeriod(org.openquark.cal.compiler.SourceModel.Expr)

getBasePeriodType

public static final QualifiedName getBasePeriodType
Name binding for function: getBasePeriodType.

See Also:
getBasePeriodType(org.openquark.cal.compiler.SourceModel.Expr)

getBasePeriodValue

public static final QualifiedName getBasePeriodValue
Name binding for function: getBasePeriodValue.

See Also:
getBasePeriodValue(org.openquark.cal.compiler.SourceModel.Expr)

getChildPeriodValues

public static final QualifiedName getChildPeriodValues
Name binding for function: getChildPeriodValues.

See Also:
getChildPeriodValues(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodFromTime

public static final QualifiedName getPeriodFromTime
Name binding for function: getPeriodFromTime.

See Also:
getPeriodFromTime(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodTimeRange

public static final QualifiedName getPeriodTimeRange
Name binding for function: getPeriodTimeRange.

See Also:
getPeriodTimeRange(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodTypeName

public static final QualifiedName getPeriodTypeName
Name binding for function: getPeriodTypeName.

See Also:
getPeriodTypeName(org.openquark.cal.compiler.SourceModel.Expr)

getPeriodValue

public static final QualifiedName getPeriodValue
Name binding for function: getPeriodValue.

See Also:
getPeriodValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodValueFromTime

public static final QualifiedName getPeriodValueFromTime
Name binding for function: getPeriodValueFromTime.

See Also:
getPeriodValueFromTime(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodValueRange

public static final QualifiedName getPeriodValueRange
Name binding for function: getPeriodValueRange.

See Also:
getPeriodValueRange(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getPeriodValues

public static final QualifiedName getPeriodValues
Name binding for function: getPeriodValues.

See Also:
getPeriodValues(org.openquark.cal.compiler.SourceModel.Expr)

getTimePartExpr

public static final QualifiedName getTimePartExpr
Name binding for function: getTimePartExpr.

See Also:
getTimePartExpr(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getValidBasePeriodValues

public static final QualifiedName getValidBasePeriodValues
Name binding for function: getValidBasePeriodValues.

See Also:
getValidBasePeriodValues(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

getValidChildTimePeriods

public static final QualifiedName getValidChildTimePeriods
Name binding for function: getValidChildTimePeriods.

See Also:
getValidChildTimePeriods(org.openquark.cal.compiler.SourceModel.Expr)

getValidParentTimePeriods

public static final QualifiedName getValidParentTimePeriods
Name binding for function: getValidParentTimePeriods.

See Also:
getValidParentTimePeriods(org.openquark.cal.compiler.SourceModel.Expr)

intToPeriodType

public static final QualifiedName intToPeriodType
Name binding for function: intToPeriodType.

See Also:
intToPeriodType(org.openquark.cal.compiler.SourceModel.Expr)

makeBusinessCalendar

public static final QualifiedName makeBusinessCalendar
Name binding for function: makeBusinessCalendar.

See Also:
makeBusinessCalendar(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

makeChildPeriod

public static final QualifiedName makeChildPeriod
Name binding for function: makeChildPeriod.

See Also:
makeChildPeriod(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

makePeriod

public static final QualifiedName makePeriod
Name binding for function: makePeriod.

See Also:
makePeriod(org.openquark.cal.compiler.SourceModel.Expr)

periodDisplayName

public static final QualifiedName periodDisplayName
Name binding for function: periodDisplayName.

See Also:
periodDisplayName(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

periodTypeToInt

public static final QualifiedName periodTypeToInt
Name binding for function: periodTypeToInt.

See Also:
periodTypeToInt(org.openquark.cal.compiler.SourceModel.Expr)

setBasePeriodValue

public static final QualifiedName setBasePeriodValue
Name binding for function: setBasePeriodValue.

See Also:
setBasePeriodValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

shiftByNPeriods

public static final QualifiedName shiftByNPeriods
Name binding for function: shiftByNPeriods.

See Also:
shiftByNPeriods(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)
Constructor Detail

CAL_BusinessCalendar.Functions

public CAL_BusinessCalendar.Functions()
Method Detail

canRollUpTimePeriod

public static final SourceModel.Expr canRollUpTimePeriod(SourceModel.Expr childPeriod,
                                                         SourceModel.Expr parentPeriod)
Returns whether the specified child Cal.Data.BusinessCalendar.PeriodType can roll up into the parent Cal.Data.BusinessCalendar.PeriodType.
See Also:
Functions and Class Methods: Cal.Data.BusinessCalendar.getValidParentTimePeriods

Parameters:
childPeriod - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Core.Prelude.Boolean)

getBasePeriod

public static final SourceModel.Expr getBasePeriod(SourceModel.Expr period)
Returns the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period and the corresponding value. Cal.Data.BusinessCalendar.NoPeriod and an error are returned if there are no values in the Cal.Data.BusinessCalendar.Period.

Parameters:
period - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: (Cal.Data.BusinessCalendar.PeriodType, Cal.Core.Prelude.Int))

getBasePeriodType

public static final SourceModel.Expr getBasePeriodType(SourceModel.Expr arg_1)
Returns the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period. Cal.Data.BusinessCalendar.NoPeriod is returned if there are no values in the Cal.Data.BusinessCalendar.Period.

Parameters:
arg_1 - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: Cal.Data.BusinessCalendar.PeriodType)

getBasePeriodValue

public static final SourceModel.Expr getBasePeriodValue(SourceModel.Expr arg_1)
Returns the value for the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period. Throws an error if there are no values in the Cal.Data.BusinessCalendar.Period.

Parameters:
arg_1 - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: Cal.Core.Prelude.Int)

getChildPeriodValues

public static final SourceModel.Expr getChildPeriodValues(SourceModel.Expr businessCalendar,
                                                          SourceModel.Expr parentPeriod,
                                                          SourceModel.Expr periodType,
                                                          SourceModel.Expr maybeMinValue,
                                                          SourceModel.Expr maybeMaxValue)
Returns the list of valid values (and the corresponding string representations) for the specified Cal.Data.BusinessCalendar.PeriodType in the given Cal.Data.BusinessCalendar.Period. Optionally, endpoints may be specified to limit the range.

For example, for the Cal.Data.BusinessCalendar.DayOfWeekPeriod period type, this might return [(2, "Monday"), (4, "Wednesday"), (6, "Friday")].

For example, for the Cal.Data.BusinessCalendar.QuarterPeriod period type, this might return [(1, "Q1 98"), (2, "Q2 98"), (3, "Q3 98"), (4, "Q4 98")].

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.Period)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
maybeMinValue - (CAL type: Cal.Core.Prelude.Maybe Cal.Core.Prelude.Int)
maybeMaxValue - (CAL type: Cal.Core.Prelude.Maybe Cal.Core.Prelude.Int)
Returns:
(CAL type: [(Cal.Core.Prelude.Int, Cal.Core.Prelude.String)])

getPeriodFromTime

public static final SourceModel.Expr getPeriodFromTime(SourceModel.Expr businessCalendar,
                                                       SourceModel.Expr time,
                                                       SourceModel.Expr periodTypes)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to convert a time value into a Cal.Data.BusinessCalendar.Period with the specified Cal.Data.BusinessCalendar.PeriodTypes.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
time - (CAL type: Cal.Utilities.Time.Time)
periodTypes - (CAL type: [Cal.Data.BusinessCalendar.PeriodType])
Returns:
(CAL type: Cal.Data.BusinessCalendar.Period)

getPeriodTimeRange

public static final SourceModel.Expr getPeriodTimeRange(SourceModel.Expr businessCalendar,
                                                        SourceModel.Expr period)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the time range corresponding to the given Cal.Data.BusinessCalendar.Period. This is only possible if the Cal.Data.BusinessCalendar.YearPeriod period is included in the period. If the info cannot be determined for this period, then the range returned will not be bounded on either end.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
period - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: Cal.Utilities.Range.Range Cal.Utilities.Time.Time)

getPeriodTypeName

public static final SourceModel.Expr getPeriodTypeName(SourceModel.Expr periodType)
Returns a descriptive name for the Cal.Data.BusinessCalendar.PeriodType.

Parameters:
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Core.Prelude.String)

getPeriodValue

public static final SourceModel.Expr getPeriodValue(SourceModel.Expr period,
                                                    SourceModel.Expr periodType)
Returns the value of the specified Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period. If the Cal.Data.BusinessCalendar.Period does not include this Cal.Data.BusinessCalendar.PeriodType, then Cal.Core.Prelude.Nothing will be returned.

TODO: should this function attempt to calculate the value if it is not available? (e.g. Quarter if Year and Month are present.)

Parameters:
period - (CAL type: Cal.Data.BusinessCalendar.Period)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Core.Prelude.Maybe Cal.Core.Prelude.Int)

getPeriodValueFromTime

public static final SourceModel.Expr getPeriodValueFromTime(SourceModel.Expr businessCalendar,
                                                            SourceModel.Expr time,
                                                            SourceModel.Expr periodType)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the value of a given Cal.Data.BusinessCalendar.PeriodType for the specified time.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
time - (CAL type: Cal.Utilities.Time.Time)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Core.Prelude.Int)

getPeriodValueRange

public static final SourceModel.Expr getPeriodValueRange(SourceModel.Expr businessCalendar,
                                                         SourceModel.Expr parentPeriod,
                                                         SourceModel.Expr periodType)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine what range of values are possible for a specified Cal.Data.BusinessCalendar.PeriodType within a specified Cal.Data.BusinessCalendar.Period.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.Period)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: (Cal.Core.Prelude.Int, Cal.Core.Prelude.Int))

getPeriodValues

public static final SourceModel.Expr getPeriodValues(SourceModel.Expr period)
Returns a list Cal.Data.BusinessCalendar.PeriodType-value pairs for the Cal.Data.BusinessCalendar.Period. The pairs are in nesting order, with the outermost Cal.Data.BusinessCalendar.PeriodType at the beginning of the list.

Parameters:
period - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: [(Cal.Data.BusinessCalendar.PeriodType, Cal.Core.Prelude.Int)])

getTimePartExpr

public static final SourceModel.Expr getTimePartExpr(SourceModel.Expr businessCalendar,
                                                     SourceModel.Expr baseTimeExpr,
                                                     SourceModel.Expr periodType)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the database expression to extract the value of the Cal.Data.BusinessCalendar.PeriodType from the specified time expression.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
baseTimeExpr - (CAL type: Cal.Data.DictionaryQuery.Expr)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Data.DictionaryQuery.Expr)

getValidBasePeriodValues

public static final SourceModel.Expr getValidBasePeriodValues(SourceModel.Expr businessCalendar,
                                                              SourceModel.Expr period)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the range of possible values for the base Cal.Data.BusinessCalendar.PeriodType of a Cal.Data.BusinessCalendar.Period.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
period - (CAL type: Cal.Data.BusinessCalendar.Period)
Returns:
(CAL type: (Cal.Core.Prelude.Int, Cal.Core.Prelude.Int))

getValidChildTimePeriods

public static final SourceModel.Expr getValidChildTimePeriods(SourceModel.Expr parentPeriod)
Returns a list of the valid child Cal.Data.BusinessCalendar.PeriodType values which can roll up into the specified parent Cal.Data.BusinessCalendar.PeriodType.
See Also:
Functions and Class Methods: Cal.Data.BusinessCalendar.getValidParentTimePeriods

Parameters:
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: [Cal.Data.BusinessCalendar.PeriodType])

getValidParentTimePeriods

public static final SourceModel.Expr getValidParentTimePeriods(SourceModel.Expr childPeriod)
Returns a list of the valid parent Cal.Data.BusinessCalendar.PeriodType values into which a child Cal.Data.BusinessCalendar.PeriodType can roll up.
See Also:
Functions and Class Methods: Cal.Data.BusinessCalendar.getValidChildTimePeriods

Parameters:
childPeriod - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: [Cal.Data.BusinessCalendar.PeriodType])

intToPeriodType

public static final SourceModel.Expr intToPeriodType(SourceModel.Expr intVal)
Retrieves the Cal.Data.BusinessCalendar.PeriodType corresponding to a given ordinal.

Parameters:
intVal - (CAL type: Cal.Core.Prelude.Int)
Returns:
(CAL type: Cal.Data.BusinessCalendar.PeriodType) The corresponding Cal.Data.BusinessCalendar.PeriodType if one exists, or Cal.Data.BusinessCalendar.NoPeriod otherwise.

intToPeriodType

public static final SourceModel.Expr intToPeriodType(int intVal)
Parameters:
intVal -
Returns:
the SourceModel.Expr representing an application of intToPeriodType
See Also:
intToPeriodType(org.openquark.cal.compiler.SourceModel.Expr)

makeBusinessCalendar

public static final SourceModel.Expr makeBusinessCalendar(SourceModel.Expr periodValueRangeFn,
                                                          SourceModel.Expr periodDisplayNameFn,
                                                          SourceModel.Expr periodTimeRangeFn,
                                                          SourceModel.Expr periodValueFromTimeFn,
                                                          SourceModel.Expr timePartExprFn)
Construct a new Cal.Data.BusinessCalendar.BusinessCalendar with the specified behavior.

Parameters:
periodValueRangeFn - (CAL type: Cal.Data.BusinessCalendar.Period -> Cal.Data.BusinessCalendar.PeriodType -> (Cal.Core.Prelude.Int, Cal.Core.Prelude.Int)) a function to get the range of valid values for a specified period, given the parent period
periodDisplayNameFn - (CAL type: Cal.Data.BusinessCalendar.Period -> Cal.Data.BusinessCalendar.PeriodType -> Cal.Core.Prelude.Int -> Cal.Core.Prelude.String) a function to get the display name for a period value
periodTimeRangeFn - (CAL type: Cal.Data.BusinessCalendar.Period -> Cal.Utilities.Range.Range Cal.Utilities.Time.Time) a function to get the start and end time for for a specified period
periodValueFromTimeFn - (CAL type: Cal.Utilities.Time.Time -> Cal.Data.BusinessCalendar.PeriodType -> Cal.Core.Prelude.Int) a function to get the value of the specified period for a time value
timePartExprFn - (CAL type: Cal.Data.DictionaryQuery.Expr -> Cal.Data.BusinessCalendar.PeriodType -> Cal.Data.DictionaryQuery.Expr) a function to build a database expression to extract the appropriate time part from a time value
Returns:
(CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)

makeChildPeriod

public static final SourceModel.Expr makeChildPeriod(SourceModel.Expr parentPeriod,
                                                     SourceModel.Expr childPeriodType,
                                                     SourceModel.Expr childPeriodValue)
Constructs a Cal.Data.BusinessCalendar.Period from a containing Cal.Data.BusinessCalendar.Period value. The Cal.Data.BusinessCalendar.PeriodType is assumed to be able to nest within the innermost Cal.Data.BusinessCalendar.PeriodType of the parent.

TODO: validate period nesting (i.e. order)?

Parameters:
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.Period)
childPeriodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
childPeriodValue - (CAL type: Cal.Core.Prelude.Int)
Returns:
(CAL type: Cal.Data.BusinessCalendar.Period)

makeChildPeriod

public static final SourceModel.Expr makeChildPeriod(SourceModel.Expr parentPeriod,
                                                     SourceModel.Expr childPeriodType,
                                                     int childPeriodValue)
Parameters:
parentPeriod -
childPeriodType -
childPeriodValue -
Returns:
the SourceModel.Expr representing an application of makeChildPeriod
See Also:
makeChildPeriod(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

makePeriod

public static final SourceModel.Expr makePeriod(SourceModel.Expr periodValues)
Constructs a Cal.Data.BusinessCalendar.Period from its Cal.Data.BusinessCalendar.Period values. The pairs are assumed to be in nesting order, with the outermost Cal.Data.BusinessCalendar.PeriodType at the beginning of the list.

TODO: validate period nesting (i.e. order)?

Parameters:
periodValues - (CAL type: [(Cal.Data.BusinessCalendar.PeriodType, Cal.Core.Prelude.Int)])
Returns:
(CAL type: Cal.Data.BusinessCalendar.Period)

periodDisplayName

public static final SourceModel.Expr periodDisplayName(SourceModel.Expr businessCalendar,
                                                       SourceModel.Expr parentPeriod,
                                                       SourceModel.Expr periodType,
                                                       SourceModel.Expr periodValue)
Queries a given Cal.Data.BusinessCalendar.BusinessCalendar to determine the display string of a given Cal.Data.BusinessCalendar.PeriodType and value with a specified Cal.Data.BusinessCalendar.Period as context.

For example, depending on the Cal.Data.BusinessCalendar.BusinessCalendar, for the Cal.Data.BusinessCalendar.DayOfWeekPeriod period type, this might return "Monday". Similarly, for the Cal.Data.BusinessCalendar.QuarterPeriod period type, this might return "Q1 98".

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
parentPeriod - (CAL type: Cal.Data.BusinessCalendar.Period)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
periodValue - (CAL type: Cal.Core.Prelude.Int)
Returns:
(CAL type: Cal.Core.Prelude.String)

periodDisplayName

public static final SourceModel.Expr periodDisplayName(SourceModel.Expr businessCalendar,
                                                       SourceModel.Expr parentPeriod,
                                                       SourceModel.Expr periodType,
                                                       int periodValue)
Parameters:
businessCalendar -
parentPeriod -
periodType -
periodValue -
Returns:
the SourceModel.Expr representing an application of periodDisplayName
See Also:
periodDisplayName(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

periodTypeToInt

public static final SourceModel.Expr periodTypeToInt(SourceModel.Expr periodType)
Retrieves the ordinal corresponding to a given Cal.Data.BusinessCalendar.PeriodType.

Parameters:
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
Returns:
(CAL type: Cal.Core.Prelude.Int) The corresponding ordinal.

setBasePeriodValue

public static final SourceModel.Expr setBasePeriodValue(SourceModel.Expr period,
                                                        SourceModel.Expr newBasePeriodValue)
Sets the value for the lowest level Cal.Data.BusinessCalendar.PeriodType in the Cal.Data.BusinessCalendar.Period. Throws an error if there are no values in the Cal.Data.BusinessCalendar.Period.

Parameters:
period - (CAL type: Cal.Data.BusinessCalendar.Period)
newBasePeriodValue - (CAL type: Cal.Core.Prelude.Int)
Returns:
(CAL type: Cal.Data.BusinessCalendar.Period)

setBasePeriodValue

public static final SourceModel.Expr setBasePeriodValue(SourceModel.Expr period,
                                                        int newBasePeriodValue)
Parameters:
period -
newBasePeriodValue -
Returns:
the SourceModel.Expr representing an application of setBasePeriodValue
See Also:
setBasePeriodValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

shiftByNPeriods

public static final SourceModel.Expr shiftByNPeriods(SourceModel.Expr businessCalendar,
                                                     SourceModel.Expr origPeriod,
                                                     SourceModel.Expr periodType,
                                                     SourceModel.Expr shiftAmount)
Adds an offset to the specified period type of the period.

If this would cause the root period type in the period to go out of bounds, then an error will be thrown. For example, for the period [Month, 10] adding 5 to the Month period type would result in a month value of 15, which is not possible.

If the root period type is Year, then this error should not occur.

If not shifting the base (lowest) period type in the period, then it is possible that the lower-level values could become out of range. In this case, they will be set to the nearest in-range value. For example, adding 1 Year to [(Year 2004, Month 2(Feb), Day 29)] would give [(Year 2005, Month 2(Feb), Day 28)].

Currently, this function will only work with period types explicitly included in the period.

TODO: it would probably be nice to handle ones which can be determined from lower level ones (quarters from months, etc...)...

TODO: does this handle the case where the child values need to change depending on the parent values? For example, for Year/Month/DayOfYear, shifting the month value should update the DayOfYear value as well.

Parameters:
businessCalendar - (CAL type: Cal.Data.BusinessCalendar.BusinessCalendar)
origPeriod - (CAL type: Cal.Data.BusinessCalendar.Period)
periodType - (CAL type: Cal.Data.BusinessCalendar.PeriodType)
shiftAmount - (CAL type: Cal.Core.Prelude.Int)
Returns:
(CAL type: Cal.Data.BusinessCalendar.Period)

shiftByNPeriods

public static final SourceModel.Expr shiftByNPeriods(SourceModel.Expr businessCalendar,
                                                     SourceModel.Expr origPeriod,
                                                     SourceModel.Expr periodType,
                                                     int shiftAmount)
Parameters:
businessCalendar -
origPeriod -
periodType -
shiftAmount -
Returns:
the SourceModel.Expr representing an application of shiftByNPeriods
See Also:
shiftByNPeriods(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr)

Business Objects
Quark Platform Documentation
Version 1.7.1_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.