|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mosaic.sim.neuron.PLFunction
This class represents a piecewise linear mathematical function in a finite timeframe with a finite number of linear segments. The linear segments are described by their gradients and their begin times and the whole function is defined to start at value 0 and time 0 with gradient 0. All gradients[i] are valid between the times gradientTimes[i] and gradientTimes[i+1]. Therefore the whole function is 0 in the interval [0, gradientTimes[0]]. The last segment, starting at time gradientTimes[numGradients] with gradient[numGradients] is defined to end at that time when the function reaches the value 0. This time can be retrieved by using the method getEndTime();
Inner Class Summary | |
class |
PLFunction.FloatIntPair
Aargh ! |
Field Summary | |
double[] |
gradients
The gradients of the linear segments. |
double[] |
gradientTimes
The begin times of the linear segments. |
Constructor Summary | |
PLFunction(int numSegments)
The default constructor initializes both arrays with the same length. |
Method Summary | |
double |
getEndTime()
Calculates and returns the time when the function reaches 0. |
double |
getEndTime(double startValue,
int numSegments)
Calculates and returns the time when the function, starting with the given startValue as offset and when restricted to the first numSegments segments, reaches 0. |
PLFunction.FloatIntPair |
getFinishedSegments(double time,
boolean untilNow)
|
PLFunction.FloatIntPair |
getFinishedSegments(double startValue,
int numSegments,
double time,
boolean untilNow)
Returns the value of the function at the time of last gradient change before the given simulation time (computing all linear segments that have ended before the current simulation time). |
double |
getValueAtTime(double startValue,
int numSegments,
double time)
Returns the value of the function at the given time, starting with the given startValue and taking numSegments into account. |
java.lang.String |
toString()
Returns the function as string. |
java.lang.String |
toString(int numSegments)
Returns the first numSegments linear segments of this function as string. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public double[] gradients
public double[] gradientTimes
Constructor Detail |
public PLFunction(int numSegments)
Method Detail |
public double getEndTime()
public double getEndTime(double startValue, int numSegments)
public PLFunction.FloatIntPair getFinishedSegments(double time, boolean untilNow)
getFinishedSegments(double startValue, int numSegments, double time, boolean untilNow)
public PLFunction.FloatIntPair getFinishedSegments(double startValue, int numSegments, double time, boolean untilNow)
startValue
- The start value to use.numSegments
- The number of segments that should be used.time
- The simulation time to be used.untilNow
- Specifies if segments that end exactly at the current
simulation time should also be taken into account.public double getValueAtTime(double startValue, int numSegments, double time)
startValue
- The start value to use.numSegments
- The number of segments that should be used.time
- The simulation time to be used.(double, int, double, boolean)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int numSegments)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |