ncsa.tools.ogrescript.types.evaluatable
Class DateTimeExpression

java.lang.Object
  extended byncsa.tools.ogrescript.OgreScriptElement
      extended byncsa.tools.ogrescript.types.evaluatable.DateTimeExpression
All Implemented Interfaces:
UserFacing

public class DateTimeExpression
extends OgreScriptElement


Field Summary
static java.lang.String TAG_SELF
           
 
Fields inherited from class ncsa.tools.ogrescript.OgreScriptElement
TAG_EXT_PT
 
Constructor Summary
DateTimeExpression()
           
 
Method Summary
 java.lang.Object evaluate()
          Depending on the type of operation, does the requested conversion: (a) for dateobject, it takes either string or milliseconds as the initializing value; if neither of these has been set, uses current System time; (b) for formatted string, if there is a time in milliseconds provided, converts and formats that value; else uses current System time; (c) is also the default option: takes a formatted string and returns its corresponding millisecond value, or, that being null, either returns the milliseconds value set, or the current System time if the latter is also not set.
 void setFormat(java.lang.String s)
           
 void setTimeInMillis(long l)
           
 void setTimeInMillis(java.lang.Long l)
           
 void setTimeInMillis(java.lang.String s)
           
 void setTimeString(java.lang.String s)
           
 void setType(java.lang.String s)
           
 
Methods inherited from class ncsa.tools.ogrescript.OgreScriptElement
asElement, initializeFromElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_SELF

public static final java.lang.String TAG_SELF
See Also:
Constant Field Values
Constructor Detail

DateTimeExpression

public DateTimeExpression()
Method Detail

setFormat

public void setFormat(java.lang.String s)
Parameters:
s - string for initializing a SimpleDateFormat object (default: "yyyy/MM/dd HH:mm:ss").

setType

public void setType(java.lang.String s)
             throws java.lang.IllegalArgumentException
Parameters:
s - three options: "millis" [milliseconds], "dateobject" [the java.util.Date object], or "formatted" [String formatted by the formatter].
Throws:
java.lang.IllegalArgumentException - if some other option string is provided.

setTimeString

public void setTimeString(java.lang.String s)
Parameters:
s - represents a date-time String to be parsed.

setTimeInMillis

public void setTimeInMillis(java.lang.String s)
                     throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

setTimeInMillis

public void setTimeInMillis(long l)

setTimeInMillis

public void setTimeInMillis(java.lang.Long l)

evaluate

public java.lang.Object evaluate()
Depending on the type of operation, does the requested conversion: (a) for dateobject, it takes either string or milliseconds as the initializing value; if neither of these has been set, uses current System time; (b) for formatted string, if there is a time in milliseconds provided, converts and formats that value; else uses current System time; (c) is also the default option: takes a formatted string and returns its corresponding millisecond value, or, that being null, either returns the milliseconds value set, or the current System time if the latter is also not set.

Returns:
either a Date object, a formatted String or a Long.