unikl.disco.nc
Class Curve

java.lang.Object
  extended by unikl.disco.nc.Curve
All Implemented Interfaces:
Function, PWLFunction

public class Curve
extends java.lang.Object
implements PWLFunction

Class representing a piecewise linear curve, defined on [0,inf).
The curve is stored as an array of 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.
All arithmetic operations on a curve return a new instance of class Curve.

Author:
Frank A. Zdarsky

Field Summary
static boolean create_labels
           
static Curve NULL_CURVE
           
static Curve ZERO_DELAY_BURST_CURVE
           
 
Constructor Summary
Curve(double[] ip_xs, double[] ip_ms)
          Creates a Curve instance with inflection points at the x-coordinates ip_xs and with slopes defined by ip_ms.
Curve(double[] ip_xs, double[] ip_ys, double[] ip_ms, int compute_y_start)
          Creates a Curve instance with inflection points at the x-coordinates ip_xs and with slopes defined by ip_ms.
 
Method Summary
 Curve add(Curve other)
          Returns a curve that is the sum of this curve and the given curve.
 Curve add(double dy)
          Returns a copy of this curve shifted vertically by dy.
 void addSegment(int pos, LinearSegment s)
          Adds a LinearSegment at the location pos of the curve.
 void addSegment(LinearSegment s)
          Adds a LinearSegment to the end of the curve.
 void approximateAtSegment(int i)
          Approximates a (concave) arrival curve by removing the specified segment.
 int approximateSegments(double dy)
          Approximates arrival curve by removing all segments whose projection onto the y-axis has a height smaller than dy.
 void beautify()
          Removes unnecessary segments.
 Curve boundAtXAxis()
          Returns a copy of this curve bounded at the x-axis.
static Curve computeFIFOServiceCurve(Curve alpha, Curve beta)
          Computes the effetive FIFO service curve for a server with the service curve beta experiencing cross-traffic with arrival curve alpha.
static java.util.ArrayList computeInflectionPointsX(Curve c1, Curve c2)
          Returns an ArrayList instance of those x-coordinates at which either c1 or c2 or both have an inflection point.
static java.util.ArrayList computeInflectionPointsY(Curve c1, Curve c2)
          Returns an ArrayList instance of those y-coordinates at which either c1 or c2 or both have an inflection point.
 void computeYs(int start)
          Computes the y-coordinates of inflection points starting with inflection point start.
 Curve convolveAlmostConcave(Curve other)
          Returns the convolution of this curve, which must be (almost) concave, and the given curve, which must also be (almost) concave.
 Curve convolveConvex(Curve other)
          Returns the convolution of this curve, which must be convex, and the given curve, which must also be convex.
 Curve copy()
          Returns a copy of this instance.
static Curve createBurstDelay(double t)
          Creates a burst delay curve.
static Curve createFromTokenBuckets(java.util.List token_buckets)
          Creates a new curve from a list of token bucket curves.
static Curve createHorizontal(double y)
          Creates a horizontal curve.
static Curve createRateLatency(double t, double r)
          Creates a new rate latency curve.
static Curve createTokenBucket(double b, double r)
          Creates a new token bucket curve.
 Curve deconvolve(Curve other)
          Returns the deconvolution of this curve, which must be (almost) concave, and the given curve, which must convex.
 void dump()
          Prints the string representation of this curve to stdout.
 double f_inv(double y)
          Returns the smallest x value at which the function value is equal to y.
 double f_inv(double y, boolean rightmost)
          Returns the x value at which the function value is equal to y.
 double f(double x)
          Returns the function value at x-coordinate x, if x>=0, and NaN if not.
 double fLimitRight(double x)
          Returns the limit to the right of the function value at x-coordinate x, if x>=0, and NaN if not.
 java.lang.String getAlias()
          Returns a string with a user-defined alias name for the function.
static double getBacklogBound(Curve alpha, Curve beta)
          Returns the backlog bound of the given two curves.
static double getDelayBound(Curve alpha, Curve beta)
          Returns the delay bound of the given two curves.
 double getGradientAt(double x)
          Returns the curve's gradient at x-coordinate x, if x>=0, and NaN if not.
 double getGradientLimitRight(double x)
          Returns the gradient to the right of the function value at x-coordinate x, if x>=0, and NaN if not.
 double getHighestRate()
          Returns the highest rate (the steepest gradient of any segment).
