Curve
, CurvePwAffine
ArrivalCurve_DNC
, MaxServiceCurve_DNC
, ServiceCurve_DNC
public class Curve_DNC extends java.lang.Object implements CurvePwAffine
LinearSegment
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 subsequent LinearSegment
instances which start at the same inflection point. In this case, the second
segment needs to have leftopen
set to true
to
indicate that the inflection point is excluded from the second segment.Curve
.CurvePwAffine.CurveOperation
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
has_rate_latency_meta_info |
|
protected boolean |
has_token_bucket_meta_info |
|
private static Curve_DNC |
instance |
|
protected boolean |
is_delayed_infinite_burst |
|
protected boolean |
is_rate_latency |
|
protected boolean |
is_token_bucket |
|
protected java.util.List<Curve_DNC> |
rate_latencies |
|
protected LinearSegment_DNC[] |
segments |
|
protected java.util.List<Curve_DNC> |
token_buckets |
Modifier | Constructor | Description |
---|---|---|
protected |
Curve_DNC() |
Creates a
CurveDNC instance with a single segment on the x-axis. |
protected |
Curve_DNC(int segment_count) |
Creates a
Curve instance with segment_count empty
LinearSegment instances. |
protected |
Curve_DNC(CurvePwAffine curve) |
Modifier and Type | Method | Description |
---|---|---|
void |
addSegment(int pos,
LinearSegment s) |
Adds a
LinearSegment at the location pos 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 a
LinearSegment 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() |
|
Curve_DNC |
copy() |
Returns a copy of this instance.
|
void |
copy(Curve curve) |
|
ArrivalCurve_DNC |
createArrivalCurve() |
|
ArrivalCurve_DNC |
createArrivalCurve(int segment_count) |
|
ArrivalCurve_DNC |
createArrivalCurve(CurvePwAffine curve) |
|
ArrivalCurve_DNC |
createArrivalCurve(CurvePwAffine curve,
boolean remove_latency) |
|
ArrivalCurve_DNC |
createArrivalCurve(java.lang.String arrival_curve_str) |
|
Curve_DNC |
createCurve(java.util.List<LinearSegment> segments) |
|
ServiceCurve_DNC |
createDelayedInfiniteBurst(double delay) |
|
ServiceCurve_DNC |
createDelayedInfiniteBurst(Num delay) |
|
MaxServiceCurve_DNC |
createDelayedInfiniteBurstMSC(double delay) |
|
MaxServiceCurve_DNC |
createDelayedInfiniteBurstMSC(Num delay) |
|
Curve_DNC |
createHorizontal(double y) |
|
Curve_DNC |
createHorizontal(Num y) |
Creates a horizontal curve.
|
MaxServiceCurve_DNC |
createInfiniteMaxService() |
|
MaxServiceCurve_DNC |
createMaxServiceCurve() |
|
MaxServiceCurve_DNC |
createMaxServiceCurve(int segment_count) |
|
MaxServiceCurve_DNC |
createMaxServiceCurve(CurvePwAffine curve) |
|
MaxServiceCurve_DNC |
createMaxServiceCurve(java.lang.String max_service_curve_str) |
|
private void |
createNewCurve(int segment_count,
boolean empty) |
|
ArrivalCurve_DNC |
createPeakArrivalRate(double rate) |
|
ArrivalCurve_DNC |
createPeakArrivalRate(Num rate) |
|
ServiceCurve_DNC |
createRateLatency(double rate,
double latency) |
|
ServiceCurve_DNC |
createRateLatency(Num rate,
Num latency) |
|
MaxServiceCurve_DNC |
createRateLatencyMSC(double rate,
double latency) |
|
MaxServiceCurve_DNC |
createRateLatencyMSC(Num rate,
Num latency) |
|
ServiceCurve_DNC |
createServiceCurve() |
|
ServiceCurve_DNC |
createServiceCurve(int segment_count) |
|
ServiceCurve_DNC |
createServiceCurve(CurvePwAffine curve) |
|
ServiceCurve_DNC |
createServiceCurve(java.lang.String service_curve_str) |
|
ArrivalCurve_DNC |
createTokenBucket(double rate,
double burst) |
|
ArrivalCurve_DNC |
createTokenBucket(Num rate,
Num burst) |
|
ArrivalCurve_DNC |
createZeroArrivals() |
|
Curve_DNC |
createZeroCurve() |
|
ServiceCurve_DNC |
createZeroDelayInfiniteBurst() |
Creates an infinite burst curve with zero delay.
|
MaxServiceCurve_DNC |
createZeroDelayInfiniteBurstMSC() |
|
private void |
createZeroSegmentsCurve(int segment_count) |
|
ServiceCurve_DNC |
createZeroService() |
|
private void |
decomposeIntoRateLatencies() |
Decomposes this curve into a list of rate latency curves and stores this list
in the curve's
rate_latencies field.Note: Curve must be convex. |
private void |
decomposeIntoTokenBuckets() |
Decomposes this curve into a list of token bucket curves and stores this list
in the curve's
token_buckets field.Note: Curve must be concave. |
boolean |
equals(java.lang.Object obj) |
|
Num |
f(Num x) |
Returns the function value at x-coordinate
x , if
x>=0 , and NaN if not. |
Num |
f_inv(Num y) |
Returns the smallest x value at which the function value is equal to
y . |
Num |
f_inv(Num y,
boolean rightmost) |
Returns the x value at which the function value is equal to
y . |
Num |
fLimitRight(Num x) |
Returns the limit to the right of the function value at x-coordinate
x , if x>=0 , and NaN if not. |
protected void |
forceThroughOrigin() |
|
Num |
getBurst() |
|
static Curve_DNC |
getFactory() |
|
Num |
getGradientLimitRight(Num x) |
Returns the gradient to the right of the function value at x-coordinate
x , if x>=0 , and NaN if not. |
Num |
getLatency() |
Returns the x-coordinate of the inflection point after which the function
values are greater than zero.
|
Curve_DNC |
getRL_Component(int i) |
Returns the
i 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<CurvePwAffine> |
getRL_Components() |
|
boolean |
getRL_Property() |
|
LinearSegment_DNC |
getSegment(int pos) |
Starting at 0.
|
int |
getSegmentCount() |
Returns the number of segments in this curve.
|
int |
getSegmentDefining(Num x) |
Returns the number of the segment that defines the function value at
x-coordinate
x . |
private int |
getSegmentFirstAtValue(Num y) |
Returns the first segment at which the function reaches the value
y . |
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-coordinate
x . |
Curve_DNC |
getTB_Component(int i) |
Returns the
i 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<CurvePwAffine> |
getTB_Components() |
|
Num |
getUltAffineRate() |
Returns the gradient of the last segment.
|
int |
hashCode() |
|
boolean |
hasRateLatencyMetaInfo() |
|
boolean |
hasTokenBucketMetaInfo() |
|
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() |
Tests whether the curve is convex.
|
boolean |
isConvexIn(Num a,
Num b) |
Tests whether the curve is convex in [a,b].
|
boolean |
isDelayedInfiniteBurst() |
|
boolean |
isDiscontinuity(int pos) |
Returns whether the inflection point is a (real or unreal) discontinuity.
|
boolean |
isRateLatency() |
|
boolean |
isRealDiscontinuity(int pos) |
Returns whether the inflection point is a real discontinuity, i.e.
|
boolean |
isTokenBucket() |
|
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_DNC c_dnc,
Num delay) |
|
private void |
makeHorizontal(Curve_DNC c_dnc,
Num y) |
|
private void |
makePeakRate(Curve_DNC c_dnc,
Num rate) |
|
private void |
makeRateLatency(Curve_DNC c_dnc,
Num rate,
Num latency) |
|
private void |
makeTokenBucket(Curve_DNC c_dnc,
Num rate,
Num burst) |
|
void |
removeSegment(int pos) |
Removes the segment at position
pos . |
void |
setRateLateny(boolean is_rate_latency) |
|
void |
setRL_Components(java.util.List<CurvePwAffine> rate_latencies) |
|
void |
setRL_MetaInfo(boolean has_rate_latency_meta_info) |
|
void |
setSegment(int pos,
LinearSegment s) |
|
protected void |
setSegments(LinearSegment[] segments) |
|
void |
setTB_Components(java.util.List<CurvePwAffine> token_buckets) |
|
void |
setTB_MetaInfo(boolean has_token_bucket_meta_info) |
|
void |
setTokenBucket(boolean is_token_bucket) |
|
java.lang.String |
toString() |
Returns a string representation of this curve.
|
add, add, add, add, add, add, add, beautify, boundAtXAxis, computeInflectionPointsX, computeInflectionPointsY, computeResultingCurve, getMaxHorizontalDeviation, getMaxVerticalDeviation, getXIntersection, max, max, max, min, min, min, min, removeLatency, shiftLeftClipping, shiftRight, sub, sub
private static Curve_DNC instance
protected LinearSegment_DNC[] segments
protected boolean is_delayed_infinite_burst
protected boolean is_rate_latency
protected boolean has_rate_latency_meta_info
protected java.util.List<Curve_DNC> rate_latencies
protected boolean is_token_bucket
protected boolean has_token_bucket_meta_info
protected java.util.List<Curve_DNC> token_buckets
protected Curve_DNC()
CurveDNC
instance with a single segment on the x-axis.protected Curve_DNC(CurvePwAffine curve)
protected Curve_DNC(int segment_count)
Curve
instance with segment_count
empty
LinearSegment
instances.segment_count
- the number of segmentspublic static Curve_DNC getFactory()
public boolean isRateLatency()
isRateLatency
in interface CurvePwAffine
public boolean isTokenBucket()
isTokenBucket
in interface CurvePwAffine
public boolean hasRateLatencyMetaInfo()
public void setRL_MetaInfo(boolean has_rate_latency_meta_info)
setRL_MetaInfo
in interface CurvePwAffine
public java.util.List<CurvePwAffine> getRL_Components()
getRL_Components
in interface CurvePwAffine
public void setRL_Components(java.util.List<CurvePwAffine> rate_latencies)
setRL_Components
in interface CurvePwAffine
public boolean hasTokenBucketMetaInfo()
public void setTB_MetaInfo(boolean has_token_bucket_meta_info)
setTB_MetaInfo
in interface CurvePwAffine
public java.util.List<CurvePwAffine> getTB_Components()
getTB_Components
in interface CurvePwAffine
public void setTB_Components(java.util.List<CurvePwAffine> token_buckets)
setTB_Components
in interface CurvePwAffine
private void createNewCurve(int segment_count, boolean empty)
private void createZeroSegmentsCurve(int segment_count)
protected void initializeCurve(java.lang.String curve_str) throws java.lang.Exception
java.lang.Exception
protected void forceThroughOrigin()
private void clearMetaInfo()
public Curve_DNC copy()
copy
in interface Curve
copy
in interface CurvePwAffine
public void copy(Curve curve)
copy
in interface Curve
copy
in interface CurvePwAffine
public LinearSegment_DNC getSegment(int pos)
getSegment
in interface Curve
public int getSegmentCount()
getSegmentCount
in interface Curve
public int getSegmentDefining(Num x)
x
. The number of the segment is usually the same as
the one returned by getSegmentLimitRight(x)
, except for if a
segment starts at x
and is left-open. In this case the function
returns the previous segment, rather than the current segment, as the
previous segment defines x
.getSegmentDefining
in interface Curve
x
- the x-coordinatepublic int getSegmentLimitRight(Num x)
x
. The number of the segment is usually the same as the one
returned by getSegmentDefining(x)
, except for if a segment
starts at x
and is left-open. In this case the function returns
the current segment, rather than the previous segment.x
- the x-coordinatepublic void setSegment(int pos, LinearSegment s)
protected void setSegments(LinearSegment[] segments)
public void addSegment(LinearSegment s)
LinearSegment
to the end of the curve.addSegment
in interface Curve
s
- the segment to be added.public void addSegment(int pos, LinearSegment s)
LinearSegment
at the location pos
of the
curve.addSegment
in interface Curve
pos
- the index into the segment array to add the new segment.s
- the segment to be added.public void removeSegment(int pos)
pos
.removeSegment
in interface Curve
pos
- the index of the segment to be removed.public boolean isDiscontinuity(int pos)
isDiscontinuity
in interface Curve
pos
- the index of the IPtrue
if the IP is a discontinuity, false
if
not.public boolean isRealDiscontinuity(int pos)
isRealDiscontinuity
in interface Curve
pos
- the index of the IPtrue
if the IP is a real discontinuity,
false
if not.public boolean isUnrealDiscontinuity(int pos)
isUnrealDiscontinuity
in interface Curve
pos
- the index of the IPtrue
if the IP is an unreal discontinuity,
false
if not.public boolean isWideSenseIncreasing()
isWideSenseIncreasing
in interface Curve
public boolean isConvex()
isConvex
in interface CurvePwAffine
public boolean isConvexIn(Num a, Num b)
isConvexIn
in interface Curve
a
- the lower bound of the test interval.b
- the upper bound of the test interval.public boolean isConcave()
isConcave
in interface CurvePwAffine
public boolean isConcaveIn(Num a, Num b)
isConcaveIn
in interface Curve
a
- the lower bound of the test interval.b
- the upper bound of the test interval.public boolean isAlmostConcave()
isAlmostConcave
in interface CurvePwAffine
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
public Num fLimitRight(Num x)
x
, if x>=0
, and NaN
if not.fLimitRight
in interface Curve
x
- the x-coordinatepublic Num f_inv(Num y)
y
.public Num f_inv(Num y, boolean rightmost)
y
.
If rightmost
is true
, returns the rightmost
x-coordinate, otherwise the leftmost coordinate.private int getSegmentFirstAtValue(Num y)
y
. It returns -1 if the curve never reaches this value.y
- the y-coordinatepublic Num getLatency()
getLatency
in interface Curve
public Num getGradientLimitRight(Num x)
x
, if x>=0
, and NaN
if not.getGradientLimitRight
in interface Curve
x
- the x-coordinatepublic Num getUltAffineRate()
getUltAffineRate
in interface CurvePwAffine
public boolean isDelayedInfiniteBurst()
isDelayedInfiniteBurst
in interface Curve
public boolean getRL_Property()
public void setRateLateny(boolean is_rate_latency)
setRateLateny
in interface CurvePwAffine
public int getRL_ComponentCount()
getRL_ComponentCount
in interface CurvePwAffine
public Curve_DNC getRL_Component(int i)
i
the rate latency curve that this curve can be
decomposed into.getRL_Component
in interface CurvePwAffine
i
- the number of the rate latency curveprivate void decomposeIntoRateLatencies()
rate_latencies
field.public void setTokenBucket(boolean is_token_bucket)
setTokenBucket
in interface CurvePwAffine
public int getTB_ComponentCount()
getTB_ComponentCount
in interface CurvePwAffine
public Curve_DNC getTB_Component(int i)
i
the token bucket curve that this curve can be
decomposed into.getTB_Component
in interface CurvePwAffine
i
- the number of the token bucketprivate void decomposeIntoTokenBuckets()
token_buckets
field.public Curve_DNC createCurve(java.util.List<LinearSegment> segments)
createCurve
in interface CurvePwAffine
public Curve_DNC createZeroCurve()
createZeroCurve
in interface CurvePwAffine
public Curve_DNC createHorizontal(double y)
createHorizontal
in interface CurvePwAffine
public Curve_DNC createHorizontal(Num y)
createHorizontal
in interface CurvePwAffine
y
- the y-intercept of the curveCurve
instancepublic ServiceCurve_DNC createServiceCurve()
createServiceCurve
in interface CurvePwAffine
public ServiceCurve_DNC createServiceCurve(int segment_count)
createServiceCurve
in interface CurvePwAffine
public ServiceCurve_DNC createServiceCurve(java.lang.String service_curve_str) throws java.lang.Exception
createServiceCurve
in interface CurvePwAffine
java.lang.Exception
public ServiceCurve_DNC createServiceCurve(CurvePwAffine curve)
createServiceCurve
in interface CurvePwAffine
public ServiceCurve_DNC createZeroService()
createZeroService
in interface CurvePwAffine
public ServiceCurve_DNC createZeroDelayInfiniteBurst()
createZeroDelayInfiniteBurst
in interface CurvePwAffine
ServiceCurve
instancepublic ServiceCurve_DNC createDelayedInfiniteBurst(double delay)
createDelayedInfiniteBurst
in interface CurvePwAffine
public ServiceCurve_DNC createDelayedInfiniteBurst(Num delay)
createDelayedInfiniteBurst
in interface CurvePwAffine
public ServiceCurve_DNC createRateLatency(double rate, double latency)
createRateLatency
in interface CurvePwAffine
public ServiceCurve_DNC createRateLatency(Num rate, Num latency)
createRateLatency
in interface CurvePwAffine
public ArrivalCurve_DNC createArrivalCurve()
createArrivalCurve
in interface CurvePwAffine
public ArrivalCurve_DNC createArrivalCurve(int segment_count)
createArrivalCurve
in interface CurvePwAffine
public ArrivalCurve_DNC createArrivalCurve(java.lang.String arrival_curve_str) throws java.lang.Exception
createArrivalCurve
in interface CurvePwAffine
java.lang.Exception
public ArrivalCurve_DNC createArrivalCurve(CurvePwAffine curve)
createArrivalCurve
in interface CurvePwAffine
public ArrivalCurve_DNC createArrivalCurve(CurvePwAffine curve, boolean remove_latency)
createArrivalCurve
in interface CurvePwAffine
public ArrivalCurve_DNC createZeroArrivals()
createZeroArrivals
in interface CurvePwAffine
public ArrivalCurve_DNC createPeakArrivalRate(double rate)
createPeakArrivalRate
in interface CurvePwAffine
public ArrivalCurve_DNC createPeakArrivalRate(Num rate)
createPeakArrivalRate
in interface CurvePwAffine
public ArrivalCurve_DNC createTokenBucket(double rate, double burst)
createTokenBucket
in interface CurvePwAffine
public ArrivalCurve_DNC createTokenBucket(Num rate, Num burst)
createTokenBucket
in interface CurvePwAffine
public MaxServiceCurve_DNC createMaxServiceCurve()
createMaxServiceCurve
in interface CurvePwAffine
public MaxServiceCurve_DNC createMaxServiceCurve(int segment_count)
createMaxServiceCurve
in interface CurvePwAffine
public MaxServiceCurve_DNC createMaxServiceCurve(java.lang.String max_service_curve_str) throws java.lang.Exception
createMaxServiceCurve
in interface CurvePwAffine
java.lang.Exception
public MaxServiceCurve_DNC createMaxServiceCurve(CurvePwAffine curve)
createMaxServiceCurve
in interface CurvePwAffine
public MaxServiceCurve_DNC createInfiniteMaxService()
createInfiniteMaxService
in interface CurvePwAffine
public MaxServiceCurve_DNC createZeroDelayInfiniteBurstMSC()
createZeroDelayInfiniteBurstMSC
in interface CurvePwAffine
public MaxServiceCurve_DNC createDelayedInfiniteBurstMSC(double delay)
createDelayedInfiniteBurstMSC
in interface CurvePwAffine
public MaxServiceCurve_DNC createDelayedInfiniteBurstMSC(Num delay)
createDelayedInfiniteBurstMSC
in interface CurvePwAffine
public MaxServiceCurve_DNC createRateLatencyMSC(double rate, double latency)
createRateLatencyMSC
in interface CurvePwAffine
public MaxServiceCurve_DNC createRateLatencyMSC(Num rate, Num latency)
createRateLatencyMSC
in interface CurvePwAffine