public class RedshiftInterval extends RedshiftObject implements Serializable, Cloneable
type, value| Constructor and Description |
|---|
RedshiftInterval()
required by the driver.
|
RedshiftInterval(int years,
int months,
int days,
int hours,
int minutes,
double seconds)
Initializes all values of this interval to the specified values.
|
RedshiftInterval(String value)
Initialize a interval with a given interval string representation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Calendar cal)
Rolls this interval on a given calendar.
|
void |
add(Date date)
Rolls this interval on a given date.
|
void |
add(RedshiftInterval interval)
Add this interval's value to the passed interval.
|
Object |
clone()
This must be overidden to allow the object to be cloned.
|
boolean |
equals(Object obj)
Returns whether an object is equal to this one or not.
|
int |
getDays()
Returns the days represented by this interval.
|
int |
getHours()
Returns the hours represented by this interval.
|
int |
getMicroSeconds() |
int |
getMinutes()
Returns the minutes represented by this interval.
|
int |
getMonths()
Returns the months represented by this interval.
|
double |
getSeconds()
Returns the seconds represented by this interval.
|
String |
getValue()
Returns the stored interval information as a string.
|
int |
getWholeSeconds() |
int |
getYears()
Returns the years represented by this interval.
|
int |
hashCode()
Returns a hashCode for this object.
|
void |
scale(int factor)
Scale this interval by an integer factor.
|
void |
setDays(int days)
Set the days of this interval to the specified value.
|
void |
setHours(int hours)
Set the hours of this interval to the specified value.
|
void |
setMinutes(int minutes)
Set the minutes of this interval to the specified value.
|
void |
setMonths(int months)
Set the months of this interval to the specified value.
|
void |
setSeconds(double seconds)
Set the seconds of this interval to the specified value.
|
void |
setValue(int years,
int months,
int days,
int hours,
int minutes,
double seconds)
Set all values of this interval to the specified values.
|
void |
setValue(int month,
long time)
Set all values of this interval using just two specified values.
|
void |
setValue(String value)
Sets a interval string represented value to this instance.
|
void |
setYears(int years)
Set the years of this interval to the specified value.
|
long |
totalMicroseconds()
Converts the day-time part of interval to the total number of microseconds using
1day = 24hrs = 1440mins = 86400secs = 8.64e10microsecs.
|
int |
totalMonths()
Converts the month-year part of interval to the total number of months using 1year = 12months.
|
getType, setType, toStringpublic RedshiftInterval()
public RedshiftInterval(String value) throws SQLException
value - String representated interval (e.g. '3 years 2 mons')SQLException - Is thrown if the string representation has an unknown formatsetValue(String)public RedshiftInterval(int years,
int months,
int days,
int hours,
int minutes,
double seconds)
years - yearsmonths - monthsdays - dayshours - hoursminutes - minutesseconds - secondssetValue(int, int, int, int, int, double)public void setValue(String value) throws SQLException
setValue in class RedshiftObjectvalue - String representated interval (e.g. '3 years 2 mons')SQLException - Is thrown if the string representation has an unknown formatpublic void setValue(int years,
int months,
int days,
int hours,
int minutes,
double seconds)
years - yearsmonths - monthsdays - dayshours - hoursminutes - minutesseconds - secondspublic void setValue(int month,
long time)
month - Total number of months (assuming 12 months in a year)time - Total number of microseconds (assuming 1day = 24hrs = 1440mins = 86400secs = 8.64e10microsecs)public String getValue()
getValue in class RedshiftObjectpublic int getYears()
public void setYears(int years)
years - years to setpublic int getMonths()
public void setMonths(int months)
months - months to setpublic int getDays()
public void setDays(int days)
days - days to setpublic int getHours()
public void setHours(int hours)
hours - hours to setpublic int getMinutes()
public void setMinutes(int minutes)
minutes - minutes to setpublic double getSeconds()
public int getWholeSeconds()
public int getMicroSeconds()
public void setSeconds(double seconds)
seconds - seconds to setpublic void add(Calendar cal)
cal - Calendar instance to add topublic void add(Date date)
date - Date instance to add topublic void add(RedshiftInterval interval)
interval - intval to addpublic void scale(int factor)
factor - scale factorpublic int totalMonths()
public long totalMicroseconds()
public boolean equals(Object obj)
equals in class RedshiftObjectobj - Object to compare withpublic int hashCode()
hashCode in class RedshiftObjectpublic Object clone() throws CloneNotSupportedException
RedshiftObjectclone in class RedshiftObjectCloneNotSupportedExceptionCopyright © 2024 Amazon.com Inc.. All rights reserved.