static double getHorizontalDeviation(Curve c1, Curve c2)
          Returns the horizontal deviation between the given two curves.
 double getIPX(int i)
          Returns the x-coordinate of inflection point i.
 double getIPY(int i)
          Returns the y-coordinate of inflection point i.
 java.lang.String getLabel()
          Returns a string with an automatically created label for the function.
 double getLatency()
          Returns the x-coordinate of the inflection point after which the function values are greater than zero.
 double getMaxX()
          Returns the largest x for which the curve is defined.
 double getMinX()
          Returns the smallest x for which the curve is defined.
 Curve getRLComponent(int i)
          Returns the ith rate latency curve that this curve can be decomposed into.
 int getRLComponentCount()
          Returns the number of rate latency curves the curve can be decomposed into.
 java.util.List getRLComponents()
          Returns a list of rate latency curves that this curve can be decomposed into.
 int getSegmentCount()
          Returns the number of segments in this curve.
 int getSegmentDefining(double x)
          Returns the number of the segment that defines the function value at x-coordinate x.
 int getSegmentFirstAtValue(double y)
          Returns the first segment at which the function reaches the value y.
 int getSegmentLimitRight(double 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.
 double getSustainedRate()
          Returns the sustained rate (the gradient of the last segment).
 double getTBBurst()
          Returns the burstiness of this token bucket curve.
 Curve getTBComponent(int i)
          Returns the ith token bucket curve that this curve can be decomposed into.
 int getTBComponentCount()
          Returns the number of token buckets the curve can be decomposed into.
 java.util.List getTBComponents()
          Returns a list of token bucket curves that this curve can be decomposed into.
static double getVerticalDeviation(Curve c1, Curve c2)
          Returns the vertical deviation between the given two curves.
 java.util.List getYIntervals()
          Returns a list containing each segment's height when projected onto the y-axis.
 boolean isAlmostConcave()
          Tests whether the curve is almost concave, i.e. it is concave once its function value is larger than 0.
 boolean isArrivalCurve()
          Tests whether the curve is wide-sense increasing and satisfies f(0)=0.
 boolean isBurstDelay()
          Returns whether the current curve is a burst delay curve.
 boolean isConcave()
          Tests whether the curve is concave.
 boolean isConcaveIn(double a, double b)
          Tests whether the curve is concave in [a,b].
 boolean isConvex()
          Tests whether the curve is convex.
 boolean isConvexIn(double a, double b)
          Tests whether the curve is convex in [a,b].
 boolean isDiscontinuity(int i)
          Returns whether the inflection point is a (real or unreal) discontinuity.
 boolean isLeftopen(int i)
          Returns whether the inflection point i is excluded from the segment or not.
 boolean isRealDiscontinuity(int i)
          Returns whether the inflection point is a real discontinuity, i.e. the y0 of the leftopen segment differs from the previous one.
 boolean isUnrealDiscontinuity(int i)
          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.
 boolean isWideSenseIncreasing()
          Tests whether the curve is wide-sense increasing.
 Curve makeArrivalCurve()
          Returns a copy of this curve ensuring that f(0)=0.
 void makeTBRightContinuous()
          Makes the token bucket curve right-continuous.
 void markDiscontinuities()
          Marks discontinuities (subsequent segments having the same x-coordinate) by setting leftopen of the second segment.
 Curve max(Curve other)
          Returns a curve that is the maximum of this curve and the given curve.
 Curve min(Curve other)
          Returns a curve that is the minimum of this curve and the given curve.
 Curve removeLatency()
          Returns a copy of this curve with latency removed, i.e. shifted left by the latency.
 void removeSegment(int pos)
          Removes the segment at position pos.
 void setAlias(java.lang.String alias)
          Allows the user to set an alias name for the function which overrides the automatically created label.
static void setCreateLabels(boolean create_labels)
          Whether to auto-create labels for curves.
 void setSustainedRate(double r)
          Sets the sustained rate (the gradient of the last segment).
 void setTBBurst(double b)
          Sets the burstiness of this token bucket curve.
 Curve shiftLeftClipping(double dx)
          Returns a copy of this curve that is shifted to the left by dx, i.e. g(x) = f(x+dx).
 Curve shiftRight(double dx)
          Returns a copy of this curve that is shifted to the right by dx, i.e. g(x) = f(x-dx).
 Curve sub(Curve other)
          Returns a curve that is the difference between this curve and the given curve.
 java.lang.String toString()
          Returns a string representation of this curve.
 void undoMakeTBRightContinuous()
          Undoes the makeTBRightContinuous() operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_CURVE

public static final Curve NULL_CURVE

ZERO_DELAY_BURST_CURVE

public static final Curve ZERO_DELAY_BURST_CURVE

create_labels

public static boolean create_labels
Constructor Detail

Curve

public Curve(double[] ip_xs,
             double[] ip_ms)
Creates a Curve instance with inflection points at the x-coordinates ip_xs and with slopes defined by ip_ms. The y-coordinates are computed automatically.

Parameters:
ip_xs -
ip_ms -

Curve

public Curve(double[] ip_xs,
             double[] ip_ys,
             double[] ip_ms,
             int compute_y_start)
Creates a Curve instance with inflection points at the x-coordinates ip_xs and with slopes defined by ip_ms. This constructor accepts an array of y-coordinates so that discontinuities can be created. The parameter compute_y_start indicates from which inflection point (starting with 0), the y-coordinate is again computed automatically. Note that all arrays need to have the same length.

Parameters:
ip_xs -
ip_ms -
Method Detail

createHorizontal

public static Curve createHorizontal(double y)
Creates a horizontal curve.

Parameters:
y - the y-intercept of the curve
Returns:
a Curve instance

createBurstDelay

public static Curve createBurstDelay(double t)
Creates a burst delay curve.

Parameters:
t - the delay, which must be >= 0.0
Returns:
a Curve instance

createTokenBucket

public static Curve createTokenBucket(double b,
                                      double r)
Creates a new token bucket curve.

Parameters:
b - the burstiness
r - the rate
Returns:
a Curve instance

createRateLatency

public static Curve createRateLatency(double t,
                                      double r)
Creates a new rate latency curve.

Parameters:
t - the latency
r - the rate
Returns:
a Curve instance

createFromTokenBuckets

public static Curve createFromTokenBuckets(java.util.List token_buckets)
Creates a new curve from a list of token bucket curves.

Parameters:
token_buckets - a list of token bucket curves
Returns:
a Curve instance

copy

public Curve copy()
Returns a copy of this instance.

Returns:
a copy of this instance.

setCreateLabels

public static void setCreateLabels(boolean create_labels)
Whether to auto-create labels for curves.

Parameters:
create_labels -

getLabel

public java.lang.String getLabel()
Description copied from interface: Function
Returns a string with an automatically created label for the function. May be an empty string, but not null.

Specified by:
getLabel in interface Function
Returns:
the label

setAlias

public void setAlias(java.lang.String alias)
Description copied from interface: Function
Allows the user to set an alias name for the function which overrides the automatically created label. The alias is used for displaying purposes and for the creation of labels for derived functions.

Specified by:
setAlias in interface Function
Parameters:
alias - the alias name

getAlias

public java.lang.String getAlias()
Description copied from interface: Function
Returns a string with a user-defined alias name for the function. If no alias is set, must return the function's label.

Specified by:
getAlias in interface Function
Returns:
the alias name

getSegmentCount

public int getSegmentCount()
Returns the number of segments in this curve.

Specified by:
getSegmentCount in interface PWLFunction
Returns:
the number of segments

getIPX

public double getIPX(int i)
Returns the x-coordinate of inflection point i.

Specified by:
getIPX in interface PWLFunction
Parameters:
i - the index of the IP.
Returns:
the x-coordinate of the inflection point.

getIPY

public double getIPY(int i)
Returns the y-coordinate of inflection point i.

Specified by:
getIPY in interface PWLFunction
Parameters:
i - the index of the IP.
Returns:
the y-coordinate of the inflection point.

getSustainedRate

public double getSustainedRate()
Returns the sustained rate (the gradient of the last segment).

Returns:
the sustained rate.

getHighestRate

public double getHighestRate()
Returns the highest rate (the steepest gradient of any segment).

Returns:
the highest rate.

setSustainedRate

public void setSustainedRate(double r)
Sets the sustained rate (the gradient of the last segment). Note: No checks are performed when setting the sustained rate. The caller has to ensure that r is larger (smaller) than the gradient of the 2nd-to-last segment to keep the curve convex (concave).

Parameters:
r - the new sustained rate

isLeftopen

public boolean isLeftopen(int i)
Returns whether the inflection point i is excluded from the segment or not.

Specified by:
isLeftopen in interface PWLFunction
Parameters:
i - the index of the IP.
Returns:
true if the IP is excluded, false if not.

isDiscontinuity

public boolean isDiscontinuity(int i)
Returns whether the inflection point is a (real or unreal) discontinuity.

Parameters:
i - the index of the IP
Returns:
true if the IP is a discontinuity, false if not.

isRealDiscontinuity

public boolean isRealDiscontinuity(int i)
Returns whether the inflection point is a real discontinuity, i.e. the y0 of the leftopen segment differs from the previous one.

Parameters:
i - the index of the IP
Returns:
true if the IP is a real discontinuity, false if not.

isUnrealDiscontinuity

public boolean isUnrealDiscontinuity(int i)
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.

Parameters:
i - the index of the IP
Returns:
true if the IP is an unreal discontinuity, false if not.

isBurstDelay

public boolean isBurstDelay()
Returns whether the current curve is a burst delay curve.

Returns:
true if the curve is burst delay, false otherwise

addSegment

public 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.

Parameters:
s - the segment to be added.

addSegment

public void addSegment(int pos,
                       LinearSegment s)
Adds a LinearSegment at the location pos of the curve.
Note: It is the user's responsibility to add segments in the order of increasing x-coordinates.

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 position pos.

Parameters:
pos - the index of the segment to be removed.

markDiscontinuities

public void markDiscontinuities()
Marks discontinuities (subsequent segments having the same x-coordinate) by setting leftopen of the second segment.


computeYs

public void computeYs(int start)
Computes the y-coordinates of inflection points starting with inflection point start.

Parameters:
start - the IP at which to start computing y-coordinates.

getTBComponentCount

public int getTBComponentCount()
Returns the number of token buckets the curve can be decomposed into.

Returns:
the number of token buckets

getTBComponents

public final java.util.List getTBComponents()
Returns a list of token bucket curves that this curve can be decomposed into.

Returns:
the list of token buckets

getTBComponent

public Curve getTBComponent(int i)
Returns the ith token bucket curve that this curve can be decomposed into.

Parameters:
i - the number of the token bucket
Returns:
the token bucket

getTBBurst

public double getTBBurst()
Returns the burstiness of this token bucket curve.
Note: For performance reasons there are no sanity checks! Only call this method on a valid token bucket curve!

Returns:
the burstiness

setTBBurst

public void setTBBurst(double b)
Sets the burstiness of this token bucket curve.
Note: For performance reasons there are no sanity checks! Only call this method on a valid token bucket curve!

Parameters:
b - the burstiness

makeTBRightContinuous

public void makeTBRightContinuous()
Makes the token bucket curve right-continuous.
Note: For performance reasons there are no sanity checks! Only call this method on a valid token bucket curve!


undoMakeTBRightContinuous

public void undoMakeTBRightContinuous()
Undoes the makeTBRightContinuous() operation.
Note: For performance reasons there are no sanity checks! Only call this method on a valid token bucket curve!


getRLComponentCount

public int getRLComponentCount()
Returns the number of rate latency curves the curve can be decomposed into.

Returns:
the number of rate latency curves

getRLComponents

public final java.util.List getRLComponents()
Returns a list of rate latency curves that this curve can be decomposed into.

Returns:
the list of rate latency curves

getRLComponent

public Curve getRLComponent(int i)
Returns the ith rate latency curve that this curve can be decomposed into.

Parameters:
i - the number of the rate latency curve
Returns:
the rate latency curve

beautify

public void beautify()
Removes unnecessary segments.


getSegmentDefining

public int getSegmentDefining(double x)
Returns the number of the segment that defines the function value at x-coordinate 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.

Parameters:
x - the x-coordinate
Returns:
the index of the segment into the array.

f

public double f(double x)
Returns the function value at x-coordinate x, if x>=0, and NaN if not.

Specified by:
f in interface Function
Parameters:
x - the x-coordinate
Returns:
the function value

getGradientAt

public double getGradientAt(double x)
Returns the curve's gradient at x-coordinate x, if x>=0, and NaN if not. Note that the gradient returned at discontinuities is 0.0, the gradient returned at an inflection point is the gradient of the linear segment right of the inflection point, but only if the segment is not left-open.

Specified by:
getGradientAt in interface Function
Parameters:
x - the x-coordinate
Returns:
the gradient

getSegmentLimitRight

public int getSegmentLimitRight(double 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. 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.

Parameters:
x - the x-coordinate
Returns:
the index of the segment into the array.

fLimitRight

public double fLimitRight(double x)
Returns the limit to the right of the function value at x-coordinate x, if x>=0, and NaN if not.

Parameters:
x - the x-coordinate
Returns:
the function value

getGradientLimitRight

public double getGradientLimitRight(double x)
Returns the gradient to the right of the function value at x-coordinate x, if x>=0, and NaN if not.

Parameters:
x - the x-coordinate
Returns:
the function value

getSegmentFirstAtValue

public int getSegmentFirstAtValue(double y)
Returns the first segment at which the function reaches the value y. It returns -1 if the curve never reaches this value.

Parameters:
y - the y-coordinate
Returns:
the segment number

f_inv

public double f_inv(double y)
Returns the smallest x value at which the function value is equal to y.

Parameters:
y - the y-coordinate
Returns:
the smallest x value

f_inv

public double f_inv(double y,
                    boolean rightmost)
Returns the x value at which the function value is equal to y. If rightmost is true, returns the rightmost x-coordinate, otherwise the leftmost coordinate.

Parameters:
y - the y-coordinate
Returns:
the smallest x value

getMinX

public double getMinX()
Returns the smallest x for which the curve is defined.

Specified by:
getMinX in interface Function
Returns:
the lower bound of the definition interval.

getMaxX

public double getMaxX()
Returns the largest x for which the curve is defined.

Specified by:
getMaxX in interface Function
Returns:
the upper bound of the definition interval.

isWideSenseIncreasing

public boolean isWideSenseIncreasing()
Tests whether the curve is wide-sense increasing.

Returns:
whether the curve is wide-sense increasing.

isArrivalCurve

public boolean isArrivalCurve()
Tests whether the curve is wide-sense increasing and satisfies f(0)=0.

Returns:
whether the curve is an arrival curve.

isConvex

public boolean isConvex()
Tests whether the curve is convex.

Returns:
whether the curve is convex.

isConvexIn

public boolean isConvexIn(double a,
                          double b)
Tests whether the curve is convex in [a,b].

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.

Returns:
whether the curve is concave.

isConcaveIn

public boolean isConcaveIn(double a,
                           double b)
Tests whether the curve is concave in [a,b].

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.

Returns:
whether the curve is almost concave.

add

public Curve add(Curve other)
Returns a curve that is the sum of this curve and the given curve.

Parameters:
other - the given curve.
Returns:
the sum of curves

sub

public Curve sub(Curve other)
Returns a curve that is the difference between this curve and the given curve.

Parameters:
other - the given curve.
Returns:
the difference between curves

min

public Curve min(Curve other)
Returns a curve that is the minimum of this curve and the given curve.

Parameters:
other - the given curve.
Returns:
the minimum of curves

max

public Curve max(Curve other)
Returns a curve that is the maximum of this curve and the given curve.

Parameters:
other - the given curve.
Returns:
the maximum of curves

shiftRight

public Curve shiftRight(double dx)
Returns a copy of this curve that is shifted to the right by dx, i.e. g(x) = f(x-dx).

Parameters:
dx - the offset to shift the curve.
Returns:
the shifted curve.

shiftLeftClipping

public Curve shiftLeftClipping(double dx)
Returns a copy of this curve that is shifted to the left by dx, i.e. g(x) = f(x+dx). Note that the new curve is clipped at the y-axis so that in most cases c.shiftLeftClipping(dx).shiftRight(dx) != c!

Parameters:
dx - the offset to shift the curve.
Returns:
the shifted curve.

removeLatency

public Curve removeLatency()
Returns a copy of this curve with latency removed, i.e. shifted left by the latency.

Returns:
a copy of this curve without latency

boundAtXAxis

public Curve boundAtXAxis()
Returns a copy of this curve bounded at the x-axis.

Returns:
the bounded curve.

add

public Curve add(double dy)
Returns a copy of this curve shifted vertically by dy.

Parameters:
dy - the offset to shift the curve.
Returns:
the shifted curve.

getLatency

public double getLatency()
Returns the x-coordinate of the inflection point after which the function values are greater than zero.

Returns:
the latency of this curve.

convolveAlmostConcave

public Curve convolveAlmostConcave(Curve other)
Returns the convolution of this curve, which must be (almost) concave, and the given curve, which must also be (almost) concave.

Parameters:
other - the curve to convolve with.
Returns:
the convolved curve.

convolveConvex

public Curve convolveConvex(Curve other)
Returns the convolution of this curve, which must be convex, and the given curve, which must also be convex.

Parameters:
other - the curve to convolve with.
Returns:
the convolved curve.

deconvolve

public Curve deconvolve(Curve other)
Returns the deconvolution of this curve, which must be (almost) concave, and the given curve, which must convex.

Parameters:
other - the curve to convolve with.
Returns:
the convolved curve.

makeArrivalCurve

public Curve makeArrivalCurve()
Returns a copy of this curve ensuring that f(0)=0.

Returns:
a copy with with f(0) set to 0

computeFIFOServiceCurve

public static Curve computeFIFOServiceCurve(Curve alpha,
                                            Curve beta)
Computes the effetive FIFO service curve for a server with the service curve beta experiencing cross-traffic with arrival curve alpha.

Parameters:
alpha - arrival curve of cross-traffic
beta - server's service curve
Returns:
the FIFO service curve

getBacklogBound

public static double getBacklogBound(Curve alpha,
                                     Curve beta)
Returns the backlog bound of the given two curves.

Parameters:
alpha - the arrival curve.
beta - the service curve.
Returns:
the value of the backlog bound.

getVerticalDeviation

public static double getVerticalDeviation(Curve c1,
                                          Curve c2)
Returns the vertical deviation between the given two curves.

Parameters:
c1 - the first curve.
c2 - the second curve.
Returns:
the value of the vertical deviation.

getDelayBound

public static double getDelayBound(Curve alpha,
                                   Curve beta)
Returns the delay bound of the given two curves.

Parameters:
alpha - the arrival curve.
beta - the service curve.
Returns:
the value of the delay bound.

getHorizontalDeviation

public static double getHorizontalDeviation(Curve c1,
                                            Curve c2)
Returns the horizontal deviation between the given two curves.

Parameters:
c1 - the first curve.
c2 - the second curve.
Returns:
the value of the horizontal deviation.

computeInflectionPointsX

public static java.util.ArrayList computeInflectionPointsX(Curve c1,
                                                           Curve c2)
Returns an ArrayList instance of those x-coordinates at which either c1 or c2 or both have an inflection point. There will be multiple occurences of an x-coordinate, if at least one curve has a discontinuity at that x-coordinate.

Parameters:
c1 - the first curve.
c2 - the second curve.
Returns:
an ArrayList of Double objects containing the x-coordinates of the respective inflection point.

computeInflectionPointsY

public static java.util.ArrayList computeInflectionPointsY(Curve c1,
                                                           Curve c2)
Returns an ArrayList instance of those y-coordinates at which either c1 or c2 or both have an inflection point.

Parameters:
c1 - the first curve.
c2 - the second curve.
Returns:
an ArrayList of Double objects containing the x-coordinates of the respective inflection point.

getYIntervals

public java.util.List getYIntervals()
Returns a list containing each segment's height when projected onto the y-axis.

Returns:
a list of doubles containing the segment heights

approximateSegments

public int approximateSegments(double dy)
Approximates arrival curve by removing all segments whose projection onto the y-axis has a height smaller than dy. Returns the number of removed segments.

Parameters:
dy - the height below which segments are removed
Returns:
the number of removed segments

approximateAtSegment

public void approximateAtSegment(int i)
Approximates a (concave) arrival curve by removing the specified segment.

Parameters:
i - the index of the segment to remove

toString

public java.lang.String toString()
Returns a string representation of this curve.

Overrides:
toString in class java.lang.Object
Returns:
the curve represented as a string.

dump

public void dump()
Prints the string representation of this curve to stdout.