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 doublecrLLthe lower limit of the interval on cumulative rate scaleprotected doublecrULthe upper limit of the interval on the cumulative rate scaleprotected doublecrWidththe width of the interval on the cumulative rate scale (crWidth = crUL - crLL)protected doubleratethe rate for the intervalprotected doubletLLthe lower limit of the interval on the time scaleprotected doubletULthe upper limit of the interval on the time scaleprotected doubletWidththe 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 booleancontains(double time)Returns true if the supplied time is within this rate segments time intervaldoublegetCumulativeRate(double time)Returns the value of the cumulative rate function for the interval given a value of time within that intervaldoublegetCumulativeRateIntervalWidth()The cumulative rate interval widthdoublegetCumulativeRateLowerLimit()The lower limit on the cumulative rate axisdoublegetCumulativeRateUpperLimit()The upper limit on the cumulative rate axisdoublegetInverseCumulativeRate(double cumRate)Returns the inverse of the cumulative rate function given the interval and a cumulative rate value within that interval.doublegetLowerTimeLimit()The lower time limitdoublegetRate()Returns the rate for the intervaldoublegetRate(double time)Gets the rate for the time within the intervaldoublegetRateAtLowerTimeLimit()The rate at the time that the time interval beginsdoublegetRateAtUpperTimeLimit()The rate at the upper time limit is undefined Double.NaN.doublegetTimeWidth()The width of the intervaldoublegetUpperTimeLimit()The upper time limitConstantRateSegmentnewInstance()Returns a new instance of the rate segmentvoidsetInterval(double tLower, double duration)voidsetRate(double crLower, double rate)java.lang.StringtoString()
-
-
-
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:RateSegmentIfcReturns a new instance of the rate segment- Specified by:
newInstancein interfaceRateSegmentIfc- Returns:
- a new instance of the rate segment
-
contains
public boolean contains(double time)
Description copied from interface:RateSegmentIfcReturns true if the supplied time is within this rate segments time interval- Specified by:
containsin 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:
getRatein interfaceRateSegmentIfc- Parameters:
time- the time to evaluate- Returns:
- the rate at the time
-
getRateAtLowerTimeLimit
public double getRateAtLowerTimeLimit()
Description copied from interface:RateSegmentIfcThe rate at the time that the time interval begins- Specified by:
getRateAtLowerTimeLimitin 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:
getRateAtUpperTimeLimitin interfaceRateSegmentIfc- Returns:
- The rate at the time that the time interval ends
-
getLowerTimeLimit
public double getLowerTimeLimit()
The lower time limit- Specified by:
getLowerTimeLimitin interfaceRateSegmentIfc- Returns:
- The lower time limit
-
getUpperTimeLimit
public double getUpperTimeLimit()
The upper time limit- Specified by:
getUpperTimeLimitin interfaceRateSegmentIfc- Returns:
- The upper time limit
-
getTimeWidth
public double getTimeWidth()
The width of the interval- Specified by:
getTimeWidthin interfaceRateSegmentIfc- Returns:
- The width of the interval
-
getCumulativeRateLowerLimit
public double getCumulativeRateLowerLimit()
The lower limit on the cumulative rate axis- Specified by:
getCumulativeRateLowerLimitin interfaceRateSegmentIfc- Returns:
- The lower limit on the cumulative rate axis
-
getCumulativeRateUpperLimit
public double getCumulativeRateUpperLimit()
The upper limit on the cumulative rate axis- Specified by:
getCumulativeRateUpperLimitin interfaceRateSegmentIfc- Returns:
- The upper limit on the cumulative rate axis
-
getCumulativeRateIntervalWidth
public double getCumulativeRateIntervalWidth()
The cumulative rate interval width- Specified by:
getCumulativeRateIntervalWidthin 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:
getCumulativeRatein 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:
getInverseCumulativeRatein interfaceRateSegmentIfc- Parameters:
cumRate- the rate to be evaluated- Returns:
- the inverse at the rate
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-