' ========================================================================================================================
' ==========================================� Copyright � 2009 Allen Baker �==============================================
' +------------------------------+
' File: M001_Constants
' Originator: Allen Baker (2009.10.30 18:29)
' ========================================================================================================================
'
Option Explicit
' ========================================================================================================================
' Description
' This module provides constants that are Public and therefore usable in any other module. In addition, for each
' constant, an accessor function is defined. This is because the constants cannot be referenced directly from within an
' application like Excel or Word and can only be accessed by way of a function.
' ========================================================================================================================
' ======================================================================================================================
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ Constants ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' =====================================================================================================================
'
' ==============================================================================================
' time and date related
' ----------------------------------------------------------------------------------------------
Public Const cDaysPerWeek As Double = 7#
Public Const cDaysPerYear As Double = 365.2425
Public Const cMonthsPerYear As Double = 12#
Public Const cWorkhoursPerDay As Double = 8#
Public Const cWorkdaysPerWeek As Double = 5#
Public Const cDaysPerMonth As Double = cDaysPerYear / cMonthsPerYear
Public Const cWeeksPerYear As Double = cDaysPerYear / cDaysPerWeek
Public Const cWeeksPerMonth As Double = cDaysPerMonth / cDaysPerWeek
Public Const cWorkdaysPerMonth As Double = cWorkdaysPerWeek * cWeeksPerMonth
Public Const cWorkdaysPerYear As Double = cWorkdaysPerMonth * cMonthsPerYear
Public Const cWorkhoursPerWeek As Double = cWorkhoursPerDay * cWorkdaysPerWeek
Public Const cWorkhoursPerMonth As Double = cWorkhoursPerDay * cWorkdaysPerMonth
Public Const cWorkhoursPerYear As Double = cWorkhoursPerDay * cWorkdaysPerYear
Public Const cWorkdaysPerCalendarDay As Double = cWorkdaysPerWeek / cDaysPerWeek
Public Const cCalendarDaysPerWorkday As Double = cDaysPerWeek / cWorkdaysPerWeek
'
' ==============================================================================================
' HPIT timebox related
' ----------------------------------------------------------------------------------------------
Public Const cPlanningSummaryPhasePct As Double = 0.3
Public Const cDevelopmentSummaryPhasePct As Double = 0.6
Public Const cWarrantySummaryPhasePct As Double = 0.1
'
' ==============================================================================================
' math related
' ----------------------------------------------------------------------------------------------
Public Const cOneK As Double = 1024#
Public Const cTwoK As Double = 2 * cOneK
Public Const cThreeK As Double = 3 * cOneK
Public Const cFourK As Double = 4 * cOneK
Public Const cOneMeg As Double = cOneK * cOneK
Public Const cOneGig As Double = cOneK * cOneMeg
Public Const cPhi As Double = 1.61803398874989
Public Const cE As Double = 2.71828182845905
Public Const cPi As Double = 3.14159265358979
'
' ==============================================================================================
' bitmask related
' ----------------------------------------------------------------------------------------------
Public Const cFirstByteMask As Long = &H00000000000000FF
Public Const cSecondByteMask As Long = &H000000000000FF00
Public Const cThirdByteMask As Long = &H0000000000FF0000
Public Const cFourthByteMask As Long = &H00000000FF000000
Public Const cOneHexDigitsMask As Long = &H000000000000000F
Public Const cTwoHexDigitsMask As Long = &H00000000000000FF
Public Const cThreeHexDigitsMask As Long = &H0000000000000FFF
Public Const cFourHexDigitsMask As Long = &H000000000000FFFF
Public Const cFiveHexDigitsMask As Long = &H00000000000FFFFF
Public Const cSixHexDigitsMask As Long = &H0000000000FFFFFF
Public Const cSevenHexDigitsMask As Long = &H000000000FFFFFFF
Public Const cEightHexDigitsMask As Long = &H00000000FFFFFFFF
' 1234567890123456 4 bits per hex digit * 16 digits = 64 bits = Long size
' =====================================================================================================================
' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[ Accessors ]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' =====================================================================================================================
' ===========================================================================================================
' ===========================================================================================================
' ===========================================================================================================
' These functions are the accessor functions for each constant. It is not possible to reference a VBA
' constant directly from within a cell in an Excel spreadsheet. These accessor functions can be used from
' within cells and can also be used from within other VBA modules.
'
' return
' each function returns the value of one constant. The name of the function identifies the constant.
' -----------------------------------------------------------------------------------------------------------
'
' ==============================================================================================
' time and date related
' ----------------------------------------------------------------------------------------------
Public Function daysPerWeek() As Double
daysPerWeek = cDaysPerWeek
End Function
Public Function daysPerYear() As Double
daysPerYear = cDaysPerYear
End Function
Public Function monthsPerYear() As Double
monthsPerYear = cMonthsPerYear
End Function
Public Function workdaysPerWeek() As Double
workdaysPerWeek = cWorkdaysPerWeek
End Function
Public Function daysPerMonth() As Double
daysPerMonth = cDaysPerMonth
End Function
Public Function weeksPerYear() As Double
weeksPerYear = cWeeksPerYear
End Function
Public Function weeksPerMonth() As Double
weeksPerMonth = cWeeksPerMonth
End Function
Public Function workdaysPerMonth() As Double
workdaysPerMonth = cWorkdaysPerMonth
End Function
Public Function workdaysPerYear() As Double
workdaysPerYear = cWorkdaysPerYear
End Function
Public Function workdaysPerCalendarDay() As Double
workdaysPerCalendarDay = cWorkdaysPerCalendarDay
End Function
Public Function calendarDaysPerWorkday() As Double
calendarDaysPerWorkday = cCalendarDaysPerWorkday
End Function
Public Function workhoursPerDay() As Double
workhoursPerDay = cWorkhoursPerDay
End Function
Public Function workhoursPerWeek() As Double
workhoursPerWeek = cWorkhoursPerWeek
End Function
Public Function workhoursPerMonth() As Double
workhoursPerMonth = cWorkhoursPerMonth
End Function
Public Function workhoursPerYear() As Double
workhoursPerYear = cWorkhoursPerYear
End Function
'
' ==============================================================================================
' HPIT timebox related
' ----------------------------------------------------------------------------------------------
Public Function planningSummaryPhasePct() As Double
planningSummaryPhasePct = cPlanningSummaryPhasePct
End Function
Public Function developmentSummaryPhasePct() As Double
developmentSummaryPhasePct = cDevelopmentSummaryPhasePct
End Function
Public Function warrantySummaryPhasePct() As Double
warrantySummaryPhasePct = cWarrantySummaryPhasePct
End Function
'
' ==============================================================================================
' math related
' ----------------------------------------------------------------------------------------------
Public Function oneK() As Double
oneK = cOneK
End Function
Public Function twoK() As Double
twoK = cTwoK
End Function
Public Function threeK() As Double
threeK = cThreeK
End Function
Public Function fourK() As Double
fourK = cFourK
End Function
Public Function oneMeg() As Double
oneMeg = cOneMeg
End Function
Public Function oneGig() As Double
oneGig = cOneGig
End Function
Public Function phi() As Double
phi = cPhi
End Function
Public Function e() As Double
e = cE
End Function
Public Function pi() As Double
pi = cPi
End Function
'
' ==============================================================================================
' bitmask related
' ----------------------------------------------------------------------------------------------
Public Function firstByteMask() As Long
firstByteMask = cFirstByteMask
End Function
Public Function secondByteMask() As Long
secondByteMask = cSecondByteMask
End Function
Public Function thirdByteMask() As Long
thirdByteMask = cThirdByteMask
End Function
Public Function fourthByteMask() As Long
fourthByteMask = cFourthByteMask
End Function
Public Function oneHexDigitsMask() As Long
oneHexDigitsMask = cOneHexDigitsMask
End Function
Public Function twoHexDigitsMask() As Long
twoHexDigitsMask = cTwoHexDigitsMask
End Function
Public Function threeHexDigitsMask() As Long
threeHexDigitsMask = cThreeHexDigitsMask
End Function
Public Function fourHexDigitsMask() As Long
fourHexDigitsMask = cFourHexDigitsMask
End Function
Public Function fiveHexDigitsMask() As Long
fiveHexDigitsMask = cFiveHexDigitsMask
End Function
Public Function sixHexDigitsMask() As Long
sixHexDigitsMask = cSixHexDigitsMask
End Function
Public Function sevenHexDigitsMask() As Long
sevenHexDigitsMask = cSevenHexDigitsMask
End Function
Public Function eightHexDigitsMask() As Long
eightHexDigitsMask = cEightHexDigitsMask
End Function
Copyright © 2012 Allen Baker
|