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 ofLinearSegmentobjects. 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 subsequentLinearSegmentinstances which start at the same inflection point. In this case, the second segment needs to haveleftopenset totrueto 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 booleanhas_rate_latency_meta_infoprotected booleanhas_token_bucket_meta_infoprivate static Curve_Disco_Affineinstanceprotected booleanis_delayed_infinite_burstprotected booleanis_rate_latencyprotected booleanis_token_bucketprotected java.util.List<Curve_Disco_Affine>rate_latenciesprotected LinearSegment_Disco[]segmentsprotected java.util.List<Curve_Disco_Affine>token_buckets
-
Constructor Summary
Constructors Modifier Constructor Description protectedCurve_Disco_Affine()Creates aCurve_Disco_Affineinstance with 1 segment of type LinearSegment.protectedCurve_Disco_Affine(int segment_count)Creates aCurve_Disco_Affineinstance withsegment_countnumber ofLinearSegment.protectedCurve_Disco_Affine(Curve curve)Creates a copy of the passedCurve_Disco_Affineinstancecurve.
-
Method Summary
Modifier and Type Method Description voidaddSegment(int pos, LinearSegment s)Adds aLinearSegmentat the locationposof 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.voidaddSegment(LinearSegment s)Adds aLinearSegmentto the end of the curve.
Note: It is the user's responsibility to add segments in the order of increasing x-coordinates.private voidclearMetaInfo()Resets the rate latency and token bucket meta info.Curve_Disco_Affinecopy()Returns a copy of this instance.voidcopy(Curve curve)ArrivalCurve_Disco_AffinecreateArrivalCurve()To create affine arrival curve with number of segments equal to one.ArrivalCurve_Disco_AffinecreateArrivalCurve(int segment_count)This creates an affine arrival curve with segments equal to the passed segment_countArrivalCurve_Disco_AffinecreateArrivalCurve(java.lang.String arrival_curve_str)This creates an affine arrival curve from the passed string representation of curve.ArrivalCurve_Disco_AffinecreateArrivalCurve(Curve curve)This creates an affine arrival curve from the passed curve.ArrivalCurve_Disco_AffinecreateArrivalCurve(Curve curve, boolean remove_latency)Curve_Disco_AffinecreateCurve(java.util.List<LinearSegment> segments)ServiceCurve_Disco_AffinecreateDelayedInfiniteBurst(double delay)Wrapper to create affine service curve with delay and infinite burst when delay is passed as double.ServiceCurve_Disco_AffinecreateDelayedInfiniteBurst(Num delay)This creates affine service curve with delay and infinite burst.MaxServiceCurve_Disco_AffinecreateDelayedInfiniteBurstMSC(double delay)A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with delay.MaxServiceCurve_Disco_AffinecreateDelayedInfiniteBurstMSC(Num delay)Create a MaxServiceCurve_Disco_Affine curve having infinite burst after a given delay.Curve_Disco_AffinecreateHorizontal(Num y)This creates an instance of Curve_Disco_Affine with rate 0 and burst equal to y.ArrivalCurve_Disco_AffinecreateInfiniteArrivals()MaxServiceCurve_Disco_AffinecreateInfiniteMaxService()A wrapper method to create delayed infinite curve for MaxServiceCurve_Disco_Affine.MaxServiceCurve_Disco_AffinecreateMaxServiceCurve()To create a MaxServiceCurve_Disco_Affine with one segment.MaxServiceCurve_Disco_AffinecreateMaxServiceCurve(int segment_count)Wrapper to create Max service curve DNC with segments equal to segment_count.MaxServiceCurve_Disco_AffinecreateMaxServiceCurve(java.lang.String max_service_curve_str)Wrapper to create Max service curve DNC from string representation.MaxServiceCurve_Disco_AffinecreateMaxServiceCurve(Curve curve)Wrapper method to create a Max service curve DNC from an existing curve.private voidcreateNewCurve(int segment_count)Creates an affine curve with maximum of two segments.ArrivalCurve_Disco_AffinecreatePeakArrivalRate(double rate)Wrapper to create affine arrival curve with 0 burst and 0 latency.ArrivalCurve_Disco_AffinecreatePeakArrivalRate(Num rate)To create a affine arrival curve with 0 burst and 0 latency.ServiceCurve_Disco_AffinecreateRateLatency(double rate, double latency)Wrapper to create rate latency for the ServiceCurve_Disco_Affine with rate and latency passed as double.ServiceCurve_Disco_AffinecreateRateLatency(Num rate, Num latency)Wrapper to create rate latency for the ServiceCurve_Disco_Affine.MaxServiceCurve_Disco_AffinecreateRateLatencyMSC(double rate, double latency)A wrapper to create a service curve with rate latency with rate and latency represented in double.MaxServiceCurve_Disco_AffinecreateRateLatencyMSC(Num rate, Num latency)Create a service curve with a rate and a latency.ServiceCurve_Disco_AffinecreateServiceCurve()This creates an instance of affine service curve with number of segments equal to 1ServiceCurve_Disco_AffinecreateServiceCurve(int segment_count)This creates an instance of affine service curve with number of segments equal to passed segment_count.ServiceCurve_Disco_AffinecreateServiceCurve(java.lang.String service_curve_str)This creates an instance of affine service curve from the string representation of the curve.ServiceCurve_Disco_AffinecreateServiceCurve(Curve curve)This creates an instance of affine service curve same as the passed curve instance.ArrivalCurve_Disco_AffinecreateTokenBucket(double rate, double burst)To create a token bucket affine arrival curve.ArrivalCurve_Disco_AffinecreateTokenBucket(Num rate, Num burst)To create a token bucket affine arrival curve.ArrivalCurve_Disco_AffinecreateZeroArrivals()To create an affine arrival Curve with one segment.Curve_Disco_AffinecreateZeroCurve()This creates an instance of Curve_Disco_Affine with 1 segment.ServiceCurve_Disco_AffinecreateZeroDelayInfiniteBurst()Wrapper to create affine service curve with 0 delay and infinite burst.MaxServiceCurve_Disco_AffinecreateZeroDelayInfiniteBurstMSC()A wrapper method MaxServiceCurve_Disco_Affine curve having infinite burst with zero delay.ServiceCurve_Disco_AffinecreateZeroService()This creates an affine service curve with one segment.private voiddecomposeIntoRateLatencies()Decomposes this curve into a list of rate latency curves and stores this list in the curve'srate_latenciesfield.private voiddecomposeIntoTokenBuckets()Decomposes this curve into a list of token bucket curves and stores this list in the curve'stoken_bucketsfield.booleanequals(java.lang.Object obj)To check whether this object instance is equal to the passing instance.Numf(Num x)Returns the function value at x-coordinatex, ifx>=0, andNaNif not.Numf_inv(Num y)Returns the smallest x value at which the function value is equal toy.Numf_inv(Num y, boolean rightmost)Returns the x value at which the function value is equal toy.NumfLimitRight(Num x)Returns the limit to the right of the function value at x-coordinatex, ifx>=0, andNaNif not.protected voidforceThroughOrigin()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.NumgetBurst()Returns the burst of the curve.static Curve_Disco_AffinegetFactory()Returns an instance ofCurve_Disco_Affinewith one segment ofLinearSegment.NumgetGradientLimitRight(Num x)Returns the gradient to the right of the function value at x-coordinatex, ifx>=0, andNaNif not.NumgetLatency()Returns the x-coordinate of the inflection point after which the function values are greater than zero.Curve_Disco_AffinegetRL_Component(int i)Returns theithe rate latency curve that this curve can be decomposed into.intgetRL_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.booleangetRL_Property()Decomposes the curve into rate latency components and returns if its a rate latency curve.LinearSegment_DiscogetSegment(int pos)Returns the segment at position pos (starting at 0).intgetSegmentCount()Returns the number of segments in the curve.intgetSegmentDefining(Num x)Returns the number of the segment that defines the function value at x-coordinatex.private intgetSegmentFirstAtValue(Num y)Returns the first segment at which the function reaches the valuey.intgetSegmentLimitRight(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_AffinegetTB_Component(int i)Returns theithe token bucket curve that this curve can be decomposed into.intgetTB_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.NumgetUltAffineRate()Returns the gradient of the last segment.inthashCode()To generate the hash code of a curve based on its segments.booleanhasRateLatencyMetaInfo()Returns weather the curve already has rate latency meta info or not.booleanhasTokenBucketMetaInfo()Returns weather the curve already has token bucket meta info or not.protected voidinitializeCurve(java.lang.String curve_str)booleanisAlmostConcave()Tests whether the curve is almost concave, i.e.booleanisConcave()Tests whether the curve is concave.booleanisConcaveIn(Num a, Num b)Tests whether the curve is concave in [a,b].booleanisConvex()Test whether the curve us convex.booleanisConvexIn(Num a, Num b)Tests whether the curve is convex in [a,b].booleanisDelayedInfiniteBurst()Returns whether or not the curve is delayed infinite burstbooleanisDiscontinuity(int pos)Returns whether the inflection point is a (real or unreal) discontinuity.booleanisRateLatency()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.booleanisRealDiscontinuity(int pos)Returns whether the inflection point is a real discontinuity, i.e.booleanisTokenBucket()Verifies weather the curve is a token bucket or not Decomposes the curve into token bucket components if it is a token bucket curve.booleanisUnrealDiscontinuity(int pos)Returns whether the inflection point is an unreal discontinuity, i.e.booleanisWideSenseIncreasing()Tests whether the curve is wide-sense increasing.private voidmakeDelayedInfiniteBurst(Curve_Disco_Affine c_dnc, Num delay)Create a curve with infinite burst.private voidmakeHorizontal(Curve_Disco_Affine c_dnc, Num y)Create a curve with rate 0 and burst y, i.e.private voidmakePeakRate(Curve_Disco_Affine c_dnc, Num rate)To create a curve which had no burst and latency.private voidmakeRateLatency(Curve_Disco_Affine c_dnc, Num rate, Num latency)Create a rate latency curve based on the passed rate and latency.private voidmakeTokenBucket(Curve_Disco_Affine c_dnc, Num rate, Num burst)Create a token bucket affine curve based on the passed rate and burst.voidremoveSegment(int pos)Removes the segment at positionpos.voidsetRateLateny(boolean is_rate_latency)Setter method for the flag is_rate_latency.voidsetRL_Components(java.util.List<Curve> rate_latencies)Updates the rate_latencies of the calling object with the passed rate_latencies.voidsetRL_MetaInfo(boolean has_rate_latency_meta_info)Sets the has_rate_latency_meta_info to the passed arguments.voidsetSegment(int pos, LinearSegment s)Insets the segment at position pos.protected voidsetSegments(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.voidsetTB_Components(java.util.List<Curve> token_buckets)Updates the token_buckets of the calling object with the passed token_buckets components.voidsetTB_MetaInfo(boolean has_token_bucket_meta_info)Update the has_token_bucket_meta_info of the calling object to the passed argument.voidsetTokenBucket(boolean is_token_bucket)Setter method for is_token_bucket flag.java.lang.StringtoString()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_Affineinstance with 1 segment of type LinearSegment.
-
Curve_Disco_Affine
protected Curve_Disco_Affine(Curve curve)
Creates a copy of the passedCurve_Disco_Affineinstancecurve.
-
Curve_Disco_Affine
protected Curve_Disco_Affine(int segment_count)
Creates aCurve_Disco_Affineinstance withsegment_countnumber ofLinearSegment.- 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_Affinewith 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:
isRateLatencyin interfaceCurve_Affine- Returns:
is_rate_latencyReturns 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:
isTokenBucketin 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_MetaInfoin 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_Componentsin 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_MetaInfoin 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_Componentsin 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:
copyin interfaceCurve- Specified by:
copyin interfaceCurve_Affine- Returns:
- c_copy A copy of this instance.
-
copy
public void copy(Curve curve)
- Specified by:
copyin interfaceCurve- Specified by:
copyin interfaceCurve_Affine
-
getSegment
public LinearSegment_Disco getSegment(int pos)
Returns the segment at position pos (starting at 0).- Specified by:
getSegmentin 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:
getSegmentCountin 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 atxand is left-open. In this case the function returns the previous segment, rather than the current segment, as the previous segment definesx.- Specified by:
getSegmentDefiningin 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 atxand 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 aLinearSegmentto the end of the curve.
Note: It is the user's responsibility to add segments in the order of increasing x-coordinates.- Specified by:
addSegmentin interfaceCurve- Parameters:
s- the segment to be added.
-
addSegment
public void addSegment(int pos, LinearSegment s)Adds aLinearSegmentat the locationposof 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:
addSegmentin 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:
removeSegmentin 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:
isDiscontinuityin interfaceCurve- Parameters:
pos- the index of the IP- Returns:
trueif the IP is a discontinuity,falseif 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:
isRealDiscontinuityin interfaceCurve- Parameters:
pos- the index of the IP- Returns:
trueif the IP is a real discontinuity,falseif 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:
isUnrealDiscontinuityin interfaceCurve- Parameters:
pos- the index of the IP- Returns:
trueif the IP is an unreal discontinuity,falseif not.
-
isWideSenseIncreasing
public boolean isWideSenseIncreasing()
Tests whether the curve is wide-sense increasing.- Specified by:
isWideSenseIncreasingin 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:
isConvexInin 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:
isConcaveInin 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:
isAlmostConcavein 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, andNaNif not.- Specified by:
fLimitRightin 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. Ifrightmostistrue, 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:
getLatencyin 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, andNaNif not.- Specified by:
getGradientLimitRightin interfaceCurve- Parameters:
x- The x-coordinate- Returns:
- The function value.
-
getUltAffineRate
public Num getUltAffineRate()
Returns the gradient of the last segment.- Specified by:
getUltAffineRatein 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:
isDelayedInfiniteBurstin 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:
setRateLatenyin 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_ComponentCountin interfaceCurve- Returns:
- The number of rate latency curves.
-
getRL_Component
public Curve_Disco_Affine getRL_Component(int i)
Returns theithe rate latency curve that this curve can be decomposed into.- Specified by:
getRL_Componentin 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_latenciesfield.
-
setTokenBucket
public void setTokenBucket(boolean is_token_bucket)
Setter method for is_token_bucket flag.- Specified by:
setTokenBucketin 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_ComponentCountin interfaceCurve- Returns:
- The number of token buckets
-
getTB_Component
public Curve_Disco_Affine getTB_Component(int i)
Returns theithe token bucket curve that this curve can be decomposed into.- Specified by:
getTB_Componentin 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_bucketsfield.
-
createCurve
public Curve_Disco_Affine createCurve(java.util.List<LinearSegment> segments)
- Specified by:
createCurvein interfaceCurve- Returns:
-
createZeroCurve
public Curve_Disco_Affine createZeroCurve()
This creates an instance of Curve_Disco_Affine with 1 segment.- Specified by:
createZeroCurvein 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:
createHorizontalin 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:
createServiceCurvein 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:
createServiceCurvein 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:
createServiceCurvein 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:
createServiceCurvein 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:
createZeroServicein 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:
createZeroDelayInfiniteBurstin 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:
createDelayedInfiniteBurstin 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:
createDelayedInfiniteBurstin 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:
createRateLatencyin 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:
createRateLatencyin 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:
createArrivalCurvein 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:
createArrivalCurvein 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:
createArrivalCurvein 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:
createArrivalCurvein 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:
createArrivalCurvein interfaceCurve- Returns:
-
createZeroArrivals
public ArrivalCurve_Disco_Affine createZeroArrivals()
To create an affine arrival Curve with one segment.- Specified by:
createZeroArrivalsin interfaceCurve- Returns:
- An instance of ArrivalCurve_Disco_Affine.
-
createInfiniteArrivals
public ArrivalCurve_Disco_Affine createInfiniteArrivals()
- Specified by:
createInfiniteArrivalsin interfaceCurve
-
createPeakArrivalRate
public ArrivalCurve_Disco_Affine createPeakArrivalRate(double rate)
Wrapper to create affine arrival curve with 0 burst and 0 latency.- Specified by:
createPeakArrivalRatein 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:
createPeakArrivalRatein 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:
createTokenBucketin 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:
createTokenBucketin 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:
createMaxServiceCurvein 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:
createMaxServiceCurvein 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:
createMaxServiceCurvein 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:
createMaxServiceCurvein 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:
createZeroDelayInfiniteBurstMSCin 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:
createDelayedInfiniteBurstMSCin 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:
createDelayedInfiniteBurstMSCin 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:
createRateLatencyMSCin 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:
createRateLatencyMSCin 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.
-
-