com.isti.util
Class IstiEpoch

java.lang.Object
  extended bycom.isti.util.IstiEpoch
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class IstiEpoch
extends java.lang.Object
implements java.lang.Comparable, java.util.Comparator

IstiEpoch is a class that is used to help convert from IstiEpochs (either longs or doubles) into GregorianCalendar


Field Summary
static int AllTime
           
static int Day
           
static int DayHr
           
static int DayHrMin
           
static int DayHrMinSec
           
static int DayHrMinSecMsec
           
static java.lang.String defaultBottomFormat
           
static java.lang.String defaultFormat
           
static int Epoch
           
static java.lang.String epochFormat
           
static int HrMin
           
static int HrMinSec
           
static int HrMinSecMSec
           
static int Min
           
static int MinSec
           
static int MinSecMsec
           
(package private)  java.lang.String[] monthNames
           
static int Msec
           
static int None
           
static int SecMsec
           
static int YearDay
           
static int YearDayHr
           
static int YearDayHrMin
           
static int YearDayHrMinSec
           
 
Constructor Summary
IstiEpoch()
          This constructor sets the time to 0 milliseconds.
IstiEpoch(java.util.Date gc)
          creates an IstiEpoch from an existing GregorianCaledar, and sets the TimeZone correctly to UTC
IstiEpoch(double tmpDoub)
          This constructor takes the number of seconds from the Epoch time
IstiEpoch(java.util.GregorianCalendar gc)
          creates an IstiEpoch from an existing GregorianCaledar, and sets the TimeZone correctly to UTC
IstiEpoch(IstiEpoch tmpIstiEpoch)
          This constructor takes the Epoch time
IstiEpoch(long tmpTime)
          This constructor takes the number of milliseconds from the Epoch time
IstiEpoch(long seconds, long milliseconds)
          This constructor takes the number of seconds and milliseconds from the Epoch time
IstiEpoch(java.lang.String respTime)
          This constructor takes time from a string in RESP outptu format YYYY,DDD,HH:MM:SS from the Epoch time
 
Method Summary
 double absDiff(IstiEpoch newEpoch)
          This function returns the number of seconds between this and another IstiEpoch
 void add(double secs)
          This function adds the number of seconds to the time
 java.lang.String btimeFormattedString()
           
 void clear()
           
 int compare(IstiEpoch time1, IstiEpoch time2)
          Compares its two arguments for order.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares its two arguments for order.
 int compareTo(IstiEpoch anotherTime)
          Compares this IstiEpoch to another Object.
 int compareTo(java.lang.Object o)
          Compares this IstiEpoch to another Object.
 double diff(IstiEpoch newEpoch)
          This function returns the number of seconds between this and another IstiEpoch
 boolean equals(java.lang.Object o)
           
 java.lang.String fileFormattedString()
          Method declaration
 java.lang.String formatInt(java.lang.String item, int places)
          forward pads in with zero's
 java.lang.String formattedString()
          Method declaration
 java.lang.String formattedString(int type)
           
 java.lang.String formattedString(java.lang.String name)
           
 int get(int calVal)
           
 double getEpoch()
          GetEpoch returns the number of seconds for the epoch time
static java.lang.String[] getFormattedStrings()
           
