edu.isi.stella
Class DecodedDateTime

java.lang.Object
  extended by edu.isi.stella.Stella_Object
      extended by edu.isi.stella.StandardObject
          extended by edu.isi.stella.DecodedDateTime

public class DecodedDateTime
extends StandardObject

A data structure for holding decoded time values with fields for easy access of the components.


Field Summary
 int dateTimeDay
           
 Keyword dateTimeDow
           
 int dateTimeHour
           
 double dateTimeMillis
           
 int dateTimeMinute
           
 int dateTimeMonth
           
 int dateTimeSecond
           
 int dateTimeYear
           
 double dateTimeZone
           
 
Constructor Summary
DecodedDateTime()
           
 
Method Summary
static Stella_Object accessDecodedDateTimeSlotValue(DecodedDateTime self, Symbol slotname, Stella_Object value, boolean setvalueP)
           
 java.lang.String decodedDateTimeToIso8601String()
          Returns an ISO-8601 string representation of date The Format is YYYY-MM-DDThh:mm:ss+zz:zz, with the string stopping at when a null value is first encountered.
 CalendarDate encodeCalendarDate()
          Returns a calendar date object for timeStructure.
 int hashCode_()
          Return a hash code for self (can be negative).
 void mergeNullFields(DecodedDateTime renamed_Default)
          Replace any null valued fields in self with values from renamed_Default.
 void mergeSuperiorNullFields(DecodedDateTime renamed_Default)
          Replace only null valued fields in self that represent larger time units than the smallest non-null in self with values from renamed_Default.
static DecodedDateTime newDecodedDateTime()
           
static void now(DecodedDateTime parsedValues, DecodedDateTime defaultValues)
           
static DecodedDateTime parseDateTime(java.lang.String dateTimeString, int start, int end, boolean errorOnMismatchP)
          Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful.
static DecodedDateTime parseDateTimeInTimeZone(java.lang.String dateTimeString, double timeZone, int start, int end, boolean errorOnMismatchP)
          Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful.
static DecodedDateTime parseDateTimeRelativeToBase(java.lang.String dateTimeString, DecodedDateTime baseDateTime, int start, int end, boolean errorOnMismatchP, boolean mergeNullFieldsP)
          Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful.
 Surrogate primaryType()
          Returns the primary type of self.
 void setCurrentDate()
          Sets the current date into valuesStructure
 void setCurrentDateTime()
          Sets the current date and time into valuesStructure
 void setCurrentTime()
          Sets the current time into valuesStructure
static DecodedDateTime stringToDecodedDateTime(java.lang.String input)
          Returns a decoded date-time object representing the date and time parsed from the input string.
static void today(DecodedDateTime parsedValues, DecodedDateTime defaultValues)
           
static void tomorrow(DecodedDateTime parsedValues, DecodedDateTime defaultValues)
           
static void yesterday(DecodedDateTime parsedValues, DecodedDateTime defaultValues)
           
 
Methods inherited from class edu.isi.stella.StandardObject
arrayTypeSpecifierP, baseTypeToTypeSpec, cantOverwriteActiveCollectionSlot, compatibleParameterTypesP, computeAnchoredTypeSpec, computeRelativeTypeSpec, conformingTypeSpecP, copyWrappedLiteral, cppReferenceTypeP, cppReferencizeType, cppTranslateAndPointerizeTypeSpec, cppTranslateAndReferencizeTypeSpec, cppTranslateTypeSpec, dropSlotValue, extractParameterType, extractRequiredArgumentValues, getSlot, idlTranslateTypeSpec, inverseSlotDemon, javaLiteralP, javaNativeLiteralWrapperNames, javaSpecialSetterName, javaTranslateArrayOfTypeSpec, javaTranslateTypeSpec, javaTranslateTypeSpecForFunction, javaTranslateTypeSpecHelper, javaYieldClassObjectArrayExpression, javaYieldClassObjectExpression, javaYieldFullyQualifiedTypeName, javaYieldTranslatedClassAndMethodNames, listifyTypeSpec, lookupClTypeFromStellaType, objectEqlP, putSlotValue, readSlotValue, runConstructorDemons, runDestructorDemons, runSlotDemons, runSlotGuardDemonsP, standardObjectP, subTypeSpecOfP, twoArgumentLeastCommonSupertype, typeSpecToBaseType, typeSpecToClass, typeToWalkedNullValueTree, validateTypeSpecifier, voidP, walkTypeSpecIsNativeTypeP, writeSlotValue, yieldTypeSpecTree
 
