|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.umd.cs.piccolox.util.XYArray
public class XYArray
Represents a sequence as points that's internally stored as a single array of point components.
| Constructor Summary | |
|---|---|
XYArray()
Constructs an empty XYArray. |
|
XYArray(double[] points)
Constructs an XYArray wrapping the given points. |
|
XYArray(int n)
Constructs an XYArray of the given size. |
|
| Method Summary | |
|---|---|
void |
addPoint(int pos,
double x,
double y)
Adds a point to the index provided. |
void |
addPoint(int pos,
Point2D pt)
Inserts the given point at the given index. |
void |
addPoints(int pos,
Points pts)
Inserts all the provided points at the given position. |
void |
addPoints(int index,
Points newPoints,
int start,
int end)
Adds a subsequence of the points provided at the given position. |
void |
appendPoints(Points pts)
Adds the provided points to the end of the points. |
Object |
clone()
Returns a clone of this XYArray ensuring a deep copy of coordinates is made. |
static XYArray |
copyPoints(Points pts)
Creates an XYArray representing the given points. |
Rectangle2D |
getBounds(Rectangle2D dst)
Modifies dst to be the bounding box of the points represented by this XYArray. |
Point2D |
getPoint(int i,
Point2D dst)
Returns modified point representing the wrapped point at the given index. |
int |
getPointCount()
Returns the number of points this XYArray represents. |
double |
getX(int i)
Returns the x component of the point at the given index. |
double |
getY(int i)
Returns the y component of the point at the given index. |
static double[] |
initPoints(double[] points,
int n,
double[] old)
Constructs an array of point coordinates for n points and copies the old values if provided. |
void |
removeAllPoints()
Remove all points from this XYArray. |
void |
removePoints(int pos,
int num)
Remove a subsequence of points from this XYArray starting as pos. |
void |
setPoint(int i,
double x,
double y)
Sets the coordinates of the point at the given index. |
void |
setPoint(int i,
Point2D pt)
Sets the coordinates of the point at the given index. |
void |
setX(int i,
double x)
Sets the x component of the point at the given index. |
void |
setY(int i,
double y)
Sets the y component of the point at the given index. |
void |
transformPoints(AffineTransform t)
Applies the given transform to all points represented by this XYArray. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XYArray(double[] points)
points - array of coordinates defining the pointspublic XYArray(int n)
n - number of points XYArray should containpublic XYArray()
| Method Detail |
|---|
public int getPointCount()
getPointCount in interface Pointspublic double getX(int i)
getX in interface Pointsi - index of point
public double getY(int i)
getY in interface Pointsi - index of point
public Point2D getPoint(int i,
Point2D dst)
getPoint in interface Pointsi - index of desired pointdst - point to be modified
public void setX(int i,
double x)
i - index of point to modifyx - new x component
public void setY(int i,
double y)
i - index of point to modifyy - new y component
public void setPoint(int i,
double x,
double y)
setPoint in interface MutablePointsi - index of point to modifyx - new x componenty - new y component
public void setPoint(int i,
Point2D pt)
i - index of point to modifypt - point from which coordinate is to be extractedpublic void transformPoints(AffineTransform t)
transformPoints in interface MutablePointst - transform to applypublic Rectangle2D getBounds(Rectangle2D dst)
getBounds in interface Pointsdst - rectangle to be modified
public static double[] initPoints(double[] points,
int n,
double[] old)
points - array to populate with point values, or null to generate a
new arrayn - number of pointsold - old values to repopulate the array with, or null if not
desired
public void addPoints(int index,
Points newPoints,
int start,
int end)
index - position at which the points should be insertednewPoints - points from which to extract the subsequence of pointsstart - the start index within newPoints to start extracting pointsend - the end index within newPoints to finish extracting points
public void addPoints(int pos,
Points pts)
pos - index at which to insert the pointspts - points to be insertedpublic void appendPoints(Points pts)
pts - points to be addedpublic static XYArray copyPoints(Points pts)
pts - points to copy
public void addPoint(int pos,
double x,
double y)
addPoint in interface MutablePointspos - index at which to add the pointx - x coordinate of new pointy - y coordinate of new point
public void addPoint(int pos,
Point2D pt)
pos - index at which to add the pointpt - point to be inserted *
public void removePoints(int pos,
int num)
removePoints in interface MutablePointspos - the position to start removing pointsnum - the number of points to removepublic void removeAllPoints()
public Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||