static java.lang.String getFormatType(int type)
           
 java.util.GregorianCalendar getGregorianCalendar()
          Method declaration
 java.lang.String getHr()
          Method declaration
 int getIntDOM()
           
 int getIntDOY()
           
 int getIntEpoch()
           
 long getIntEpochMSecs()
          GetEpoch returns the number of milli-seconds for the epoch time
 int getIntHr()
          get the int value for hour into the day.
 int getIntInt(int calendarStatic)
           
 int getIntMn()
          get the int value for minutes into the day.
 int getIntMonth()
          Method declaration
 int getIntSec()
          get the int value for seconds into the day.
 int getIntYear()
          Method declaration
 java.lang.String getJDay()
          Method declaration
 long getLongEpoch()
          GetLongEpoch returns the number of seconds for the epoch time
 int getmDay()
          Method declaration
 java.lang.String getMDay()
          Method declaration
 java.lang.String getMn()
          Method declaration
 java.lang.String getMonStr()
          Method declaration
 java.lang.String getMSecond()
          Method declaration
 java.lang.String getMsecond(int places)
           
 java.lang.String getSecond()
          Method declaration
 java.lang.String getTenthsMillisecond()
           
 java.util.Date getTime()
           
 long getTimeInMillis()
          Gets the current time as a long.
 java.util.TimeZone getTimeZone()
           
 java.lang.String getYear()
          Method declaration
 int hashCode()
          Returns a hash code value for this object.
 java.lang.String hrminsecmsString()
          Method declaration
 java.lang.String hrminsecString()
          Method declaration
 boolean inTimeRange(IstiEpoch start, IstiEpoch end)
          returns true is this IstiEpoch lies between the 2 argument times.
 boolean isAfter(double rtime)
          returns true is this IstiEpoch if after given time
 boolean isAfter(IstiEpoch refTime)
          returns true is this IstiEpoch if after given time
 boolean isAfterEqual(IstiEpoch refTime)
          returns true is this IstiEpoch if after given time
 boolean isAfterNotEqual(IstiEpoch refTime)
          returns true is this IstiEpoch if after given time
 boolean isBefore(double rtime)
          returns true is this IstiEpoch if before given time
 boolean isBefore(IstiEpoch refTime)
          returns true is this IstiEpoch if before given time
 boolean isBeforeEqual(IstiEpoch refTime)
          returns true is this IstiEpoch if before given time
 boolean isBeforeNotEqual(IstiEpoch refTime)
          returns true is this IstiEpoch if before given time
 boolean isEqualTo(IstiEpoch refTime)
          returns true is this IstiEpoch is equal to a given time
 boolean isEvenMinute()
          Method declaration
 java.lang.String ISO8601FormattedString()
           
 java.lang.String labelformattedString()
          Method declaration
 java.lang.String longformattedString()
          Method declaration
static void main(java.lang.String[] args)
           
 java.lang.String minsecString()
          Method declaration
 void minus(double secs)
          This function subtracts the number of seconds from the time
 java.lang.String secString()
          Method declaration
 void set(int year, int month, int day, int hr, int min)
          enter everything but the seconds
 void setDateToTODAY()
          trims the time to the start of the current day (leave time alone)
 void setHr(int hour)
          Method declaration
 void setIntTime(double dsecs)
          set time passing in secs since 1970
 void setIntTime(int secs)
          set time passing in secs since 1970
 void setJDay(int doy)
          Method declaration
 void setmDay(int day)
          Method declaration
 void setMn(int min)
          Method declaration
 void setMonth(int month)
          Method declaration
 void setMSecond(int milli)
          Method declaration
 void setSec(int sec)
          Method declaration
 void setSecond(int sec)
          Method declaration
 void setTime(java.util.Date date)
           
 void setTime(double dsecs)
          set time passing in millisecs since 1970
 void setTime(int millisecs)
          set time passing in millisecs since 1970
 void setTime(int year, int jday, int hr, int min, int sec)
          Method declaration
 void setTime(IstiEpoch newTime)
          Method declaration
 void setTime(long msecs)
          set time passing in millisecs since 1970.
 void setTime(long seconds, long milliseconds)
          set time passing in seconds and millisecs since 1970
 void setTime(java.lang.String respTime)
          set time from RESP format string time.
 void setTimeFissuresTime(java.lang.String ftime)
          accepts the time in the format YYYY-MM-DDTHH:MM:SS.mmmZ
 void setTimeInMillis(long millis)
          Sets the current time from the given long value.
 void setTimetoDay()
          trims the time to the start of the current day
 void setTimetoDay(IstiEpoch tmpTime)
          trims the time to the start of the desired day
 IstiEpoch settoCurrentTime()
          Method declaration used to return a void
 void setYear(int year)
          Method declaration
 java.lang.String toString()
          Method declaration
static java.lang.String toString(double tmpdouble)
           
 java.lang.String toWaveviewerRequestString()
          Method declaration
 java.lang.String yeardayString()
          Method declaration
 java.lang.String yearmondayhrminString()
          Method declaration
 java.lang.String yearmondayString()
          Method declaration
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

epochFormat

public static final java.lang.String epochFormat
See Also:
Constant Field Values

defaultFormat

public static final java.lang.String defaultFormat
See Also:
Constant Field Values

defaultBottomFormat

public static final java.lang.String defaultBottomFormat
See Also:
Constant Field Values

None

public static final int None
See Also:
Constant Field Values

AllTime

public static final int AllTime
See Also:
Constant Field Values

YearDayHrMinSec