Methods inherited from class edu.isi.stella.Stella_Object
_, accessInContext, amPm, anchoredTypeSpecifierP, andOrNotTreeP, applyCoercionMethod, atomicExpressionP, bindToSurrogateP, booleanP, bootstrapIsaP, bquotify, cast, characterP, clTranslateAtomicTree, clTranslateATree, clTranslateBooleanTest, clTranslatePlainBooleanTest, clTranslateVerbatimBodySymbols, clYieldTypedExpressionTree, coerceATree, coerceEvaluatedTree, coerceMvTree, coerceToBoolean, coerceToModule, coerceToModuleName, coerceToSymbol, coerceToXmlElement, coercibleP, collectFeatureList, collectKeyValueList, commonLispSymbolP, computeExpressionType, cons, 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, eqlToStringP, equalConsTreesP, equalHashCode, equalP, era, estimatedEvaluationCost, evaluate, evaluateArgumentTree, evaluateAtomicTree, evaluateCommand, expandBquoteTree, filterModuleP, floatP, free, get, getObject, 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, kvCons, legalTokenizerFromStateP, legalTokenizerStateP, legalTokenizerToStateP, literalEqlP, logLevelLE, lptrans, makeFileNameFromRelativePath, makeMemoizedValueEntry, makeMemoizedValueEntryn, matchConsTree, methodSlotP, minute, month, nameToString, nilP, noonMidn, numberWrapperToFloat, objectEqualP, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, parseTokenizerCharacterSpec, parseTokenizerStateModifiers, permanentCopy, permanentify, permanentifyForm, po, prettyPrintLiteral, primaryClass, printObject, printOutline, printStellaCode, printStellaDefinition, printUndefinedSuperClasses, proceduralExpressionP, ptrans, publicSlots, registerRecycledItem, runOptionHandlerP, safeEqualHashCode, safeHashCode, safePrimaryType, safeYieldTypeSpecifier, searchConsTreeP, searchConsTreeWithFilterP, searchForObject, secondp, sideEffectFreeExpressionP, simplifyBquoteTree, specialp, 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, walkedExpressionType, walkExpressionTree, walkMvExpressionTree, walkMvTree, walkStatement, walkTopLevelExpression, walkWithoutTypeTree, warnAboutUnknownSourceType, weekday, withinContext, withinModule, withinWorld, withStellaTokenizer, withSystemDefinition, withTokenizer, wrapperP, wrapWhereTest, xmlAttributeP, xmlCdataFormP, xmlCdataP, xmlDeclarationFormP, xmlDeclarationP, xmlDoctypeFormP, xmlElementFormP, xmlElementP, 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

dateTimeMillis

public double dateTimeMillis

dateTimeSecond

public int dateTimeSecond

dateTimeMinute

public int dateTimeMinute

dateTimeHour

public int dateTimeHour

dateTimeDay

public int dateTimeDay

dateTimeMonth

public int dateTimeMonth

dateTimeYear

public int dateTimeYear

dateTimeZone

public double dateTimeZone

dateTimeDow

public Keyword dateTimeDow
Constructor Detail

DecodedDateTime

public DecodedDateTime()
Method Detail

stringToDecodedDateTime

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

Parameters:
input -
Returns:
DecodedDateTime

parseDateTime

public static DecodedDateTime parseDateTime(java.lang.String dateTimeString,
                                            int start,
                                            int end,
                                            boolean errorOnMismatchP)
Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful. If not, it returns null. If errorOnMismatchP is true, parse-date-time will signal an error instead of returning null. Default values are 00:00:00 local time on the current date

