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, wait
forEach, spliterator
public 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 TimeDiscretization
public int getNumberOfTimeSteps()
getNumberOfTimeSteps
in interface TimeDiscretization
public double getTime(int timeIndex)
TimeDiscretization
getTime
in interface TimeDiscretization
timeIndex
- Time indexpublic double getTimeStep(int timeIndex)
TimeDiscretization
getTimeStep
in interface TimeDiscretization
timeIndex
- Time indexpublic int getTimeIndex(double time)
TimeDiscretization
getTimeIndex
in interface TimeDiscretization
time
- The time.public int getTimeIndexNearestLessOrEqual(double time)
TimeDiscretization
getTimeIndexNearestLessOrEqual
in interface TimeDiscretization
time
- Given time.public int getTimeIndexNearestGreaterOrEqual(double time)
TimeDiscretization
getTimeIndexNearestGreaterOrEqual
in interface TimeDiscretization
time
- Given time.public double[] getAsDoubleArray()
TimeDiscretization
double[]
.getAsDoubleArray
in interface TimeDiscretization
double[]
public ArrayList<Double> getAsArrayList()
TimeDiscretization
ArrayList<Double>
.
Note that this method is costly in terms of performance.getAsArrayList
in interface TimeDiscretization
ArrayList<Double>
public TimeDiscretization getTimeShiftedTimeDiscretization(double timeShift)
TimeDiscretization
getTimeShiftedTimeDiscretization
in interface TimeDiscretization
timeShift
- A time shift applied to all discretization points.public TimeDiscretization union(TimeDiscretization that)
TimeDiscretization
a.intersect(a.union(b))
might not be equal to a
.union
in interface TimeDiscretization
that
- Another time discretization containing points to add to the time discretization.public TimeDiscretization intersect(TimeDiscretization that)
TimeDiscretization
a.intersect(a.union(b))
might not be equal to a
.intersect
in interface TimeDiscretization
that
- Another time discretization containing points to add to the time discretization.public double getTickSize()
TimeDiscretization
getTickSize
in interface TimeDiscretization
Copyright © 2020. All rights reserved.