public static final int YearDayHrMinSec
See Also:
Constant Field Values

YearDayHrMin

public static final int YearDayHrMin
See Also:
Constant Field Values

YearDayHr

public static final int YearDayHr
See Also:
Constant Field Values

YearDay

public static final int YearDay
See Also:
Constant Field Values

DayHrMinSecMsec

public static final int DayHrMinSecMsec
See Also:
Constant Field Values

DayHrMinSec

public static final int DayHrMinSec
See Also:
Constant Field Values

DayHrMin

public static final int DayHrMin
See Also:
Constant Field Values

DayHr

public static final int DayHr
See Also:
Constant Field Values

Day

public static final int Day
See Also:
Constant Field Values

HrMinSecMSec

public static final int HrMinSecMSec
See Also:
Constant Field Values

HrMinSec

public static final int HrMinSec
See Also:
Constant Field Values

HrMin

public static final int HrMin
See Also:
Constant Field Values

MinSecMsec

public static final int MinSecMsec
See Also:
Constant Field Values

MinSec

public static final int MinSec
See Also:
Constant Field Values

Min

public static final int Min
See Also:
Constant Field Values

SecMsec

public static final int SecMsec
See Also:
Constant Field Values

Msec

public static final int Msec
See Also:
Constant Field Values

Epoch

public static final int Epoch
See Also:
Constant Field Values

monthNames

java.lang.String[] monthNames
Constructor Detail

IstiEpoch

public IstiEpoch()
This constructor sets the time to 0 milliseconds.


IstiEpoch

public IstiEpoch(double tmpDoub)
This constructor takes the number of seconds from the Epoch time


IstiEpoch

public IstiEpoch(IstiEpoch tmpIstiEpoch)
This constructor takes the Epoch time


IstiEpoch

public IstiEpoch(java.util.GregorianCalendar gc)
creates an IstiEpoch from an existing GregorianCaledar, and sets the TimeZone correctly to UTC

Parameters:
gc -

IstiEpoch

public IstiEpoch(java.util.Date gc)
creates an IstiEpoch from an existing GregorianCaledar, and sets the TimeZone correctly to UTC

Parameters:
gc -

IstiEpoch

public IstiEpoch(long tmpTime)
This constructor takes the number of milliseconds from the Epoch time


IstiEpoch

public IstiEpoch(long seconds,
                 long milliseconds)
This constructor takes the number of seconds and milliseconds from the Epoch time


IstiEpoch

public IstiEpoch(java.lang.String respTime)
This constructor takes time from a string in RESP outptu format YYYY,DDD,HH:MM:SS from the Epoch time

Method Detail

getGregorianCalendar

public java.util.GregorianCalendar getGregorianCalendar()
Method declaration

Returns:
See Also:

settoCurrentTime

public IstiEpoch settoCurrentTime()
Method declaration used to return a void

See Also:

setTimetoDay

public void setTimetoDay()
trims the time to the start of the current day


setDateToTODAY

public void setDateToTODAY()
trims the time to the start of the current day (leave time alone)


setTimetoDay

public void setTimetoDay(IstiEpoch tmpTime)
trims the time to the start of the desired day


getFormatType

public static java.lang.String getFormatType(int type)

setTime

public final void setTime(java.util.Date date)

setTime

public final void setTime(long msecs)
set time passing in millisecs since 1970.

Parameters:
msecs - millisecs since 1970.

setTimeFissuresTime

public void setTimeFissuresTime(java.lang.String ftime)
accepts the time in the format YYYY-MM-DDTHH:MM:SS.mmmZ

Parameters:
ftime - String

setTime

public final void setTime(java.lang.String respTime)
set time from RESP format string time. YYYY,DDD,HH:MM:SS


setTime

public final void setTime(double dsecs)
set time passing in millisecs since 1970


setIntTime

public void setIntTime(double dsecs)
set time passing in secs since 1970


setIntTime

public void setIntTime(int secs)
set time passing in secs since 1970

Parameters:
secs -

setTime

public void setTime(int millisecs)
set time passing in millisecs since 1970


setTimeInMillis

public final void setTimeInMillis(long millis)
Sets the current time from the given long value.

Parameters:
millis - the new time in UTC milliseconds from the epoch, January 1, 1970, 00:00:00.

setTime

public final void setTime(long seconds,
                          long milliseconds)
set time passing in seconds and millisecs since 1970