Parameters:
dateTimeString -
start -
end -
errorOnMismatchP -
Returns:
DecodedDateTime

parseDateTimeInTimeZone

public static DecodedDateTime parseDateTimeInTimeZone(java.lang.String dateTimeString,
                                                      double timeZone,
                                                      int start,
                                                      int end,
                                                      boolean errorOnMismatchP)
Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful. If not, it returns null. If errorOnMismatchP is true, parse-date-time will signal an error instead of returning null. Default values are 00:00:00 in the given timezone on the current date. If the given timeZone value is null, then the local time zone for the given date and time will be used as determined by the operating system.

Parameters:
dateTimeString -
timeZone -
start -
end -
errorOnMismatchP -
Returns:
DecodedDateTime

parseDateTimeRelativeToBase

public static DecodedDateTime parseDateTimeRelativeToBase(java.lang.String dateTimeString,
                                                          DecodedDateTime baseDateTime,
                                                          int start,
                                                          int end,
                                                          boolean errorOnMismatchP,
                                                          boolean mergeNullFieldsP)
Tries very hard to make sense out of the argument dateTimeString and returns a time structure if successful. If not, it returns null. If errorOnMismatchP is true, parse-date-time will signal an error instead of returning null. Default values are passed in via baseDateTime. If the timezone field that is passed in is NULL, then the local time zone for the parsed date/time will be used. If mergeNullFieldsP is true, then default values from baseTimeDate will be merged into missing components. If false, then they won't be merged in for null components but can still be used as a basis for interpreatation of relative time strings like "now" or "yesterday"

Parameters:
dateTimeString -
baseDateTime -
start -
end -
errorOnMismatchP -
mergeNullFieldsP -
Returns:
DecodedDateTime

newDecodedDateTime

public static DecodedDateTime newDecodedDateTime()

now

public static void now(DecodedDateTime parsedValues,
                       DecodedDateTime defaultValues)

tomorrow

public static void tomorrow(DecodedDateTime parsedValues,
                            DecodedDateTime defaultValues)

today

public static void today(DecodedDateTime parsedValues,
                         DecodedDateTime defaultValues)

yesterday

public static void yesterday(DecodedDateTime parsedValues,
                             DecodedDateTime defaultValues)

encodeCalendarDate

public CalendarDate encodeCalendarDate()
Returns a calendar date object for timeStructure.

Returns:
CalendarDate

mergeSuperiorNullFields

public void mergeSuperiorNullFields(DecodedDateTime renamed_Default)
Replace only null valued fields in self that represent larger time units than the smallest non-null in self with values from renamed_Default. The day of the week will be set consistently, if possible. Example: if self just has the month being non-null, then only the year will be filled in from renamed_Default. If the day and minute were non-null, then hour, month and year will be filled.

This can be useful when one doesn't want to extend the precision of the answer.

Parameters:
renamed_Default -

mergeNullFields

public void mergeNullFields(DecodedDateTime renamed_Default)
Replace any null valued fields in self with values from renamed_Default. The day of the week will be set consistently, if possible.

Parameters:
renamed_Default -

decodedDateTimeToIso8601String

public java.lang.String decodedDateTimeToIso8601String()
Returns an ISO-8601 string representation of date The Format is YYYY-MM-DDThh:mm:ss+zz:zz, with the string stopping at when a null value is first encountered. The time zone will only be included (if present) if a time value is given.

Returns:
String

setCurrentDateTime

public void setCurrentDateTime()
Sets the current date and time into valuesStructure


setCurrentDate

public void setCurrentDate()
Sets the current date into valuesStructure


setCurrentTime

public void setCurrentTime()
Sets the current time into valuesStructure


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 StandardObject
Returns:
int

accessDecodedDateTimeSlotValue

public static Stella_Object accessDecodedDateTimeSlotValue(DecodedDateTime 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