Class ConstantRateSegment
- java.lang.Object
-
- jsl.modeling.elements.variable.nhpp.ConstantRateSegment
-
- All Implemented Interfaces:
RateSegmentIfc
public class ConstantRateSegment extends java.lang.Object implements RateSegmentIfc
-
-
Field Summary
Fields Modifier and Type Field Description protected double
crLL
the lower limit of the interval on cumulative rate scaleprotected double
crUL
the upper limit of the interval on the cumulative rate scaleprotected double
crWidth
the width of the interval on the cumulative rate scale (crWidth = crUL - crLL)protected double
rate
the rate for the intervalprotected double
tLL
the lower limit of the interval on the time scaleprotected double
tUL
the upper limit of the interval on the time scaleprotected double
tWidth
the width of the interval on the time scale (tWidth = tUL - tLL)
-
Constructor Summary
Constructors Constructor Description ConstantRateSegment(double crLower, double tLower, double duration, double rate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double time)
Returns true if the supplied time is within this rate segments time intervaldouble
getCumulativeRate(double time)
Returns the value of the cumulative rate function for the interval given a value of time within that intervaldouble
getCumulativeRateIntervalWidth()
The cumulative rate interval widthdouble
getCumulativeRateLowerLimit()
The lower limit on the cumulative rate axisdouble
getCumulativeRateUpperLimit()
The upper limit on the cumulative rate axisdouble
getInverseCumulativeRate(double cumRate)
Returns the inverse of the cumulative rate function given the interval and a cumulative rate value within that interval.double
getLowerTimeLimit()
The lower time limitdouble
getRate()
Returns the rate for the intervaldouble
getRate(double time)
Gets the rate for the time within the intervaldouble
getRateAtLowerTimeLimit()
The rate at the time that the time interval beginsdouble
getRateAtUpperTimeLimit()
The rate at the upper time limit is undefined Double.NaN.double
getTimeWidth()
The width of the intervaldouble
getUpperTimeLimit()
The upper time limitConstantRateSegment
newInstance()
Returns a new instance of the rate segmentvoid
setInterval(double tLower, double duration)
void
setRate(double crLower, double rate)
java.lang.String
toString()
-
-
-
Field Detail
-
rate
protected double rate
the rate for the interval
-
crWidth
protected double crWidth
the width of the interval on the cumulative rate scale (crWidth = crUL - crLL)
-
crLL
protected double crLL
the lower limit of the interval on cumulative rate scale
-
crUL
protected double crUL
the upper limit of the interval on the cumulative rate scale
-
tWidth
protected double tWidth
the width of the interval on the time scale (tWidth = tUL - tLL)
-
tLL
protected double tLL
the lower limit of the interval on the time scale
-
tUL
protected double tUL
the upper limit of the interval on the time scale
-
-
Constructor Detail
-
ConstantRateSegment
public ConstantRateSegment(double crLower, double tLower, double duration, double rate)
- Parameters:
crLower
- represents the cumulative rate at the beginning of the segment, must be >=0tLower
- represents the time at the beginning of the segment, must be >=0duration
- represents the time duration of the segment, must be >=0rate
- represents the rate for the time segment, must be 0 < rate <= infinity
-
-
Method Detail
-
newInstance
public ConstantRateSegment newInstance()
Description copied from interface:RateSegmentIfc
Returns a new instance of the rate segment- Specified by:
newInstance
in interfaceRateSegmentIfc
- Returns:
- a new instance of the rate segment
-
contains
public boolean contains(double time)
Description copied from interface:RateSegmentIfc
Returns true if the supplied time is within this rate segments time interval- Specified by:
contains
in interfaceRateSegmentIfc
- Parameters:
time
- the time to be evaluated- Returns:
- true if in the segment
-
setInterval
public final void setInterval(double tLower, double duration)
- Parameters:
tLower
- the lower time limit of the interval, must be > = 0duration
- the duration of the interval, must be > 0
-
setRate
public final void setRate(double crLower, double rate)
- Parameters:
crLower
- represents the cumulative rate at the beginning of the segment, must be >=0rate
- represents the rate for the time segment, must be 0 < rate < = infinity
-
getRate
public double getRate()
Returns the rate for the interval- Returns:
- the rate
-
getRate
public double getRate(double time)
Gets the rate for the time within the interval- Specified by:
getRate
in interfaceRateSegmentIfc
- Parameters:
time
- the time to evaluate- Returns:
- the rate at the time
-
getRateAtLowerTimeLimit
public double getRateAtLowerTimeLimit()
Description copied from interface:RateSegmentIfc
The rate at the time that the time interval begins- Specified by:
getRateAtLowerTimeLimit
in interfaceRateSegmentIfc
- Returns:
- The rate at the time that the time interval begins
-
getRateAtUpperTimeLimit
public double getRateAtUpperTimeLimit()
The rate at the upper time limit is undefined Double.NaN. The rate for the segment is constant throughout the interval but undefined at the end of the interval- Specified by:
getRateAtUpperTimeLimit
in interfaceRateSegmentIfc
- Returns:
- The rate at the time that the time interval ends
-
getLowerTimeLimit
public double getLowerTimeLimit()
The lower time limit- Specified by:
getLowerTimeLimit
in interfaceRateSegmentIfc
- Returns:
- The lower time limit
-
getUpperTimeLimit
public double getUpperTimeLimit()
The upper time limit- Specified by:
getUpperTimeLimit
in interfaceRateSegmentIfc
- Returns:
- The upper time limit
-
getTimeWidth
public double getTimeWidth()
The width of the interval- Specified by:
getTimeWidth
in interfaceRateSegmentIfc
- Returns:
- The width of the interval
-
getCumulativeRateLowerLimit
public double getCumulativeRateLowerLimit()
The lower limit on the cumulative rate axis- Specified by:
getCumulativeRateLowerLimit
in interfaceRateSegmentIfc
- Returns:
- The lower limit on the cumulative rate axis
-
getCumulativeRateUpperLimit
public double getCumulativeRateUpperLimit()
The upper limit on the cumulative rate axis- Specified by:
getCumulativeRateUpperLimit
in interfaceRateSegmentIfc
- Returns:
- The upper limit on the cumulative rate axis
-
getCumulativeRateIntervalWidth
public double getCumulativeRateIntervalWidth()
The cumulative rate interval width- Specified by:
getCumulativeRateIntervalWidth
in interfaceRateSegmentIfc
- Returns:
- The cumulative rate interval width
-
getCumulativeRate
public double getCumulativeRate(double time)
Returns the value of the cumulative rate function for the interval given a value of time within that interval- Specified by:
getCumulativeRate
in interfaceRateSegmentIfc
- Parameters:
time
- the time to be evaluated- Returns:
- cumulative rate at time t
-
getInverseCumulativeRate
public double getInverseCumulativeRate(double cumRate)
Returns the inverse of the cumulative rate function given the interval and a cumulative rate value within that interval. Returns a time- Specified by:
getInverseCumulativeRate
in interfaceRateSegmentIfc
- Parameters:
cumRate
- the rate to be evaluated- Returns:
- the inverse at the rate
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-