public class TimeDiscretization extends Object implements Serializable, TimeDiscretizationInterface
Modifier and Type | Class and Description |
---|---|
static class |
TimeDiscretization.ShortPeriodLocation |
Constructor and Description |
---|
TimeDiscretization(ArrayList<Double> timeDiscretization)
Constructs a time discretization from a given ArrayList of Doubles.
|
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 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(Set<Double> times)
Constructs a time discretization from a given Set of Doubles.
|
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 |
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() |
Iterator<Double> |
iterator() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public TimeDiscretization(double... times)
times
- Given array or arguments list of discretization points.public TimeDiscretization(Double[] times)
times
- Given array or arguments list of discretization points.public TimeDiscretization(ArrayList<Double> timeDiscretization)
timeDiscretization
- Given ArrayList of discretization pointspublic TimeDiscretization(Set<Double> times)
times
- Given Set of discretization pointspublic 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.Copyright © 2015. All rights reserved.