public class TimeSeries extends Object implements Serializable, Cloneable
Constructor and Description |
---|
TimeSeries()
Constructor for TimeSeries.
|
Modifier and Type | Method and Description |
---|---|
long |
getDateIncrement()
Returns the date increment for this TimeSeries object.
|
Date[] |
getDates()
Returns the date array associated with the time series.
|
int |
getLength()
Returns the length of the time series.
|
int[][] |
getMissingIndicator()
Returns an array of missing value indicators.
|
int |
getNumberOfSeries()
Returns the number of series stored in this TimeSeries object.
|
int |
getNumMissing()
Returns the number of missing values.
|
double[][] |
getSeriesValues()
Returns the data values of the time series.
|
double[] |
getSeriesValues(int k)
Returns the data values of the k-th time series.
|
Date |
getStartDate()
Returns the starting date of the time series.
|
TimeZone |
getTimeZone()
Returns the time zone of the time series.
|
long |
getTimeZoneOffset()
Returns the number of hours (+ or -) from GMT of the time zone associated
with the time series.
|
boolean |
isDateIncrementInMillis()
Returns a boolean indicating whether or not the TimeSeries object has a
date increment expressed in milliseconds.
|
boolean |
isHasDates()
Returns a boolean indicating whether or not the TimeSeries has a non-null
dates attribute.
|
void |
setDateIncrement(int increment)
Sets the date increment in number of days.
|
void |
setDateIncrementInMillis(long incrementInMillis)
Sets the date increment in milliseconds.
|
void |
setDates()
Sets the date array using the start date and date increment.
|
void |
setDates(Date[] dateArray)
Sets the date array equal to user supplied dates.
|
void |
setSeriesValues(double[] y)
Sets the values of a univariate time series and initializes the time
index.
|
void |
setSeriesValues(double[][] y)
Sets the values of the TimeSeries.
|
void |
setSeriesValues(double[] y,
int numSeries)
Sets the values of a multivariate time series and initializes the time
index array.
|
void |
setStartDate(Date startDate)
Sets the start date of the series.
|
void |
setTimeZone(int offset)
Sets the time zone for the time series to the time zone associated with
the given offset from GMT.
|
void |
setTimeZone(int offset,
String id)
Sets the time zone for the time series using the offset and String id.
|
void |
setTimeZone(TimeZone tz)
Sets the time zone for the time series to the given TimeZone.
|
public void setSeriesValues(double[] y)
setStartDate
and the increment in days
can be set using setDateIncrement
or in milliseconds using
setDateIncrementInMillis
.y
- a double
array containing the numeric values of the
series. Missing values must be provided as NaN's.public void setSeriesValues(double[] y, int numSeries)
y
- a double
array containing the numeric values of the
series. It is assumed that the values are row-oriented, meaning that the
series index varies the fastest. Missing values must be provided as
Double.NaN
.numSeries
- an int
, the number of different series.public void setSeriesValues(double[][] y)
y
- a double
matrix containing the values of the time
series. The number of series is set to the number of columns of
y
. Missing values must be provided as
Double.NaN
.public void setStartDate(Date startDate)
startDate
- a Date
value, the date associated with the
first observation. The default start date is set to null
.public void setDateIncrement(int increment)
increment
- an int
value representing the number of
days between observations. By using increments, the time series is
presumed to be evenly spaced.public void setDateIncrementInMillis(long incrementInMillis)
incrementInMillis
- a long
value representing the
number of milliseconds between series values. By using increments, the
time series is presumed to be evenly spaced.public void setTimeZone(TimeZone tz)
tz
- a java.util.TimeZone
object.public void setTimeZone(int offset)
offset
- an int
representing the number of hours (+ or
-) difference from GMT.public void setTimeZone(int offset, String id)
offset
- an int
representing the number of hours (+ or
-) difference from GMT.id
- a String
representing the desired name of the time
zone. The provided id must be among the available ids, or else the first
element of TimeZone.getAvailableIDS(offset*60*60*1000)
will
be used.public int getLength()
int
, the length of the time seriespublic int getNumberOfSeries()
int
, the number of different seriespublic Date getStartDate()
Date
containing the first date of the seriespublic int getNumMissing()
A missing value is represented in the series by a Double.NaN
int
representing the number of missing values
detected in the time series.public int[][] getMissingIndicator()
A missing value is represented in the series by a
Double.NaN
.
int
matrix having the same dimension as the time
series where getMissingIndicator()[i][j]=1
if
y[i*numSeries+j]
or y[i][j]
is a missing value,
otherwise getMissingIndicator()[i][j]=0
.public boolean isHasDates()
boolean
. When true
, the dates
attribute is not null
.public boolean isDateIncrementInMillis()
true
the date
increment is considered to be expressed in milliseconds; otherwise, it is
assumed to be in the number of days.boolean
public long getDateIncrement()
long
, the date incrementpublic Date[] getDates()
See Java documentation on the Date class.
Date
array containing the dates of the seriespublic void setDates()
public void setDates(Date[] dateArray)
dateArray
- a Date
array containing the dates
associated with each value of the time seriespublic double[][] getSeriesValues()
double
matrix containing the values of the seriespublic double[] getSeriesValues(int k)
k
- an int
, the index of the time seriesdouble
array containing the values of the seriespublic TimeZone getTimeZone()
See Java documentation for the TimeZone class.
TimeZone
objectpublic long getTimeZoneOffset()
To convert to milliseconds, multiply by 60*60*1000. Note that the displayed time zone will be the name of the local time zone, despite what is set for the TimeSeries object. For further information, see the Examples provided and Java documentation on Date and Calendar classes.
long
value, the the number of hoursCopyright © 2020 Rogue Wave Software. All rights reserved.