edu.isi.stella
Class CalendarDate

java.lang.Object
  extended by edu.isi.stella.Stella_Object
      extended by edu.isi.stella.Quantity
          extended by edu.isi.stella.DateTimeObject
              extended by edu.isi.stella.CalendarDate

public class CalendarDate
extends DateTimeObject

Representation of Date and Time with the date represented as a modified Julian day (starting at midnight instead of noon) and the time as the offset in milliseconds from midnight, UTC


Field Summary
 int modifiedJulianDay
           
 int timeMillis
           
 
Constructor Summary
CalendarDate()
           
 
Method Summary
static Stella_Object accessCalendarDateSlotValue(CalendarDate self, Symbol slotname, Stella_Object value, boolean setvalueP)
           
static void addDateSubstitution(CalendarDate date, KeyValueList substitutionList)
          Fill in substitutionList with template variable substitions for the names YEAR, MONTH, MON, DAY, HOUR, MINUTE, SECOND, TIMEZONE, DAY-OF-WEEK, DOW with their values for date.
 java.lang.String calendarDateToDateString(double timezone, boolean numericMonthP)
          Returns the date part of the string representation of date adjusted for timezone.
 java.lang.String calendarDateToIso8601String(double timezone, boolean includeTimezoneP)
          Returns an ISO-8601 string representation of date adjusted for timezone.
 long calendarDateToNativeDateTime()
           
 java.lang.String calendarDateToString(double timezone, boolean numericMonthP, boolean includeTimezoneP)
          Returns a string representation of date adjusted for timezone.
 java.lang.String calendarDateToTimeString(double timezone, boolean includeTimezoneP, boolean includeMillisP, boolean padHoursP)
          Returns the time part of the string representation of date adjusted for timezone.
 Quantity coerceTo(Stella_Object y)
           
 DecodedDateTime decodeCalendarDate(double timezone)
          Returns a decoded time object for date interpreted in timezone timezone is the number of hours added to UTC to get local time.
 int getCalendarDate(double timezone, java.lang.Object[] MV_returnarray)
          Returns multiple values of year, month, day and day of week for date in timezone.
 int getTime(double timezone, java.lang.Object[] MV_returnarray)
          Returns multiple values of hours, minutes, seconds, milliseconds for the calendar date date in timezone.
 boolean greaterEqualP(Stella_Object t2)
           
 boolean greaterP(Stella_Object t2)
           
 int hashCode_()
          Return a hash code for self (can be negative).
 boolean lessEqualP(Stella_Object t2)
           
 boolean lessP(Stella_Object t2)
           
static CalendarDate makeCalendarDate(int day, int time)
           
static CalendarDate makeCurrentDateTime()
          Create a calendar date with current time and date.
static CalendarDate makeDateTime(int year, int month, int day, int hour, int minute, int second, int millis, double timezone)
          Create a calendar date with the specified components.
static CalendarDate nativeDateTimeToCalendarDate(long date)
           
static CalendarDate newCalendarDate()
           
 boolean objectEqlP(Stella_Object t2)
           
 Surrogate primaryType()
          Returns the primary type of self.
 void printCalendarDate(java.io.PrintStream stream)
           
 void printObject(java.io.PrintStream stream)
           
static CalendarDate stringToCalendarDate(java.lang.String input)
          Returns a calendar date object representing the date and time parsed from the input string.
static CalendarDate stringToCalendarDateWithDefault(java.lang.String inputDate, DecodedDateTime defaultDate)
          Returns a calendar date object representing the date and time parsed from the inputDate string.
 
Methods inherited from class edu.isi.stella.DateTimeObject
timeAdd, timeSubtract
 