Parameters:
seconds - seconds since 1970.
milliseconds - millisecs since 1970.

setTime

public void setTime(IstiEpoch newTime)
Method declaration

Parameters:
newTime -
See Also:

add

public void add(double secs)
This function adds the number of seconds to the time


minus

public void minus(double secs)
This function subtracts the number of seconds from the time


diff

public double diff(IstiEpoch newEpoch)
This function returns the number of seconds between this and another IstiEpoch


equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Comparator

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this IstiEpoch to another Object. If the Object is an IstiEpoch, this function behaves like compareTo(IstiEpoch). Otherwise, it throws a ClassCastException (as IstiEpochs are comparable only to other IstiEpochs).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Object
Returns:
the value 0 if the argument is an IstiEpoch equal to this IstiEpoch; a value less than 0 if the argument is an IstiEpoch after this IstiEpoch; and a value greater than 0 if the argument is an IstiEpoch before this IstiEpoch
Throws:
java.lang.ClassCastException - - if the argument is not an IstiEpoch.

compareTo

public int compareTo(IstiEpoch anotherTime)
Compares this IstiEpoch to another Object. If the Object is an IstiEpoch, this function behaves like compareTo(IstiEpoch). Otherwise, it throws a ClassCastException (as IstiEpochs are comparable only to other IstiEpochs).

Parameters:
anotherTime - the time to be compared.
Returns:
the value 0 if the argument is an IstiEpoch equal to this IstiEpoch; a value less than 0 if the argument is an IstiEpoch after this IstiEpoch; and a value greater than 0 if the argument is an IstiEpoch before this IstiEpoch.

hashCode

public int hashCode()
Returns a hash code value for this object. The result is the exclusive OR of the two halves of the primitive long value returned by the getTime() method. That is, the hash code is the value of the expression: (int)(this.getTimeInMillis()^(this.getTimeInMillis() >>> 32))

Returns:
a hash code value for this object.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
            throws java.lang.ClassCastException
Compares its two arguments for order.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - the first Object.
o2 - the second Object.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
Throws:
java.lang.ClassCastException - - if an argument is not an IstiEpoch.

compare

public int compare(IstiEpoch time1,
                   IstiEpoch time2)
Compares its two arguments for order.

Parameters:
time1 - the first time.
time2 - the second time.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second

absDiff

public double absDiff(IstiEpoch newEpoch)
This function returns the number of seconds between this and another IstiEpoch


inTimeRange

public boolean inTimeRange(IstiEpoch start,
                           IstiEpoch end)
returns true is this IstiEpoch lies between the 2 argument times. Inclusive of the end times


isBefore

public boolean isBefore(IstiEpoch refTime)
returns true is this IstiEpoch if before given time


isBefore

public boolean isBefore(double rtime)
returns true is this IstiEpoch if before given time


isBeforeEqual

public boolean isBeforeEqual(IstiEpoch refTime)
returns true is this IstiEpoch if before given time


isAfter

public boolean isAfter(IstiEpoch refTime)
returns true is this IstiEpoch if after given time


isAfter

public boolean isAfter(double rtime)
returns true is this IstiEpoch if after given time


isEqualTo

public boolean isEqualTo(IstiEpoch refTime)
returns true is this IstiEpoch is equal to a given time


isBeforeNotEqual

public boolean isBeforeNotEqual(IstiEpoch refTime)
returns true is this IstiEpoch if before given time


isAfterNotEqual

public boolean isAfterNotEqual(IstiEpoch refTime)
returns true is this IstiEpoch if after given time


isAfterEqual

public boolean isAfterEqual(IstiEpoch refTime)
returns true is this IstiEpoch if after given time


getEpoch

public double getEpoch()
GetEpoch returns the number of seconds for the epoch time


getLongEpoch

public long getLongEpoch()
GetLongEpoch returns the number of seconds for the epoch time


getIntEpoch

public int getIntEpoch()

getIntEpochMSecs

public long getIntEpochMSecs()
GetEpoch returns the number of milli-seconds for the epoch time


getTimeInMillis

public long getTimeInMillis()
Gets the current time as a long.

Returns:
the current time as UTC milliseconds from the epoch, January 1, 1970, 00:00:00.

toString

public java.lang.String toString()
Method declaration

Returns:
See Also:

toString

public static java.lang.String toString(double tmpdouble)

toWaveviewerRequestString

public java.lang.String toWaveviewerRequestString()
Method declaration

