public class TimeDiscretization extends Object implements Serializable, TimeDiscretizationInterface
Modifier and Type | Class and Description |
---|---|
static class |
TimeDiscretization.ShortPeriodLocation |
Constructor and Description |
---|
TimeDiscretization(double... times)
Constructs a time discretization from a given set of doubles.
|
TimeDiscretization(Double[] times)
Constructs a time discretization from a given set of Doubles.
|
TimeDiscretization(Double[] times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretization(double initial,
double last,
double deltaT,
TimeDiscretization.ShortPeriodLocation shortPeriodLocation)
Constructs an equi-distant time discretization with stub periods at start or end.
|
TimeDiscretization(double initial,
int numberOfTimeSteps,
double deltaT)
Constructs an equi-distant time discretization with points timeDiscretization[i] being
for(i=0; i ≤ timeSteps; i++) timeDiscretization[i] = initial + i * deltaT; |
TimeDiscretization(DoubleStream times)
Constructs a time discretization from a (non closed and not necessarily sorted) stream of doubles.
|
TimeDiscretization(DoubleStream times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretization(Iterable<Double> times)
Constructs a time discretization from an iterable of doubles.
|
TimeDiscretization(Iterable<Double> times,
double tickSize)
Constructs a time discretization using the given tick size.
|
TimeDiscretization(Stream<Double> times)
Constructs a time discretization from a (non closed and not necessarily sorted) stream of boxed doubles.
|
TimeDiscretization(Stream<Double> times,
double tickSize)
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 : timeDiscretization[i] ≥ time
where timeDiscretization[i] ≤ timeDiscretization[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 : timeDiscretization[i] ≤ time
where timeDiscretization[i] ≤ timeDiscretization[j]).
|
TimeDiscretizationInterface |
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() |
TimeDiscretizationInterface |
intersect(TimeDiscretizationInterface that)
Returns the intersection of this time discretization with another one.
|
Iterator<Double> |
iterator() |
String |
toString() |
TimeDiscretizationInterface |
union(TimeDiscretizationInterface that)
Returns the union of this time discretization with another one.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public TimeDiscretization(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 TimeDiscretization(DoubleStream times)
times
- A double stream of time points for the time discretization.public TimeDiscretization(Stream<Double> 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 TimeDiscretization(Stream<Double> times)
times
- A double stream of time points for the time discretization.public TimeDiscretization(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 TimeDiscretization(Iterable<Double> times)
times
- The time to constitute the time discretization.public TimeDiscretization(double... times)
times
- Given array or arguments list of discretization points.public TimeDiscretization(Double[] times)
times
- Given boxed array of discretization points.public TimeDiscretization(Double[] times, double tickSize)
times
- Given boxed array of discretization points.tickSize
- A non-negative double representing the smallest time span distinguishable.public TimeDiscretization(double initial, int numberOfTimeSteps, double deltaT)
for(i=0; i ≤ timeSteps; i++) timeDiscretization[i] = initial + i * deltaT;
initial
- First discretization point.numberOfTimeSteps
- Number of time steps.deltaT
- Time step size.public TimeDiscretization(double initial, double last, double deltaT, TimeDiscretization.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 TimeDiscretizationInterface
public int getNumberOfTimeSteps()
getNumberOfTimeSteps
in interface TimeDiscretizationInterface
public double getTime(int timeIndex)
TimeDiscretizationInterface
getTime
in interface TimeDiscretizationInterface
timeIndex
- Time indexpublic double getTimeStep(int timeIndex)
TimeDiscretizationInterface
getTimeStep
in interface TimeDiscretizationInterface
timeIndex
- Time indexpublic int getTimeIndex(double time)
TimeDiscretizationInterface
getTimeIndex
in interface TimeDiscretizationInterface
time
- The time.public int getTimeIndexNearestLessOrEqual(double time)
TimeDiscretizationInterface
getTimeIndexNearestLessOrEqual
in interface TimeDiscretizationInterface
time
- Given time.public int getTimeIndexNearestGreaterOrEqual(double time)
TimeDiscretizationInterface
getTimeIndexNearestGreaterOrEqual
in interface TimeDiscretizationInterface
time
- Given time.public double[] getAsDoubleArray()
TimeDiscretizationInterface
double[]
.getAsDoubleArray
in interface TimeDiscretizationInterface
double[]
public ArrayList<Double> getAsArrayList()
TimeDiscretizationInterface
ArrayList<Double>
.
Note that this method is costly in terms of performance.getAsArrayList
in interface TimeDiscretizationInterface
ArrayList<Double>
public TimeDiscretizationInterface getTimeShiftedTimeDiscretization(double timeShift)
TimeDiscretizationInterface
getTimeShiftedTimeDiscretization
in interface TimeDiscretizationInterface
timeShift
- A time shift applied to all discretization points.public TimeDiscretizationInterface union(TimeDiscretizationInterface that)
TimeDiscretizationInterface
a.intersect(a.union(b))
might not be equal to a
.union
in interface TimeDiscretizationInterface
that
- Another time discretization containing points to add to the time discretization.public TimeDiscretizationInterface intersect(TimeDiscretizationInterface that)
TimeDiscretizationInterface
a.intersect(a.union(b))
might not be equal to a
.intersect
in interface TimeDiscretizationInterface
that
- Another time discretization containing points to add to the time discretization.public double getTickSize()
TimeDiscretizationInterface
getTickSize
in interface TimeDiscretizationInterface
Copyright © 2018. All rights reserved.