Methods inherited from class edu.isi.stella.Stella_Object
_, accessInContext, addPropertyValue, amPm, anchoredTypeSpecifierP, andOrNotTreeP, applyCoercionMethod, atomicExpressionP, bindToSurrogateP, booleanP, bootstrapIsaP, bquotify, cast, characterP, chooseSortPredicate, clConditionalizeTypeDeclarationTree, clTranslateAtomicTree, clTranslateATree, clTranslateBooleanTest, clTranslatePlainBooleanTest, clTranslateVerbatimBodySymbols, clYieldTypedExpressionTree, coerceATree, coerceEvaluatedTree, coerceMvTree, coerceOptionValue, coerceToBoolean, coerceToFloat, coerceToHashSet, coerceToModule, coerceToModuleName, coerceToString, coerceToSymbol, coerceToXmlElement, coerceValueToBoolean, coerceValueToFloat, coerceValueToString, coerceValueToType, coercibleP, collectFeatureList, collectKeyValueList, commonLispSymbolP, computeExpressionType, consify, consifyListsAndIterators, consP, consTreeMatchP, convertToLiteral, copyConsTree, cppArgumentIsStreamP, cppBinaryOperatorP, cppBlockP, cppMaybeOutputStatementWithParentheses, cppOperatorP, cppOutputAtomicExpression, cppOutputLiteral, cppOutputOneActualParameter, cppOutputStatement, cppOutputTypedEntity, cppPrognifyStatement, cppPrognP, cppStatementToList, cppStreamIsStandardOutputP, cpptrans, cppTranslateAtomicTree, cppTranslateATree, cppTranslatedArrayTypeP, csValueP, dateDivider, dateTimeDivider, day, dealWithAmPm, dealWithEra, dealWithNoonMidn, decrementReferenceCount, defaultOptionHandler, defineSystem, defmodule, deletedP, describe, describeObject, describeTersely, destructureMethodNameTree, deUglifyParseTree, either, eqlP, eqlToBooleanP, eqlToCharacterP, eqlToFloatP, eqlToIntegerP, eqlToLongIntegerP, eqlToStringP, equalConsTreesP, equalHashCode, equalP, era, estimatedEvaluationCost, evaluate, evaluateArgumentTree, evaluateAtomicTree, evaluateCommand, expandBquoteTree, filterModuleP, floatP, free, get, getObject, getProperty, hashlist, hashMemoizedArguments, helpBquotify, helpClTranslateATree, helpCoerceATree, helpLptrans, helpPrintOutline, helpTransformBooleanProceduralExpression, helpWalkATree, homeModule, hour, idlOutputAtomicExpression, idlOutputLiteral, idlOutputStatement, idlTranslateAtomicTree, idlTranslateATree, illegalTreeP, implodePathname, incrementallyTranslate, incrementReferenceCount, inlineUnwrapBoolean, inlineWrapBoolean, inModule, integerP, isaP, javaBinaryOperatorP, javaBlockP, javaEndOfLineTokenP, javaHelpOutputPrintStream, javaMaybeOutputStatementWithParentheses, javaOperatorP, javaOutputLiteral, javaOutputStatement, javaPrognP, javaStreamIsStandardOutputP, javaSymbolCaseP, javaTranslateAtomicTree, javaTranslateATree, javaTranslateWithNativeWrapper, jptrans, keywordP, legalTokenizerFromStateP, legalTokenizerStateP, legalTokenizerToStateP, literalEqlP, logLevelLE, longIntegerP, lptrans, makeEvaluatableBquoteTree, makeFileNameFromRelativePath, makeMemoizedValueEntry, makeMemoizedValueEntryn, matchConsTree, methodSlotP, minute, month, nameToString, nilP, noonMidn, numberWrapperToFloat, objectEqualP, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, parseOptions, parseTokenizerCharacterSpec, parseTokenizerStateModifiers, permanentCopy, permanentify, permanentifyForm, po, prettyPrintLiteral, primaryClass, printOutline, printStellaCode, printStellaDefinition, printUndefinedSuperClasses, proceduralExpressionP, ptrans, publicSlots, registerRecycledItem, runOptionHandlerP, safeEqualHashCode, safeHashCode, safePrimaryType, safeYieldTypeSpecifier, searchConsTreeP, searchConsTreeWithFilterP, searchForObject, secondp, setProperty, sideEffectFreeExpressionP, simplifyBquoteTree, specialp, standardObjectP, stella_Increment, stellaClassP, stellaCollectionP, stellaNeedToCompileP, stellaNeedToTranslateP, stellaObjectP, stellify, storageSlotP, stringifyInModule, stringP, substituteConsTree, substituteOnce, surrogateP, surrogatify, sweep, symbolCaseP, symbolP, sysTree, targetLanguageType, taxonomyIsaP, timeDivider, timeMultiply, tokenizerIncludeSpecP, tokenizerToStateAlias, tokenizerToStateName, toString, traceIf, traceKeywordP, transientifyForm, transientObjectP, transientSymbolP, translateWalkedTree, treeSize, treeToTrees, trueOptionP, tryToEvaluate, typeP, typify, unmake, unregisterRecycledItem, updateInContext, valuesTreeP, variableExpressionP, verbatimStringP, verbatimTreeP, vetOptions, vrletExpressionP, walkAtomicTree, walkATree, walkCollectionTree, walkDontCallMeTree, walkedExpressionExpression, walkedExpressionType, walkExpressionTree, walkMvExpressionTree, walkMvTree, walkStatement, walkTopLevelExpression, walkWithoutTypeTree, warnAboutUnknownSourceType, weekday, withinContext, withinModule, withinWorld, withStellaTokenizer, withSystemDefinition, withTokenizer, wrapperP, wrapWhereTest, xmlAttributeP, xmlBaseAttributeP, xmlCdataFormP, xmlCdataP, xmlDeclarationFormP, xmlDeclarationP, xmlDoctypeFormP, xmlElementFormP, xmlElementP, xmlGlobalAttributeP, xmlLocalAttributeP, xmlnsAttributeP, xmlProcessingInstructionFormP, xmlProcessingInstructionP, xmlTagCase, year, yieldCondTest, yieldCondTestOrTests, yieldHardcodedCaseSymbolIdOrIds, yieldInCursorClausesForArgumentList, yieldInCursorClausesForGeneralCollection, yieldInCursorClausesForVector, yieldTypeSpecifier, zone, zoneMinute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

