Package com.graphbuilder.curve
Class ControlPath
java.lang.Object
com.graphbuilder.curve.ControlPath
A ControlPath is a container of Point objects and Curve objects. The control-path uses arrays to store the points and curves. Methods that accept objects will throw an IllegalArgumentException if those objects are null. Methods that accept index values will throw an IllegalArgumentException if those index values are out of range.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a curve to the curve array at index location numCurves.voidAdds a point to the point array at index location numPoints.voidensureCurveCapacity(int capacity) Checks that the curve array has the specified capacity, otherwise the capacity of the curve array is increased to be the maximum between twice the current capacity or the specified capacity.voidensurePointCapacity(int capacity) Checks that the point array has the specified capacity, otherwise the capacity of the point array is increased to be the maximum between twice the current capacity or the specified capacity.getCurve(int index) Returns the curve at the specified index.getPoint(int index) Returns the point at the specified index.voidinsertCurve(Curve c, int index) Inserts a curve at the specified index in the curve array.voidinsertPoint(Point p, int index) Inserts a point at the specified index in the point array.intReturns the number of curves in the control-path.intReturns the number of points in the control-path.voidremoveCurve(int index) Removes the curve at the specified index location.voidremoveCurve(Curve c) Removes the first occurrence of the specified curve from the curve array.voidremovePoint(int index) Removes the point at the specified index location.voidremovePoint(Point p) Removes the first occurrence of the specified point from the point array.Sets a curve at the specified index in the curve array, returning the curve that was at that index.Sets a point at the specified index in the point array, returning the point that was at that index.voidCreates a new curve array of exact size, copying the curves from the old array into the new one.voidCreates a new point array of exact size, copying the points from the old array into the new one.
-
Constructor Details
-
ControlPath
public ControlPath()Creates a control-path.
-
-
Method Details
-
addCurve
Adds a curve to the curve array at index location numCurves.- Throws:
IllegalArgumentException- If the specified curve is null.
-
addPoint
Adds a point to the point array at index location numPoints.- Throws:
IllegalArgumentException- If the specified point is null.
-
insertCurve
Inserts a curve at the specified index in the curve array.- Throws:
IllegalArgumentException- If the specified curve is null.
-
insertPoint
Inserts a point at the specified index in the point array.- Throws:
IllegalArgumentException- If the specified point is null.
-
setCurve
Sets a curve at the specified index in the curve array, returning the curve that was at that index.- Throws:
IllegalArgumentException- If the specified curve is null.
-
setPoint
Sets a point at the specified index in the point array, returning the point that was at that index.- Throws:
IllegalArgumentException- If the specified point is null.
-
getCurve
Returns the curve at the specified index. -
getPoint
Returns the point at the specified index. -
numCurves
public int numCurves()Returns the number of curves in the control-path. -
numPoints
public int numPoints()Returns the number of points in the control-path. -
removeCurve
Removes the first occurrence of the specified curve from the curve array. -
removePoint
Removes the first occurrence of the specified point from the point array. -
removeCurve
public void removeCurve(int index) Removes the curve at the specified index location. -
removePoint
public void removePoint(int index) Removes the point at the specified index location. -
ensureCurveCapacity
public void ensureCurveCapacity(int capacity) Checks that the curve array has the specified capacity, otherwise the capacity of the curve array is increased to be the maximum between twice the current capacity or the specified capacity. -
ensurePointCapacity
public void ensurePointCapacity(int capacity) Checks that the point array has the specified capacity, otherwise the capacity of the point array is increased to be the maximum between twice the current capacity or the specified capacity. -
trimCurveArray
public void trimCurveArray()Creates a new curve array of exact size, copying the curves from the old array into the new one. -
trimPointArray
public void trimPointArray()Creates a new point array of exact size, copying the points from the old array into the new one.
-