Returns:
See Also:

hrminsecString

public java.lang.String hrminsecString()
Method declaration

Returns:
See Also:

hrminsecmsString

public java.lang.String hrminsecmsString()
Method declaration

Returns:
See Also:

minsecString

public java.lang.String minsecString()
Method declaration

Returns:
See Also:

secString

public java.lang.String secString()
Method declaration

Returns:
See Also:

yeardayString

public java.lang.String yeardayString()
Method declaration

Returns:
See Also:

yearmondayString

public java.lang.String yearmondayString()
Method declaration

Returns:
See Also:

yearmondayhrminString

public java.lang.String yearmondayhrminString()
Method declaration

Returns:
See Also:

formattedString

public java.lang.String formattedString(java.lang.String name)

getFormattedStrings

public static java.lang.String[] getFormattedStrings()

formattedString

public java.lang.String formattedString(int type)

formattedString

public java.lang.String formattedString()
Method declaration

Returns:
See Also:

ISO8601FormattedString

public java.lang.String ISO8601FormattedString()

btimeFormattedString

public java.lang.String btimeFormattedString()

longformattedString

public java.lang.String longformattedString()
Method declaration

Returns:
See Also:

labelformattedString

public java.lang.String labelformattedString()
Method declaration

Returns:
See Also:

fileFormattedString

public java.lang.String fileFormattedString()
Method declaration

Returns:
See Also:

setTime

public void setTime(int year,
                    int jday,
                    int hr,
                    int min,
                    int sec)
Method declaration

Parameters:
year -
jday -
hr -
min -
sec -
See Also:

getIntYear

public int getIntYear()
Method declaration

Returns:
See Also:

get

public int get(int calVal)

getTime

public java.util.Date getTime()

getIntMonth

public int getIntMonth()
Method declaration

Returns:
See Also:

getIntDOY

public int getIntDOY()

getIntDOM

public int getIntDOM()

getIntInt

public int getIntInt(int calendarStatic)

getmDay

public int getmDay()
Method declaration

Returns:
See Also:

setYear

public void setYear(int year)
Method declaration

Parameters:
year -
See Also:

setMonth

public void setMonth(int month)
Method declaration

Parameters:
month -
See Also:

setmDay

public void setmDay(int day)
Method declaration

Parameters:
day -
See Also:

setJDay

public void setJDay(int doy)
Method declaration

Parameters:
doy -
See Also:

setHr

public void setHr(int hour)
Method declaration

Parameters:
hour -
See Also:

setMn

public void setMn(int min)
Method declaration

Parameters:
min -
See Also:

setSec

public void setSec(int sec)
Method declaration

Parameters:
sec -
See Also:

setSecond

public void setSecond(int sec)
Method declaration

Parameters:
sec -
See Also:

set

public void set(int year,
                int month,
                int day,
                int hr,
                int min)
enter everything but the seconds


setMSecond

public void setMSecond(int milli)
Method declaration

Parameters:
milli -
See Also:

getYear

public java.lang.String getYear()
Method declaration

Returns:
See Also:

getMonStr

public java.lang.String getMonStr()
Method declaration

Returns:
See Also:

getMDay

public java.lang.String getMDay()
Method declaration

Returns:
See Also:

getJDay

public java.lang.String getJDay()
Method declaration

Returns:
See Also:

getHr

public java.lang.String getHr()
Method declaration

Returns:
See Also:

getMn

public java.lang.String getMn()
Method declaration

Returns:
See Also:

getIntMn

public int getIntMn()
get the int value for minutes into the day.

Returns:
int

getIntSec

public int getIntSec()
get the int value for seconds into the day.

Returns:
int

getIntHr

public int getIntHr()
get the int value for hour into the day.

Returns:
int

getSecond

public java.lang.String getSecond()
Method declaration

Returns:
See Also:

getMsecond

public java.lang.String getMsecond(int places)

getTenthsMillisecond

public java.lang.String getTenthsMillisecond()

getMSecond

public java.lang.String getMSecond()
Method declaration

Returns:
See Also:

isEvenMinute

public boolean isEvenMinute()
Method declaration

Returns:
See Also:

formatInt

public java.lang.String formatInt(java.lang.String item,
                                  int places)
forward pads in with zero's


getTimeZone

public java.util.TimeZone getTimeZone()

clear

public void clear()

main

public static void main(java.lang.String[] args)