modifiedJulianDay

public int modifiedJulianDay

timeMillis

public int timeMillis
Constructor Detail

CalendarDate

public CalendarDate()
Method Detail

stringToCalendarDateWithDefault

public static CalendarDate stringToCalendarDateWithDefault(java.lang.String inputDate,
                                                           DecodedDateTime defaultDate)
Returns a calendar date object representing the date and time parsed from the inputDate string. Default values for missing fields and the interpretation of relative references come from defaultDate. If the defaultDate is null, the current date will be used. If a null set of defaults is desired, use $NULL_DECODED_DATE_TIME$. If no valid parse is found, null is returned.

Parameters:
inputDate -
defaultDate -
Returns:
CalendarDate

stringToCalendarDate

public static CalendarDate stringToCalendarDate(java.lang.String input)
Returns a calendar date object representing the date and time parsed from the input string. If no valid parse is found, null is returned.

Parameters:
input -
Returns:
CalendarDate

makeCalendarDate

public static CalendarDate makeCalendarDate(int day,
                                            int time)

makeCurrentDateTime

public static CalendarDate makeCurrentDateTime()
Create a calendar date with current time and date.

Returns:
CalendarDate

makeDateTime

public static CalendarDate makeDateTime(int year,
                                        int month,
                                        int day,
                                        int hour,
                                        int minute,
                                        int second,
                                        int millis,
                                        double timezone)
Create a calendar date with the specified components. year must be the complete year (i.e., a year of 98 is 98 A.D in the 1st century). timezone is a real number in the range -12.0 to +14.0 where UTC is zone 0.0; The number is the number of hours to add to UTC to arrive at local time.

Parameters:
year -
month -
day -
hour -
minute -
second -
millis -
timezone -
Returns:
CalendarDate

nativeDateTimeToCalendarDate

public static CalendarDate nativeDateTimeToCalendarDate(long date)

newCalendarDate

public static CalendarDate newCalendarDate()

addDateSubstitution

public static void addDateSubstitution(CalendarDate date,
                                       KeyValueList substitutionList)
Fill in substitutionList with template variable substitions for the names YEAR, MONTH, MON, DAY, HOUR, MINUTE, SECOND, TIMEZONE, DAY-OF-WEEK, DOW with their values for date. Also, pre-formatted DATE, TIME and ISO8601 variables are set.

TIMEZONE is in the format "{+|-}hhmm". MONTH is the full English month name and MON is the numeric month. DAY-OF-WEEK is an English string and DOW is the first three letters. Minutes and seconds are zero-padded.

These substitutions can be used with substituteTemplateVariablesInString

Parameters:
date -
substitutionList -

greaterEqualP

public boolean greaterEqualP(Stella_Object t2)
Overrides:
greaterEqualP in class Quantity

lessEqualP

public boolean lessEqualP(Stella_Object t2)
Overrides:
lessEqualP in class Quantity

greaterP

public boolean greaterP(Stella_Object t2)
Overrides:
greaterP in class Quantity

lessP

