public class TimeDiscretizationFromArray extends Object implements Serializable, TimeDiscretization
| Modifier and Type | Class and Description |
|---|---|
static class |
TimeDiscretizationFromArray.ShortPeriodLocation |
| Constructor and Description |
|---|
TimeDiscretizationFromArray(double... times)
Constructs a time discretization from a given set of doubles.
|
TimeDiscretizationFromArray(Double[] times)
Constructs a time discretization from a given set of Doubles.
|
TimeDiscretizationFromArray(Double[] times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(double initial,
double last,
double deltaT,
TimeDiscretizationFromArray.ShortPeriodLocation shortPeriodLocation)
Constructs an equi-distant time discretization with stub periods at start or end.
|
TimeDiscretizationFromArray(double initial,
int numberOfTimeSteps,
double deltaT)
Constructs an equi-distant time discretization with points timeDiscretizationFromArray[i] being
for(i=0; i ≤ timeSteps; i++) timeDiscretizationFromArray[i] = initial + i * deltaT; |
TimeDiscretizationFromArray(DoubleStream times)
Constructs a time discretization from a (non closed and not necessarily sorted) stream of doubles.
|
TimeDiscretizationFromArray(DoubleStream times,
boolean allowDuplicates)
Constructs a time discretization from a (non closed and not necessarily sorted) stream of doubles.
|
TimeDiscretizationFromArray(DoubleStream times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(DoubleStream times,
double tickSize,
boolean allowDuplicates)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(Iterable<Double> times)
Constructs a time discretization from an iterable of doubles.
|
TimeDiscretizationFromArray(Iterable<Double> times,
boolean allowDuplicates)
Constructs a time discretization from an iterable of doubles.
|
TimeDiscretizationFromArray(Iterable<Double> times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(Iterable<Double> times,
double tickSize,
boolean allowDuplicates)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(Stream<Double> times)
Constructs a time discretization from a (non closed and not necessarily sorted) stream of boxed doubles.
|
TimeDiscretizationFromArray(Stream<Double> times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretizationFromArray(Stream<Double> times,
double tickSize,
boolean allowDuplicates)
Constructs a time discretization using the given tick size.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
ArrayList<Double> |
getAsArrayList()
Return a clone of this time discretization as
ArrayList<Double>. |
double[] |
getAsDoubleArray()
Return a clone of this time discretization as
double[]. |
int |
getNumberOfTimes() |
int |
getNumberOfTimeSteps() |
double |
getTickSize()
Returns the smallest time span distinguishable in this time discretization.
|
double |
getTime(int timeIndex)
Returns the time for the given time index.
|
int |
getTimeIndex(double time)
Returns the time index for the given time.
|
int |
getTimeIndexNearestGreaterOrEqual(double time)
Returns the time index for the time in the time discretization which is the nearest
to the given time, being greater or equal (i.e. min(i : timeDiscretizationFromArray[i] ≥ time
where timeDiscretizationFromArray[i] ≤ timeDiscretizationFromArray[j]).
|
int |
getTimeIndexNearestLessOrEqual(double time)
Returns the time index for the time in the time discretization which is the nearest
to the given time, being less or equal (i.e. max(i : timeDiscretizationFromArray[i] ≤ time
where timeDiscretizationFromArray[i] ≤ timeDiscretizationFromArray[j]).
|
TimeDiscretization |
getTimeShiftedTimeDiscretization(double timeShift)
Return a new time discretization where all time points have been shifted by
a given time shift.
|
double |
getTimeStep(int timeIndex)
Returns the time step from the given time index to the next one.
|
int |
hashCode() |
TimeDiscretization |
intersect(TimeDiscretization that)
Returns the intersection of this time discretization with another one.
|
Iterator<Double> |
iterator() |
String |
toString() |
TimeDiscretization |
union(TimeDiscretization that)
Returns the union of this time discretization with another one.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic TimeDiscretizationFromArray(DoubleStream times, double tickSize, boolean allowDuplicates)
allowDuplicates is true, otherwise duplicate entries are removed.times - A non closed and not necessarily sorted stream containing the time points.tickSize - A non-negative double representing the smallest time span distinguishable.allowDuplicates - If true, the time discretization allows duplicate entries.public TimeDiscretizationFromArray(DoubleStream times, double tickSize)
times - A non closed and not necessarily sorted stream containing the time points.tickSize - A non-negative double representing the smallest time span distinguishable.public TimeDiscretizationFromArray(DoubleStream times, boolean allowDuplicates)
allowDuplicates is true, otherwise duplicate entries are removed.times - A double stream of time points for the time discretization.allowDuplicates - If true, the time discretization allows duplicate entries.public TimeDiscretizationFromArray(DoubleStream times)
times - A double stream of time points for the time discretization.public TimeDiscretizationFromArray(Stream<Double> times, double tickSize, boolean allowDuplicates)
times - A non closed and not necessarily sorted stream containing the time points.tickSize - A non-negative double representing the smallest time span distinguishable.allowDuplicates - If true, the time discretization allows duplicate entries.public TimeDiscretizationFromArray(Stream<Double> times, double tickSize)
allowDuplicates is true, otherwise duplicate entries are removed.times - A non closed and not necessarily sorted stream containing the time points.tickSize - A non-negative double representing the smallest time span distinguishable.public TimeDiscretizationFromArray(Stream<Double> times)
times - A double stream of time points for the time discretization.public TimeDiscretizationFromArray(Iterable<Double> times, double tickSize, boolean allowDuplicates)
times - The time to constitute the time discretization.tickSize - A non-negative double representing the smallest time span distinguishable.allowDuplicates - If true, the time discretization allows duplicate entries.public TimeDiscretizationFromArray(Iterable<Double> times, double tickSize)
times - The time to constitute the time discretization.tickSize - A non-negative double representing the smallest time span distinguishable.public TimeDiscretizationFromArray(Iterable<Double> times, boolean allowDuplicates)
times - The time to constitute the time discretization.allowDuplicates - If true, the time discretization allows duplicate entries.public TimeDiscretizationFromArray(Iterable<Double> times)
times - The time to constitute the time discretization.public TimeDiscretizationFromArray(double... times)
times - Given array or arguments list of discretization points.public TimeDiscretizationFromArray(Double[] times)
times - Given boxed array of discretization points.public TimeDiscretizationFromArray(Double[] times, double tickSize)
times - Given boxed array of discretization points.tickSize - A non-negative double representing the smallest time span distinguishable.public TimeDiscretizationFromArray(double initial,
int numberOfTimeSteps,
double deltaT)
for(i=0; i ≤ timeSteps; i++) timeDiscretizationFromArray[i] = initial + i * deltaT;initial - First discretization point.numberOfTimeSteps - Number of time steps.deltaT - Time step size.public TimeDiscretizationFromArray(double initial,
double last,
double deltaT,
TimeDiscretizationFromArray.ShortPeriodLocation shortPeriodLocation)
initial - First discretization point.last - Last time steps.deltaT - Time step size.shortPeriodLocation - Placement of the stub period.public int getNumberOfTimes()
getNumberOfTimes in interface TimeDiscretizationpublic int getNumberOfTimeSteps()
getNumberOfTimeSteps in interface TimeDiscretizationpublic double getTime(int timeIndex)
TimeDiscretizationgetTime in interface TimeDiscretizationtimeIndex - Time indexpublic double getTimeStep(int timeIndex)
TimeDiscretizationgetTimeStep in interface TimeDiscretizationtimeIndex - Time indexpublic int getTimeIndex(double time)
TimeDiscretizationgetTimeIndex in interface TimeDiscretizationtime - The time.public int getTimeIndexNearestLessOrEqual(double time)
TimeDiscretizationgetTimeIndexNearestLessOrEqual in interface TimeDiscretizationtime - Given time.public int getTimeIndexNearestGreaterOrEqual(double time)
TimeDiscretizationgetTimeIndexNearestGreaterOrEqual in interface TimeDiscretizationtime - Given time.public double[] getAsDoubleArray()
TimeDiscretizationdouble[].getAsDoubleArray in interface TimeDiscretizationdouble[]public ArrayList<Double> getAsArrayList()
TimeDiscretizationArrayList<Double>.
Note that this method is costly in terms of performance.getAsArrayList in interface TimeDiscretizationArrayList<Double>public TimeDiscretization getTimeShiftedTimeDiscretization(double timeShift)
TimeDiscretizationgetTimeShiftedTimeDiscretization in interface TimeDiscretizationtimeShift - A time shift applied to all discretization points.public TimeDiscretization union(TimeDiscretization that)
TimeDiscretizationa.intersect(a.union(b)) might not be equal to a.union in interface TimeDiscretizationthat - Another time discretization containing points to add to the time discretization.public TimeDiscretization intersect(TimeDiscretization that)
TimeDiscretizationa.intersect(a.union(b)) might not be equal to a.intersect in interface TimeDiscretizationthat - Another time discretization containing points to add to the time discretization.public double getTickSize()
TimeDiscretizationgetTickSize in interface TimeDiscretizationCopyright © 2019. All rights reserved.