Class Curve_Disco_Affine
- java.lang.Object
-
- org.networkcalculus.dnc.curves.disco.affine.Curve_Disco_Affine
-
- All Implemented Interfaces:
Curve
,Curve_Affine
- Direct Known Subclasses:
ArrivalCurve_Disco_Affine
,MaxServiceCurve_Disco_Affine
,ServiceCurve_Disco_Affine
public class Curve_Disco_Affine extends java.lang.Object implements Curve_Affine
Class representing a piecewise linear affine curve, defined on [0,inf), by at most two segments.
The curve is stored as an array ofLinearSegment
objects. Each of these objects defines a linear piece of the curve from one inflection point up to, but not including, the next. It is possible to define discontinuities by defining two subsequentLinearSegment
instances which start at the same inflection point. In this case, the second segment needs to haveleftopen
set totrue
to indicate that the inflection point is excluded from the second segment.
All arithmetic operations on a curve return a new instance of classCurve
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.networkcalculus.dnc.curves.Curve
Curve.CurveOperation
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
has_rate_latency_meta_info
protected boolean
has_token_bucket_meta_info
private static Curve_Disco_Affine
instance
protected boolean
is_delayed_infinite_burst
protected boolean
is_rate_latency
protected boolean
is_token_bucket
protected java.util.List<Curve_Disco_Affine>
rate_latencies
protected LinearSegment_Disco[]
segments
protected java.util.List<Curve_Disco_Affine>
token_buckets
-
Constructor Summary
Constructors Modifier Constructor Description protected
Curve_Disco_Affine()
Creates aCurve_Disco_Affine
instance with 1 segment of type LinearSegment.protected
Curve_Disco_Affine(int segment_count)
Creates aCurve_Disco_Affine
instance withsegment_count
number of
LinearSegment
.
protected
Curve_Disco_Affine(Curve curve)
Creates a copy of the passedCurve_Disco_Affine
instancecurve
.
-
Method Summary
Modifier and Type Method Description void
addSegment(int pos, LinearSegment s)
Adds aLinearSegment
at the locationpos
of the curve.
Note1: Segments after pos will be pushed back by one position.
Note2: It is the user's responsibility to add segments in the order of increasing x-coordinates.void
addSegment(LinearSegment s)
Adds aLinearSegment
to the end of the curve.
Note: It is the user's responsibility to add segments in the order of increasing x-coordinates.private void
clearMetaInfo()
Resets the rate latency and token bucket meta info.Curve_Disco_Affine
copy()
Returns a copy of this instance.void
copy(Curve curve)
ArrivalCurve_Disco_Affine
createArrivalCurve()
To create affine arrival curve with number of segments equal to one.ArrivalCurve_Disco_Affine
createArrivalCurve(int segment_count)
This creates an affine arrival curve with segments equal to the passed segment_countArrivalCurve_Disco_Affine
createArrivalCurve(java.lang.String arrival_curve_str)
This creates an affine arrival curve from the passed string representation of curve.ArrivalCurve_Disco_Affine
createArrivalCurve(Curve curve)
This creates an affine arrival curve from the passed curve.ArrivalCurve_Disco_Affine
createArrivalCurve(Curve curve, boolean remove_latency)
Curve_Disco_Affine
createCurve(java.util.List<LinearSegment> segments)
ServiceCurve_Disco_Affine
createDelayedInfiniteBurst(double delay)
Wrapper to create affine service curve with delay and infinite burst when delay is passed as double.ServiceCurve_Disco_Affine
createDelayedInfiniteBurst(Num delay)
This creates affine service curve with delay and infinite burst.MaxServiceCurve_Disco_Affine
createDelayedInfiniteBurstMSC(double delay)
A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with delay.MaxServiceCurve_Disco_Affine
createDelayedInfiniteBurstMSC(Num delay)
Create a MaxServiceCurve_Disco_Affine curve having infinite burst after a given delay.Curve_Disco_Affine
createHorizontal(Num y)
This creates an instance of Curve_Disco_Affine with rate 0 and burst equal to y.ArrivalCurve_Disco_Affine
createInfiniteArrivals()
MaxServiceCurve_Disco_Affine
createInfiniteMaxService()
A wrapper method to create delayed infinite curve for MaxServiceCurve_Disco_Affine.MaxServiceCurve_Disco_Affine
createMaxServiceCurve()
To create a MaxServiceCurve_Disco_Affine with one segment.MaxServiceCurve_Disco_Affine
createMaxServiceCurve(int segment_count)
Wrapper to create Max service curve DNC with segments equal to segment_count.MaxServiceCurve_Disco_Affine
createMaxServiceCurve(java.lang.String max_service_curve_str)
Wrapper to create Max service curve DNC from string representation.MaxServiceCurve_Disco_Affine
createMaxServiceCurve(Curve curve)
Wrapper method to create a Max service curve DNC from an existing curve.private void
createNewCurve(int segment_count)
Creates an affine curve with maximum of two segments.ArrivalCurve_Disco_Affine
createPeakArrivalRate(double rate)
Wrapper to create affine arrival curve with 0 burst and 0 latency.ArrivalCurve_Disco_Affine
createPeakArrivalRate(Num rate)
To create a affine arrival curve with 0 burst and 0 latency.ServiceCurve_Disco_Affine
createRateLatency(double rate, double latency)
Wrapper to create rate latency for the ServiceCurve_Disco_Affine with rate and latency passed as double.ServiceCurve_Disco_Affine
createRateLatency(Num rate, Num latency)
Wrapper to create rate latency for the ServiceCurve_Disco_Affine.MaxServiceCurve_Disco_Affine
createRateLatencyMSC(double rate, double latency)
A wrapper to create a service curve with rate latency with rate and latency represented in double.MaxServiceCurve_Disco_Affine
createRateLatencyMSC(Num rate, Num latency)
Create a service curve with a rate and a latency.ServiceCurve_Disco_Affine
createServiceCurve()
This creates an instance of affine service curve with number of segments equal to 1ServiceCurve_Disco_Affine
createServiceCurve(int segment_count)
This creates an instance of affine service curve with number of segments equal to passed segment_count.ServiceCurve_Disco_Affine
createServiceCurve(java.lang.String service_curve_str)
This creates an instance of affine service curve from the string representation of the curve.ServiceCurve_Disco_Affine
createServiceCurve(Curve curve)
This creates an instance of affine service curve same as the passed curve instance.ArrivalCurve_Disco_Affine
createTokenBucket(double rate, double burst)
To create a token bucket affine arrival curve.ArrivalCurve_Disco_Affine
createTokenBucket(Num rate, Num burst)
To create a token bucket affine arrival curve.ArrivalCurve_Disco_Affine
createZeroArrivals()
To create an affine arrival Curve with one segment.Curve_Disco_Affine
createZeroCurve()
This creates an instance of Curve_Disco_Affine with 1 segment.ServiceCurve_Disco_Affine
createZeroDelayInfiniteBurst()
Wrapper to create affine service curve with 0 delay and infinite burst.MaxServiceCurve_Disco_Affine
createZeroDelayInfiniteBurstMSC()
A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with zero delay.ServiceCurve_Disco_Affine
createZeroService()
This creates an affine service curve with one segment.private void
decomposeIntoRateLatencies()
Decomposes this curve into a list of rate latency curves and stores this list in the curve'srate_latencies
field.private void
decomposeIntoTokenBuckets()
Decomposes this curve into a list of token bucket curves and stores this list in the curve'stoken_buckets
field.boolean
equals(java.lang.Object obj)
To check whether this object instance is equal to the passing instance.Num
f(Num x)
Returns the function value at x-coordinatex
, ifx>=0
, andNaN
if not.Num
f_inv(Num y)
Returns the smallest x value at which the function value is equal toy
.Num
f_inv(Num y, boolean rightmost)
Returns the x value at which the function value is equal toy
.Num
fLimitRight(Num x)
Returns the limit to the right of the function value at x-coordinatex
, ifx>=0
, andNaN
if not.protected void
forceThroughOrigin()
Add a segment at 0,0 with grad 0 if its not present already If affine curve case, the first segment is always at 0,0 and with grad 0.Num
getBurst()
Returns the burst of the curve.static Curve_Disco_Affine
getFactory()
Returns an instance ofCurve_Disco_Affine
with one segment ofLinearSegment
.
Num
getGradientLimitRight(Num x)
Returns the gradient to the right of the function value at x-coordinatex
, ifx>=0
, andNaN
if not.Num
getLatency()
Returns the x-coordinate of the inflection point after which the function values are greater than zero.Curve_Disco_Affine
getRL_Component(int i)
Returns thei
the rate latency curve that this curve can be decomposed into.int
getRL_ComponentCount()
Returns the number of rate latency curves the curve can be decomposed into.java.util.List<Curve_Affine>
getRL_Components()
Returns the rate latency components of calling curve instance.boolean
getRL_Property()
Decomposes the curve into rate latency components and returns if its a rate latency curve.LinearSegment_Disco
getSegment(int pos)
Returns the segment at position pos (starting at 0).int
getSegmentCount()
Returns the number of segments in the curve.int
getSegmentDefining(Num x)
Returns the number of the segment that defines the function value at x-coordinatex
.private int
getSegmentFirstAtValue(Num y)
Returns the first segment at which the function reaches the valuey
.int
getSegmentLimitRight(Num x)
Returns the number of the segment that defines the value of the function when computing the limit to the right of the function at x-coordinatex
.Curve_Disco_Affine
getTB_Component(int i)
Returns thei
the token bucket curve that this curve can be decomposed into.int
getTB_ComponentCount()
Returns the number of token buckets the curve can be decomposed into.java.util.List<Curve_Affine>
getTB_Components()
Returns the token bucket components of the curve.Num
getUltAffineRate()
Returns the gradient of the last segment.int
hashCode()
To generate the hash code of a curve based on its segments.boolean
hasRateLatencyMetaInfo()
Returns weather the curve already has rate latency meta info or not.boolean
hasTokenBucketMetaInfo()
Returns weather the curve already has token bucket meta info or not.protected void
initializeCurve(java.lang.String curve_str)
boolean
isAlmostConcave()
Tests whether the curve is almost concave, i.e.boolean
isConcave()
Tests whether the curve is concave.boolean
isConcaveIn(Num a, Num b)
Tests whether the curve is concave in [a,b].boolean
isConvex()
Test whether the curve us convex.boolean
isConvexIn(Num a, Num b)
Tests whether the curve is convex in [a,b].boolean
isDelayedInfiniteBurst()
Returns whether or not the curve is delayed infinite burstboolean
isDiscontinuity(int pos)
Returns whether the inflection point is a (real or unreal) discontinuity.boolean
isRateLatency()
Verifies weather the curve is a rate latency curve or not and decomposes the curve into rate latency components if it is a rate latency curve.boolean
isRealDiscontinuity(int pos)
Returns whether the inflection point is a real discontinuity, i.e.boolean
isTokenBucket()
Verifies weather the curve is a token bucket or not Decomposes the curve into token bucket components if it is a token bucket curve.boolean
isUnrealDiscontinuity(int pos)
Returns whether the inflection point is an unreal discontinuity, i.e.boolean
isWideSenseIncreasing()
Tests whether the curve is wide-sense increasing.private void
makeDelayedInfiniteBurst(Curve_Disco_Affine c_dnc, Num delay)
Create a curve with infinite burst.private void
makeHorizontal(Curve_Disco_Affine c_dnc, Num y)
Create a curve with rate 0 and burst y, i.e.private void
makePeakRate(Curve_Disco_Affine c_dnc, Num rate)
To create a curve which had no burst and latency.private void
makeRateLatency(Curve_Disco_Affine c_dnc, Num rate, Num latency)
Create a rate latency curve based on the passed rate and latency.private void
makeTokenBucket(Curve_Disco_Affine c_dnc, Num rate, Num burst)
Create a token bucket affine curve based on the passed rate and burst.void
removeSegment(int pos)
Removes the segment at positionpos
.void
setRateLateny(boolean is_rate_latency)
Setter method for the flag is_rate_latency.void
setRL_Components(java.util.List<Curve> rate_latencies)
Updates the rate_latencies of the calling object with the passed rate_latencies.void
setRL_MetaInfo(boolean has_rate_latency_meta_info)
Sets the has_rate_latency_meta_info to the passed arguments.void
setSegment(int pos, LinearSegment s)
Insets the segment at position pos.protected void
setSegments(LinearSegment[] segments)
Setting the this.segments to the passes segments Note: Since this is an affine curve, the segments count of passed segment cannot exceed two.void
setTB_Components(java.util.List<Curve> token_buckets)
Updates the token_buckets of the calling object with the passed token_buckets components.void
setTB_MetaInfo(boolean has_token_bucket_meta_info)
Update the has_token_bucket_meta_info of the calling object to the passed argument.void
setTokenBucket(boolean is_token_bucket)
Setter method for is_token_bucket flag.java.lang.String
toString()
Returns a string representation of this curve.
-
-
-
Field Detail
-
instance
private static Curve_Disco_Affine instance
-
segments
protected LinearSegment_Disco[] segments
-
is_delayed_infinite_burst
protected boolean is_delayed_infinite_burst
-
is_rate_latency
protected boolean is_rate_latency
-
has_rate_latency_meta_info
protected boolean has_rate_latency_meta_info
-
rate_latencies
protected java.util.List<Curve_Disco_Affine> rate_latencies
-
is_token_bucket
protected boolean is_token_bucket
-
has_token_bucket_meta_info
protected boolean has_token_bucket_meta_info
-
token_buckets
protected java.util.List<Curve_Disco_Affine> token_buckets
-
-
Constructor Detail
-
Curve_Disco_Affine
protected Curve_Disco_Affine()
Creates aCurve_Disco_Affine
instance with 1 segment of type LinearSegment.
-
Curve_Disco_Affine
protected Curve_Disco_Affine(Curve curve)
Creates a copy of the passedCurve_Disco_Affine
instancecurve
.
-
Curve_Disco_Affine
protected Curve_Disco_Affine(int segment_count)
Creates aCurve_Disco_Affine
instance withsegment_count
number of
LinearSegment
.
- Parameters:
segment_count
- Number of segments in the curve. In case of affine curve, at max the number of segments can be two.
-
-
Method Detail
-
getFactory
public static Curve_Disco_Affine getFactory()
Returns an instance ofCurve_Disco_Affine
with one segment ofLinearSegment
.
- Returns:
- An instance of
Curve_Disco_Affine
-
isRateLatency
public boolean isRateLatency()
Verifies weather the curve is a rate latency curve or not and decomposes the curve into rate latency components if it is a rate latency curve.- Specified by:
isRateLatency
in interfaceCurve_Affine
- Returns:
is_rate_latency
Returns weather the give curve is rate latency curve or not.
-
isTokenBucket
public boolean isTokenBucket()
Verifies weather the curve is a token bucket or not Decomposes the curve into token bucket components if it is a token bucket curve.- Specified by:
isTokenBucket
in interfaceCurve_Affine
- Returns:
is_token_bucket
-
hasRateLatencyMetaInfo
public boolean hasRateLatencyMetaInfo()
Returns weather the curve already has rate latency meta info or not.- Returns:
- <>code>has_rate_latency_meta_info<>code> Returns weather or not the give curve has rate latency meta info.
-
setRL_MetaInfo
public void setRL_MetaInfo(boolean has_rate_latency_meta_info)
Sets the has_rate_latency_meta_info to the passed arguments.- Specified by:
setRL_MetaInfo
in interfaceCurve
- Parameters:
has_rate_latency_meta_info
- A boolean which tells weather the curve has rate latency meta info or not.
-
getRL_Components
public java.util.List<Curve_Affine> getRL_Components()
Returns the rate latency components of calling curve instance.- Returns:
- tmp List of type CurveAffine
-
setRL_Components
public void setRL_Components(java.util.List<Curve> rate_latencies)
Updates the rate_latencies of the calling object with the passed rate_latencies.- Specified by:
setRL_Components
in interfaceCurve
- Parameters:
rate_latencies
- List of Curves each of which represent a rate latency component.
-
hasTokenBucketMetaInfo
public boolean hasTokenBucketMetaInfo()
Returns weather the curve already has token bucket meta info or not.- Returns:
- has_token_bucket_meta_info Weather or not the give curve has token bucket meta info.
-
setTB_MetaInfo
public void setTB_MetaInfo(boolean has_token_bucket_meta_info)
Update the has_token_bucket_meta_info of the calling object to the passed argument.- Specified by:
setTB_MetaInfo
in interfaceCurve
- Parameters:
has_token_bucket_meta_info
-
-
getTB_Components
public java.util.List<Curve_Affine> getTB_Components()
Returns the token bucket components of the curve.- Returns:
- tmp A list of Tocken bucket components Note: In this can it should be only one
-
setTB_Components
public void setTB_Components(java.util.List<Curve> token_buckets)
Updates the token_buckets of the calling object with the passed token_buckets components.- Specified by:
setTB_Components
in interfaceCurve
- Parameters:
token_buckets
- List of Curves, each of them representing a token bucket component. Note: In this case, at max there can be only one token bucket component.
-
createNewCurve
private void createNewCurve(int segment_count)
Creates an affine curve with maximum of two segments.- Parameters:
segment_count
- Number of segments to be created.
-
initializeCurve
protected void initializeCurve(java.lang.String curve_str) throws java.lang.Exception
- Throws:
java.lang.Exception
-
forceThroughOrigin
protected void forceThroughOrigin()
Add a segment at 0,0 with grad 0 if its not present already If affine curve case, the first segment is always at 0,0 and with grad 0.
-
clearMetaInfo
private void clearMetaInfo()
Resets the rate latency and token bucket meta info.
-
copy
public Curve_Disco_Affine copy()
Returns a copy of this instance.- Specified by:
copy
in interfaceCurve
- Specified by:
copy
in interfaceCurve_Affine
- Returns:
- c_copy A copy of this instance.
-
copy
public void copy(Curve curve)
- Specified by:
copy
in interfaceCurve
- Specified by:
copy
in interfaceCurve_Affine
-
getSegment
public LinearSegment_Disco getSegment(int pos)
Returns the segment at position pos (starting at 0).- Specified by:
getSegment
in interfaceCurve
- Parameters:
pos
- The position of segment in the curve to be fetched. Note: In this case, the position can be either 0 or 1.- Returns:
-
getSegmentCount
public int getSegmentCount()
Returns the number of segments in the curve. At max this can be two.- Specified by:
getSegmentCount
in interfaceCurve
- Returns:
- segments.length Total number of segments in the curve
-
getSegmentDefining
public int getSegmentDefining(Num x)
Returns the number of the segment that defines the function value at x-coordinatex
. The number of the segment is usually the same as the one returned bygetSegmentLimitRight(x)
, except for if a segment starts atx
and is left-open. In this case the function returns the previous segment, rather than the current segment, as the previous segment definesx
.- Specified by:
getSegmentDefining
in interfaceCurve
- Parameters:
x
- The x-coordinate- Returns:
- i or -1 The index of the segment into the array.
-
getSegmentLimitRight
public int getSegmentLimitRight(Num x)
Returns the number of the segment that defines the value of the function when computing the limit to the right of the function at x-coordinatex
. The number of the segment is usually the same as the one returned bygetSegmentDefining(x)
, except for if a segment starts atx
and is left-open. In this case the function returns the current segment, rather than the previous segment.- Parameters:
x
- The x-coordinate- Returns:
- i or -1 The index of the segment into the array.
-
setSegment
public void setSegment(int pos, LinearSegment s)
Insets the segment at position pos.- Parameters:
pos
- The position at which the segment s has to be inserted.s
- The linear segment to be inserted
-
setSegments
protected void setSegments(LinearSegment[] segments)
Setting the this.segments to the passes segments Note: Since this is an affine curve, the segments count of passed segment cannot exceed two.- Parameters:
segments
- Segments to be set to this.segments
-
addSegment
public void addSegment(LinearSegment s)
Adds aLinearSegment
to the end of the curve.
Note: It is the user's responsibility to add segments in the order of increasing x-coordinates.- Specified by:
addSegment
in interfaceCurve
- Parameters:
s
- the segment to be added.
-
addSegment
public void addSegment(int pos, LinearSegment s)
Adds aLinearSegment
at the locationpos
of the curve.
Note1: Segments after pos will be pushed back by one position.
Note2: It is the user's responsibility to add segments in the order of increasing x-coordinates.- Specified by:
addSegment
in interfaceCurve
- Parameters:
pos
- the index into the segment array to add the new segment.s
- the segment to be added.
-
removeSegment
public void removeSegment(int pos)
Removes the segment at positionpos
.- Specified by:
removeSegment
in interfaceCurve
- Parameters:
pos
- The index of the segment to be removed.
-
isDiscontinuity
public boolean isDiscontinuity(int pos)
Returns whether the inflection point is a (real or unreal) discontinuity.- Specified by:
isDiscontinuity
in interfaceCurve
- Parameters:
pos
- the index of the IP- Returns:
true
if the IP is a discontinuity,false
if not.
-
isRealDiscontinuity
public boolean isRealDiscontinuity(int pos)
Returns whether the inflection point is a real discontinuity, i.e. the y0 of the leftopen segment differs from the previous one.- Specified by:
isRealDiscontinuity
in interfaceCurve
- Parameters:
pos
- the index of the IP- Returns:
true
if the IP is a real discontinuity,false
if not.
-
isUnrealDiscontinuity
public boolean isUnrealDiscontinuity(int pos)
Returns whether the inflection point is an unreal discontinuity, i.e. the y0 of the leftopen segment is coincident with the y0 of the previous segment and therefore the unreal discontinuity may safely be removed.- Specified by:
isUnrealDiscontinuity
in interfaceCurve
- Parameters:
pos
- the index of the IP- Returns:
true
if the IP is an unreal discontinuity,false
if not.
-
isWideSenseIncreasing
public boolean isWideSenseIncreasing()
Tests whether the curve is wide-sense increasing.- Specified by:
isWideSenseIncreasing
in interfaceCurve
- Returns:
- True/False whether the curve is wide-sense increasing.
-
isConvex
public boolean isConvex()
Test whether the curve us convex.
-
isConvexIn
public boolean isConvexIn(Num a, Num b)
Tests whether the curve is convex in [a,b].- Specified by:
isConvexIn
in interfaceCurve
- Parameters:
a
- the lower bound of the test interval.b
- the upper bound of the test interval.- Returns:
- whether the curve is convex.
-
isConcave
public boolean isConcave()
Tests whether the curve is concave.
-
isConcaveIn
public boolean isConcaveIn(Num a, Num b)
Tests whether the curve is concave in [a,b].- Specified by:
isConcaveIn
in interfaceCurve
- Parameters:
a
- the lower bound of the test interval.b
- the upper bound of the test interval.- Returns:
- whether the curve is concave.
-
isAlmostConcave
public boolean isAlmostConcave()
Tests whether the curve is almost concave, i.e. it is concave once its function value is larger than 0.- Specified by:
isAlmostConcave
in interfaceCurve
- Returns:
- whether the curve is almost concave.
-
equals
public boolean equals(java.lang.Object obj)
To check whether this object instance is equal to the passing instance.
-
hashCode
public int hashCode()
To generate the hash code of a curve based on its segments.
-
toString
public java.lang.String toString()
Returns a string representation of this curve.
-
fLimitRight
public Num fLimitRight(Num x)
Returns the limit to the right of the function value at x-coordinatex
, ifx>=0
, andNaN
if not.- Specified by:
fLimitRight
in interfaceCurve
- Parameters:
x
- The x-coordinate- Returns:
- The function value.
-
f_inv
public Num f_inv(Num y)
Returns the smallest x value at which the function value is equal toy
.
-
f_inv
public Num f_inv(Num y, boolean rightmost)
Returns the x value at which the function value is equal toy
. Ifrightmost
istrue
, returns the rightmost x-coordinate, otherwise the leftmost coordinate.
-
getSegmentFirstAtValue
private int getSegmentFirstAtValue(Num y)
Returns the first segment at which the function reaches the valuey
. It returns -1 if the curve never reaches this value.- Parameters:
y
- The y-coordinate- Returns:
- The segment number.
-
getLatency
public Num getLatency()
Returns the x-coordinate of the inflection point after which the function values are greater than zero.- Specified by:
getLatency
in interfaceCurve
- Returns:
- The latency of this curve.
-
getBurst
public Num getBurst()
Returns the burst of the curve.
-
getGradientLimitRight
public Num getGradientLimitRight(Num x)
Returns the gradient to the right of the function value at x-coordinatex
, ifx>=0
, andNaN
if not.- Specified by:
getGradientLimitRight
in interfaceCurve
- Parameters:
x
- The x-coordinate- Returns:
- The function value.
-
getUltAffineRate
public Num getUltAffineRate()
Returns the gradient of the last segment.- Specified by:
getUltAffineRate
in interfaceCurve
- Returns:
- The rate of the ultimately affine part.
-
isDelayedInfiniteBurst
public boolean isDelayedInfiniteBurst()
Returns whether or not the curve is delayed infinite burst- Specified by:
isDelayedInfiniteBurst
in interfaceCurve
- Returns:
- is_delayed_infinite_burst Returns True if the curve is delayed infinite burst otherwise false.
-
getRL_Property
public boolean getRL_Property()
Decomposes the curve into rate latency components and returns if its a rate latency curve.- Returns:
- is_rate_latency Returns true if the curve has one rate latency component otherwise false.
-
setRateLateny
public void setRateLateny(boolean is_rate_latency)
Setter method for the flag is_rate_latency.- Specified by:
setRateLateny
in interfaceCurve
- Parameters:
is_rate_latency
- Boolean to be set.
-
getRL_ComponentCount
public int getRL_ComponentCount()
Returns the number of rate latency curves the curve can be decomposed into.- Specified by:
getRL_ComponentCount
in interfaceCurve
- Returns:
- The number of rate latency curves.
-
getRL_Component
public Curve_Disco_Affine getRL_Component(int i)
Returns thei
the rate latency curve that this curve can be decomposed into.- Specified by:
getRL_Component
in interfaceCurve
- Parameters:
i
- The number of the rate latency curve.- Returns:
- The rate latency curve
-
decomposeIntoRateLatencies
private void decomposeIntoRateLatencies()
Decomposes this curve into a list of rate latency curves and stores this list in the curve'srate_latencies
field.
-
setTokenBucket
public void setTokenBucket(boolean is_token_bucket)
Setter method for is_token_bucket flag.- Specified by:
setTokenBucket
in interfaceCurve
- Parameters:
is_token_bucket
- Boolean representing weather or not its token bucket.
-
getTB_ComponentCount
public int getTB_ComponentCount()
Returns the number of token buckets the curve can be decomposed into. Note: In this case, it can be maximum 1- Specified by:
getTB_ComponentCount
in interfaceCurve
- Returns:
- The number of token buckets
-
getTB_Component
public Curve_Disco_Affine getTB_Component(int i)
Returns thei
the token bucket curve that this curve can be decomposed into.- Specified by:
getTB_Component
in interfaceCurve
- Parameters:
i
- The number of the token bucket- Returns:
- The token bucket
-
decomposeIntoTokenBuckets
private void decomposeIntoTokenBuckets()
Decomposes this curve into a list of token bucket curves and stores this list in the curve'stoken_buckets
field.
-
createCurve
public Curve_Disco_Affine createCurve(java.util.List<LinearSegment> segments)
- Specified by:
createCurve
in interfaceCurve
- Returns:
-
createZeroCurve
public Curve_Disco_Affine createZeroCurve()
This creates an instance of Curve_Disco_Affine with 1 segment.- Specified by:
createZeroCurve
in interfaceCurve
- Returns:
- An instance of Curve_Disco_Affine
-
createHorizontal
public Curve_Disco_Affine createHorizontal(Num y)
This creates an instance of Curve_Disco_Affine with rate 0 and burst equal to y. ie a horizontal curve- Specified by:
createHorizontal
in interfaceCurve
- Parameters:
y
- The burst value- Returns:
- c_dnc An instance of Curve_Disco_Affine
-
createServiceCurve
public ServiceCurve_Disco_Affine createServiceCurve()
This creates an instance of affine service curve with number of segments equal to 1- Specified by:
createServiceCurve
in interfaceCurve
- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createServiceCurve
public ServiceCurve_Disco_Affine createServiceCurve(int segment_count)
This creates an instance of affine service curve with number of segments equal to passed segment_count.- Specified by:
createServiceCurve
in interfaceCurve
- Parameters:
segment_count
- The number of segments to be created.- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createServiceCurve
public ServiceCurve_Disco_Affine createServiceCurve(java.lang.String service_curve_str) throws java.lang.Exception
This creates an instance of affine service curve from the string representation of the curve.- Specified by:
createServiceCurve
in interfaceCurve
- Parameters:
service_curve_str
- The string representation of curve.- Returns:
- An instance of ServiceCurve_Disco_Affine.
- Throws:
java.lang.Exception
-
createServiceCurve
public ServiceCurve_Disco_Affine createServiceCurve(Curve curve)
This creates an instance of affine service curve same as the passed curve instance.- Specified by:
createServiceCurve
in interfaceCurve
- Parameters:
curve
- An instance of Curve.- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createZeroService
public ServiceCurve_Disco_Affine createZeroService()
This creates an affine service curve with one segment.- Specified by:
createZeroService
in interfaceCurve
- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createZeroDelayInfiniteBurst
public ServiceCurve_Disco_Affine createZeroDelayInfiniteBurst()
Wrapper to create affine service curve with 0 delay and infinite burst.- Specified by:
createZeroDelayInfiniteBurst
in interfaceCurve
- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createDelayedInfiniteBurst
public ServiceCurve_Disco_Affine createDelayedInfiniteBurst(double delay)
Wrapper to create affine service curve with delay and infinite burst when delay is passed as double.- Specified by:
createDelayedInfiniteBurst
in interfaceCurve
- Parameters:
delay
- The delay in the rate- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createDelayedInfiniteBurst
public ServiceCurve_Disco_Affine createDelayedInfiniteBurst(Num delay)
This creates affine service curve with delay and infinite burst.- Specified by:
createDelayedInfiniteBurst
in interfaceCurve
- Parameters:
delay
- The delay in the rate.- Returns:
- sc_dnc An instance of ServiceCurve_Disco_Affine.
-
createRateLatency
public ServiceCurve_Disco_Affine createRateLatency(double rate, double latency)
Wrapper to create rate latency for the ServiceCurve_Disco_Affine with rate and latency passed as double.- Specified by:
createRateLatency
in interfaceCurve
- Parameters:
rate
- The rate of the curve.latency
- The latency of the curve.- Returns:
- An instance of ServiceCurve_Disco_Affine.
-
createRateLatency
public ServiceCurve_Disco_Affine createRateLatency(Num rate, Num latency)
Wrapper to create rate latency for the ServiceCurve_Disco_Affine.- Specified by:
createRateLatency
in interfaceCurve
- Parameters:
rate
- The rate of the curve.latency
- The latency of the curve.- Returns:
- sc_dnc An instance of ServiceCurve_Disco_Affine.
-
createArrivalCurve
public ArrivalCurve_Disco_Affine createArrivalCurve()
To create affine arrival curve with number of segments equal to one.- Specified by:
createArrivalCurve
in interfaceCurve
- Returns:
- An instance of ArrivalCurve_Disco_Affine.
-
createArrivalCurve
public ArrivalCurve_Disco_Affine createArrivalCurve(int segment_count)
This creates an affine arrival curve with segments equal to the passed segment_count- Specified by:
createArrivalCurve
in interfaceCurve
- Parameters:
segment_count
- The number of segments to be created for the affine arrival curve- Returns:
- An instance of ArrivalCurve_Disco_Affine
-
createArrivalCurve
public ArrivalCurve_Disco_Affine createArrivalCurve(java.lang.String arrival_curve_str) throws java.lang.Exception
This creates an affine arrival curve from the passed string representation of curve.- Specified by:
createArrivalCurve
in interfaceCurve
- Parameters:
arrival_curve_str
- A string representation of the curve.- Returns:
- An instance of ArrivalCurve_Disco_Affine.
- Throws:
java.lang.Exception
-
createArrivalCurve
public ArrivalCurve_Disco_Affine createArrivalCurve(Curve curve)
This creates an affine arrival curve from the passed curve.- Specified by:
createArrivalCurve
in interfaceCurve
- Parameters:
curve
- An instance of the type Curve.- Returns:
- An instance of ArrivalCurve_Disco_Affine.
-
createArrivalCurve
public ArrivalCurve_Disco_Affine createArrivalCurve(Curve curve, boolean remove_latency)
- Specified by:
createArrivalCurve
in interfaceCurve
- Returns:
-
createZeroArrivals
public ArrivalCurve_Disco_Affine createZeroArrivals()
To create an affine arrival Curve with one segment.- Specified by:
createZeroArrivals
in interfaceCurve
- Returns:
- An instance of ArrivalCurve_Disco_Affine.
-
createInfiniteArrivals
public ArrivalCurve_Disco_Affine createInfiniteArrivals()
- Specified by:
createInfiniteArrivals
in interfaceCurve
-
createPeakArrivalRate
public ArrivalCurve_Disco_Affine createPeakArrivalRate(double rate)
Wrapper to create affine arrival curve with 0 burst and 0 latency.- Specified by:
createPeakArrivalRate
in interfaceCurve
- Parameters:
rate
- The rate of the curve to be created.- Returns:
- An instance of ArrivalCurve_Disco_Affine.
-
createPeakArrivalRate
public ArrivalCurve_Disco_Affine createPeakArrivalRate(Num rate)
To create a affine arrival curve with 0 burst and 0 latency.- Specified by:
createPeakArrivalRate
in interfaceCurve
- Parameters:
rate
- The rate of the curve to be created.- Returns:
- ac_dnc An instance of ArrivalCurve_Disco_Affine.
-
createTokenBucket
public ArrivalCurve_Disco_Affine createTokenBucket(double rate, double burst)
To create a token bucket affine arrival curve.- Specified by:
createTokenBucket
in interfaceCurve
- Parameters:
rate
- The rate of the affine curve.burst
- The burst of the affine curve.- Returns:
- ac_dnc An instance of ArrivalCurve_Disco_Affine with token bucket.
-
createTokenBucket
public ArrivalCurve_Disco_Affine createTokenBucket(Num rate, Num burst)
To create a token bucket affine arrival curve.- Specified by:
createTokenBucket
in interfaceCurve
- Parameters:
rate
- The rate of the affine curve.burst
- The burst of the affine curve.- Returns:
- ac_dnc An instance of ArrivalCurve_Disco_Affine with token bucket.
-
createMaxServiceCurve
public MaxServiceCurve_Disco_Affine createMaxServiceCurve()
To create a MaxServiceCurve_Disco_Affine with one segment.- Specified by:
createMaxServiceCurve
in interfaceCurve
- Returns:
- An instance of MaxServiceCurve_Disco_Affine.
-
createMaxServiceCurve
public MaxServiceCurve_Disco_Affine createMaxServiceCurve(int segment_count)
Wrapper to create Max service curve DNC with segments equal to segment_count.- Specified by:
createMaxServiceCurve
in interfaceCurve
- Parameters:
segment_count
- The number of segments to be created for this curve instance. Note: In this case, it cannot be more than two.- Returns:
-
createMaxServiceCurve
public MaxServiceCurve_Disco_Affine createMaxServiceCurve(java.lang.String max_service_curve_str) throws java.lang.Exception
Wrapper to create Max service curve DNC from string representation.- Specified by:
createMaxServiceCurve
in interfaceCurve
- Parameters:
max_service_curve_str
- The string representation of the curve.- Returns:
- An instance of MaxServiceCurve_Disco_Affine.
- Throws:
java.lang.Exception
-
createMaxServiceCurve
public MaxServiceCurve_Disco_Affine createMaxServiceCurve(Curve curve)
Wrapper method to create a Max service curve DNC from an existing curve.- Specified by:
createMaxServiceCurve
in interfaceCurve
- Parameters:
curve
-- Returns:
- An instance of MaxServiceCurve_Disco_Affine.
-
createInfiniteMaxService
public MaxServiceCurve_Disco_Affine createInfiniteMaxService()
A wrapper method to create delayed infinite curve for MaxServiceCurve_Disco_Affine.- Returns:
-
createZeroDelayInfiniteBurstMSC
public MaxServiceCurve_Disco_Affine createZeroDelayInfiniteBurstMSC()
A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with zero delay.- Specified by:
createZeroDelayInfiniteBurstMSC
in interfaceCurve
- Returns:
- An instance of MaxServiceCurve_Disco_Affine.
-
createDelayedInfiniteBurstMSC
public MaxServiceCurve_Disco_Affine createDelayedInfiniteBurstMSC(double delay)
A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with delay.- Specified by:
createDelayedInfiniteBurstMSC
in interfaceCurve
- Parameters:
delay
- The latency of the affine curve.- Returns:
- An instance of MaxServiceCurve_Disco_Affine.
-
createDelayedInfiniteBurstMSC
public MaxServiceCurve_Disco_Affine createDelayedInfiniteBurstMSC(Num delay)
Create a MaxServiceCurve_Disco_Affine curve having infinite burst after a given delay.- Specified by:
createDelayedInfiniteBurstMSC
in interfaceCurve
- Parameters:
delay
- The latency of the affine curve.- Returns:
- msc_dnc An instance of MaxServiceCurve_Disco_Affine.
-
createRateLatencyMSC
public MaxServiceCurve_Disco_Affine createRateLatencyMSC(double rate, double latency)
A wrapper to create a service curve with rate latency with rate and latency represented in double.- Specified by:
createRateLatencyMSC
in interfaceCurve
- Parameters:
rate
- The rate of the curve.latency
- The rate latency component of the curve.- Returns:
- msc_dnc An instance of MaxServiceCurve_Disco_Affine.
-
createRateLatencyMSC
public MaxServiceCurve_Disco_Affine createRateLatencyMSC(Num rate, Num latency)
Create a service curve with a rate and a latency.- Specified by:
createRateLatencyMSC
in interfaceCurve
- Parameters:
rate
- The rate of the curve.latency
- The rate latency component of the curve.- Returns:
- msc_dnc An instance of MaxServiceCurve_Disco_Affine.
-
makeHorizontal
private void makeHorizontal(Curve_Disco_Affine c_dnc, Num y)
Create a curve with rate 0 and burst y, i.e. a horizontal curve.- Parameters:
c_dnc
- An instance of Curve_Disco_Affine to which segments have to be created.y
- The burst component if any.
-
makeDelayedInfiniteBurst
private void makeDelayedInfiniteBurst(Curve_Disco_Affine c_dnc, Num delay)
Create a curve with infinite burst.- Parameters:
c_dnc
- An instance of Curve_Disco_Affine to which segments have to be created.delay
- The latency of the affine curve.
-
makePeakRate
private void makePeakRate(Curve_Disco_Affine c_dnc, Num rate)
To create a curve which had no burst and latency. Note: This is a special case of affine curve which is both rate latency and token bucket curve with burst (token bucket component) and latency (rate latency component) set to 0.- Parameters:
c_dnc
- An instance of Curve_Disco_Affine to which segments have to be created.rate
- Rate of the linear segment.
-
makeRateLatency
private void makeRateLatency(Curve_Disco_Affine c_dnc, Num rate, Num latency)
Create a rate latency curve based on the passed rate and latency.- Parameters:
c_dnc
- The curve to which the rate latency has to be created.rate
- The rate of the affine curve.latency
- Latency of the affine curve.
-
makeTokenBucket
private void makeTokenBucket(Curve_Disco_Affine c_dnc, Num rate, Num burst)
Create a token bucket affine curve based on the passed rate and burst.- Parameters:
c_dnc
- The curve to which the token bucket has to be created.rate
- The rate of the affine curve.burst
- Burst of the affine curve.
-
-