public boolean lessP(Stella_Object t2)
Overrides:
lessP in class Quantity

objectEqlP

public boolean objectEqlP(Stella_Object t2)
Overrides:
objectEqlP in class Stella_Object

decodeCalendarDate

public DecodedDateTime decodeCalendarDate(double timezone)
Returns a decoded time object for date interpreted in timezone timezone is the number of hours added to UTC to get local time. It is in the range -12.0 to +14.0 where UTC is zone 0.0

Parameters:
timezone -
Returns:
DecodedDateTime

getTime

public int getTime(double timezone,
                   java.lang.Object[] MV_returnarray)
Returns multiple values of hours, minutes, seconds, milliseconds for the calendar date date in timezone. timezone is the number of hours added to UTC to get local time. It is in the range -12.0 to +14.0 where UTC is zone 0.0

Parameters:
timezone -
MV_returnarray -
Returns:
int

getCalendarDate

public int getCalendarDate(double timezone,
                           java.lang.Object[] MV_returnarray)
Returns multiple values of year, month, day and day of week for date in timezone. timezone is the number of hours added to UTC to get local time. It is in the range -12.0 to +14.0 where UTC is zone 0.0

Parameters:
timezone -
MV_returnarray -
Returns:
int

printCalendarDate

public void printCalendarDate(java.io.PrintStream stream)

calendarDateToNativeDateTime

public long calendarDateToNativeDateTime()

calendarDateToIso8601String

public java.lang.String calendarDateToIso8601String(double timezone,
                                                    boolean includeTimezoneP)
Returns an ISO-8601 string representation of date adjusted for timezone. The Format is YYYY-MM-DDThh:mm:ss z:zz. The timezone as an offset hh:mm is included if includeTimezoneP is true.

Recommended values for the flag is true.

Parameters:
timezone -
includeTimezoneP -
Returns:
String

calendarDateToString

public java.lang.String calendarDateToString(double timezone,
                                             boolean numericMonthP,
                                             boolean includeTimezoneP)
Returns a string representation of date adjusted for timezone. The Format is YYYY-MMM-DD hh:mm:ss z.z, where MMM is a three letter English abbreviation of the month if numericMonthP is false and a two digit numeric value if numericMonthP is true. The timezone as a float offset z.z is included if includeTimezoneP is true.

Recommended values for the flags are false and true respectively.

Parameters:
timezone -
numericMonthP -
includeTimezoneP -
Returns:
String

calendarDateToTimeString

public java.lang.String calendarDateToTimeString(double timezone,
                                                 boolean includeTimezoneP,
                                                 boolean includeMillisP,
                                                 boolean padHoursP)
Returns the time part of the string representation of date adjusted for timezone. The timezone is included in the string if includeTimezoneP is true. The value true is recommended. Milliseconds will be included if includeMillisP is true. Hours will be zero-padded to length 2 if padHoursP is true.

Parameters:
timezone -
includeTimezoneP -
includeMillisP -
padHoursP -
Returns:
String

calendarDateToDateString

public java.lang.String calendarDateToDateString(double timezone,
                                                 boolean numericMonthP)
Returns the date part of the string representation of date adjusted for timezone. Format is YYYY-MMM-DD, where MMM is a three letter English abbreviation of the month if numericMonthP is false and a two digit numeric value if numericMonthP is true. The value false is recommended.

Parameters:
timezone -
numericMonthP -
Returns:
String

hashCode_

public int hashCode_()
Description copied from class: Stella_Object
Return a hash code for self (can be negative). Two objects that are eqlP are guaranteed to generate the same hash code. Two objects that are not eqlP do not necessarily generate different hash codes.

Overrides:
hashCode_ in class Stella_Object
Returns:
int

coerceTo

public Quantity coerceTo(Stella_Object y)
Overrides:
coerceTo in class Quantity

printObject

public void printObject(java.io.PrintStream stream)
Overrides:
printObject in class Stella_Object

accessCalendarDateSlotValue

public static Stella_Object accessCalendarDateSlotValue(CalendarDate self,
                                                        Symbol slotname,
                                                        Stella_Object value,
                                                        boolean setvalueP)

primaryType

public Surrogate primaryType()
Description copied from class: Stella_Object
Returns the primary type of self. Gets defined automatically for every non-abstract subclass of OBJECT.

Overrides:
primaryType in class Stella_Object
Returns:
Surrogate