public class GPointsArray
extends java.lang.Object
Constructor and Description |
---|
GPointsArray()
Constructor
|
GPointsArray(java.util.ArrayList<PVector> vectors)
Constructor
|
GPointsArray(float[] x,
float[] y)
Constructor
|
GPointsArray(float[] x,
float[] y,
java.lang.String[] labels)
Constructor
|
GPointsArray(GPoint[] points)
Constructor
|
GPointsArray(GPointsArray points)
Constructor
|
GPointsArray(int initialSize)
Constructor
|
GPointsArray(PVector[] vectors)
Constructor
|
GPointsArray(PVector[] vectors,
java.lang.String[] labels)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.ArrayList<PVector> vectors)
Adds a new set of points to the array
|
void |
add(float[] x,
float[] y)
Adds a new set of points to the array
|
void |
add(float[] x,
float[] y,
java.lang.String[] labels)
Adds a new set of points to the array
|
void |
add(float x,
float y)
Adds a new point to the array
|
void |
add(float x,
float y,
java.lang.String label)
Adds a new point to the array
|
void |
add(GPoint point)
Adds a new point to the array
|
void |
add(GPoint[] pts)
Adds a new set of points to the array
|
void |
add(GPointsArray pts)
Adds a new set of points to the array
|
void |
add(int index,
float x,
float y)
Adds a new point to the array
|
void |
add(int index,
float x,
float y,
java.lang.String label)
Adds a new point to the array
|
void |
add(int index,
GPoint point)
Adds a new point to the array
|
void |
add(int index,
PVector v)
Adds a new point to the array
|
void |
add(int index,
PVector v,
java.lang.String label)
Adds a new point to the array
|
void |
add(PVector v)
Adds a new point to the array
|
void |
add(PVector[] vectors)
Adds a new set of points to the array
|
void |
add(PVector[] vectors,
java.lang.String[] labels)
Adds a new set of points to the array
|
void |
add(PVector v,
java.lang.String label)
Adds a new point to the array
|
GPoint |
get(int index)
Returns a given point in the array
|
java.lang.String |
getLabel(int index)
Returns the text label of a point in the array
|
GPoint |
getLastPoint()
Returns the latest point added to the array
|
int |
getNPoints()
Returns the total number of points in the array
|
boolean |
getValid(int index)
Returns if a point in the array is valid or not
|
float |
getX(int index)
Returns the x coordinate of a point in the array
|
float |
getY(int index)
Returns the y coordinate of a point in the array
|
boolean |
isValid(int index)
Returns if a point in the array is valid or not
|
void |
remove(int index)
Removes one of the points in the array
|
void |
removeInvalidPoints()
Removes invalid points from the array
|
void |
removeRange(int fromIndex,
int toIndex)
Removes a range of points in the array
|
void |
set(GPointsArray pts)
Sets all the points in the array
|
void |
set(int index,
float x,
float y,
java.lang.String label)
Sets the x and y coordinates of a specific point in the array
|
void |
set(int index,
GPoint point)
Sets the x and y coordinates and the label of a point with those from another point
|
void |
set(int index,
PVector v,
java.lang.String label)
Sets the x and y coordinates of a specific point in the array
|
void |
setLabel(int index,
java.lang.String label)
Sets the text label of a specific point in the array
|
void |
setNPoints(int nPoints)
Sets the total number of points in the array
|
void |
setX(int index,
float x)
Sets the x coordinate of a specific point in the array
|
void |
setXY(int index,
float x,
float y)
Sets the x and y coordinates of a specific point in the array
|
void |
setXY(int index,
PVector v)
Sets the x and y coordinates of a specific point in the array
|
void |
setY(int index,
float y)
Sets the y coordinate of a specific point in the array
|
public GPointsArray()
public GPointsArray(int initialSize)
initialSize
- the initial estimate for the size of the arraypublic GPointsArray(GPoint[] points)
points
- an array of pointspublic GPointsArray(GPointsArray points)
points
- an array of pointspublic GPointsArray(float[] x, float[] y, java.lang.String[] labels)
x
- the points x coordinatesy
- the points y coordinateslabels
- the points text labelspublic GPointsArray(float[] x, float[] y)
x
- the points x coordinatesy
- the points y coordinatespublic GPointsArray(PVector[] vectors, java.lang.String[] labels)
vectors
- an array of Processing vectors with the points x and y coordinateslabels
- the points text labelspublic GPointsArray(PVector[] vectors)
vectors
- an array of Processing vectors with the points x and y coordinatespublic GPointsArray(java.util.ArrayList<PVector> vectors)
vectors
- an arrayList of Processing vectors with the points x and y coordinatespublic void add(GPoint point)
point
- the pointpublic void add(float x, float y, java.lang.String label)
x
- the point x coordinatey
- the point y coordinatelabel
- the point text labelpublic void add(float x, float y)
x
- the point x coordinatey
- the point y coordinatepublic void add(PVector v, java.lang.String label)
v
- the Processing vector with the point x and y coordinateslabel
- the point text labelpublic void add(PVector v)
v
- the Processing vector with the point x and y coordinatespublic void add(int index, GPoint point)
index
- the point positionpoint
- the pointpublic void add(int index, float x, float y, java.lang.String label)
index
- the point positionx
- the point x coordinatey
- the point y coordinatelabel
- the point text labelpublic void add(int index, float x, float y)
index
- the point positionx
- the point x coordinatey
- the point y coordinatepublic void add(int index, PVector v, java.lang.String label)
index
- the point positionv
- the Processing vector with the point x and y coordinateslabel
- the point text labelpublic void add(int index, PVector v)
index
- the point positionv
- the Processing vector with the point x and y coordinatespublic void add(GPoint[] pts)
pts
- the new set of pointspublic void add(GPointsArray pts)
pts
- the new set of pointspublic void add(float[] x, float[] y, java.lang.String[] labels)
x
- the points x coordinatesy
- the points y coordinateslabels
- the points text labelspublic void add(float[] x, float[] y)
x
- the points x coordinatesy
- the points y coordinatespublic void add(PVector[] vectors, java.lang.String[] labels)
vectors
- the Processing vectors with the points x and y coordinateslabels
- the points text labelspublic void add(PVector[] vectors)
vectors
- the Processing vectors with the points x and y coordinatespublic void add(java.util.ArrayList<PVector> vectors)
vectors
- the Processing vectors with the points x and y coordinatespublic void remove(int index)
index
- the point index.public void removeRange(int fromIndex, int toIndex)
fromIndex
- the lower point index.toIndex
- the end point index.public void removeInvalidPoints()
public void set(GPointsArray pts)
pts
- the new points. The number of points could differ from the original.public void set(int index, GPoint point)
index
- the point index. If the index equals the array size, it will add a new point to the array.point
- the point to usepublic void set(int index, float x, float y, java.lang.String label)
index
- the point index. If the index equals the array size, it will add a new point to the array.x
- the point new x coordinatey
- the point new y coordinatelabel
- the point new text labelpublic void set(int index, PVector v, java.lang.String label)
index
- the point index. If the index equals the array size, it will add a new point to the array.v
- the Processing vector with the point new x and y coordinateslabel
- the point new text labelpublic void setX(int index, float x)
index
- the point indexx
- the point new x coordinatepublic void setY(int index, float y)
index
- the point indexy
- the point new y coordinatepublic void setXY(int index, float x, float y)
index
- the point indexx
- the point new x coordinatey
- the point new y coordinatepublic void setXY(int index, PVector v)
index
- the point indexv
- the Processing vector with the point new x and y coordinatespublic void setLabel(int index, java.lang.String label)
index
- the point indexlabel
- the point new text labelpublic void setNPoints(int nPoints)
nPoints
- the new total number of points in the array. It should be smaller than the current number.public int getNPoints()
public GPoint get(int index)
index
- the point index in the arraypublic float getX(int index)
index
- the point index in the arraypublic float getY(int index)
index
- the point index in the arraypublic java.lang.String getLabel(int index)
index
- the point index in the arraypublic boolean getValid(int index)
index
- the point index in the arraypublic boolean isValid(int index)
index
- the point index in the arraypublic GPoint getLastPoint()
Processing Library grafica by Javier Gracia Carpio. (c) 2015