grafica
Class GPointsArray

java.lang.Object
  extended by grafica.GPointsArray

public class GPointsArray
extends Object

Array of points class.

Author:
Javier Gracia Carpio http://www.openprocessing.org/user/16300

Constructor Summary
GPointsArray()
          Constructor
GPointsArray(ArrayList<PVector> vectors)
          Constructor
GPointsArray(float[] x, float[] y)
          Constructor
GPointsArray(float[] x, float[] y, String[] labels)
          Constructor
GPointsArray(GPoint[] points)
          Constructor
GPointsArray(GPointsArray points)
          Constructor
GPointsArray(int initialSize)
          Constructor
GPointsArray(PVector[] vectors)
          Constructor
GPointsArray(PVector[] vectors, String[] labels)
          Constructor
 
Method Summary
 void add(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, 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, 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, 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, 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, String[] labels)
          Adds a new set of points to the array
 void add(PVector v, String label)
          Adds a new point to the array
 GPoint get(int index)
          Returns a given point in the array
 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, 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, String label)
          Sets the x and y coordinates of a specific point in the array
 void setLabel(int index, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPointsArray

public GPointsArray()
Constructor


GPointsArray

public GPointsArray(int initialSize)
Constructor

Parameters:
initialSize - the initial estimate for the size of the array

GPointsArray

public GPointsArray(GPoint[] points)
Constructor

Parameters:
points - an array of points

GPointsArray

public GPointsArray(GPointsArray points)
Constructor

Parameters:
points - an array of points

GPointsArray

public GPointsArray(float[] x,
                    float[] y,
                    String[] labels)
Constructor

Parameters:
x - the points x coordinates
y - the points y coordinates
labels - the points text labels

GPointsArray

public GPointsArray(float[] x,
                    float[] y)
Constructor

Parameters:
x - the points x coordinates
y - the points y coordinates

GPointsArray

public GPointsArray(PVector[] vectors,
                    String[] labels)
Constructor

Parameters:
vectors - an array of Processing vectors with the points x and y coordinates
labels - the points text labels

GPointsArray

public GPointsArray(PVector[] vectors)
Constructor

Parameters:
vectors - an array of Processing vectors with the points x and y coordinates

GPointsArray

public GPointsArray(ArrayList<PVector> vectors)
Constructor

Parameters:
vectors - an arrayList of Processing vectors with the points x and y coordinates
Method Detail

add

public void add(GPoint point)
Adds a new point to the array

Parameters:
point - the point

add

public void add(float x,
                float y,
                String label)
Adds a new point to the array

Parameters:
x - the point x coordinate
y - the point y coordinate
label - the point text label

add

public void add(float x,
                float y)
Adds a new point to the array

Parameters:
x - the point x coordinate
y - the point y coordinate

add

public void add(PVector v,
                String label)
Adds a new point to the array

Parameters:
v - the Processing vector with the point x and y coordinates
label - the point text label

add

public void add(PVector v)
Adds a new point to the array

Parameters:
v - the Processing vector with the point x and y coordinates

add

public void add(int index,
                GPoint point)
Adds a new point to the array

Parameters:
index - the point position
point - the point

add

public void add(int index,
                float x,
                float y,
                String label)
Adds a new point to the array

Parameters:
index - the point position
x - the point x coordinate
y - the point y coordinate
label - the point text label

add

public void add(int index,
                float x,
                float y)
Adds a new point to the array

Parameters:
index - the point position
x - the point x coordinate
y - the point y coordinate

add

public void add(int index,
                PVector v,
                String label)
Adds a new point to the array

Parameters:
index - the point position
v - the Processing vector with the point x and y coordinates
label - the point text label

add

public void add(int index,
                PVector v)
Adds a new point to the array

Parameters:
index - the point position
v - the Processing vector with the point x and y coordinates

add

public void add(GPoint[] pts)
Adds a new set of points to the array

Parameters:
pts - the new set of points

add

public void add(GPointsArray pts)
Adds a new set of points to the array

Parameters:
pts - the new set of points

add

public void add(float[] x,
                float[] y,
                String[] labels)
Adds a new set of points to the array

Parameters:
x - the points x coordinates
y - the points y coordinates
labels - the points text labels

add

public void add(float[] x,
                float[] y)
Adds a new set of points to the array

Parameters:
x - the points x coordinates
y - the points y coordinates

add

public void add(PVector[] vectors,
                String[] labels)
Adds a new set of points to the array

Parameters:
vectors - the Processing vectors with the points x and y coordinates
labels - the points text labels

add

public void add(PVector[] vectors)
Adds a new set of points to the array

Parameters:
vectors - the Processing vectors with the points x and y coordinates

add

public void add(ArrayList<PVector> vectors)
Adds a new set of points to the array

Parameters:
vectors - the Processing vectors with the points x and y coordinates

remove

public void remove(int index)
Removes one of the points in the array

Parameters:
index - the point index.

removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Removes a range of points in the array

Parameters:
fromIndex - the lower point index.
toIndex - the end point index.

removeInvalidPoints

public void removeInvalidPoints()
Removes invalid points from the array


set

public void set(GPointsArray pts)
Sets all the points in the array

Parameters:
pts - the new points. The number of points could differ from the original.

set

public void set(int index,
                GPoint point)
Sets the x and y coordinates and the label of a point with those from another point

Parameters:
index - the point index. If the index equals the array size, it will add a new point to the array.
point - the point to use

set

public void set(int index,
                float x,
                float y,
                String label)
Sets the x and y coordinates of a specific point in the array

Parameters:
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 coordinate
y - the point new y coordinate
label - the point new text label

set

public void set(int index,
                PVector v,
                String label)
Sets the x and y coordinates of a specific point in the array

Parameters:
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 coordinates
label - the point new text label

setX

public void setX(int index,
                 float x)
Sets the x coordinate of a specific point in the array

Parameters:
index - the point index
x - the point new x coordinate

setY

public void setY(int index,
                 float y)
Sets the y coordinate of a specific point in the array

Parameters:
index - the point index
y - the point new y coordinate

setXY

public void setXY(int index,
                  float x,
                  float y)
Sets the x and y coordinates of a specific point in the array

Parameters:
index - the point index
x - the point new x coordinate
y - the point new y coordinate

setXY

public void setXY(int index,
                  PVector v)
Sets the x and y coordinates of a specific point in the array

Parameters:
index - the point index
v - the Processing vector with the point new x and y coordinates

setLabel

public void setLabel(int index,
                     String label)
Sets the text label of a specific point in the array

Parameters:
index - the point index
label - the point new text label

setNPoints

public void setNPoints(int nPoints)
Sets the total number of points in the array

Parameters:
nPoints - the new total number of points in the array. It should be smaller than the current number.

getNPoints

public int getNPoints()
Returns the total number of points in the array

Returns:
the total number of points in the array

get

public GPoint get(int index)
Returns a given point in the array

Parameters:
index - the point index in the array
Returns:
the point reference

getX

public float getX(int index)
Returns the x coordinate of a point in the array

Parameters:
index - the point index in the array
Returns:
the point x coordinate

getY

public float getY(int index)
Returns the y coordinate of a point in the array

Parameters:
index - the point index in the array
Returns:
the point y coordinate

getLabel

public String getLabel(int index)
Returns the text label of a point in the array

Parameters:
index - the point index in the array
Returns:
the point text label

getValid

public boolean getValid(int index)
Returns if a point in the array is valid or not

Parameters:
index - the point index in the array
Returns:
true if the point is valid

isValid

public boolean isValid(int index)
Returns if a point in the array is valid or not

Parameters:
index - the point index in the array
Returns:
true if the point is valid

getLastPoint

public GPoint getLastPoint()
Returns the latest point added to the array

Returns:
the latest point added to the array


Processing library grafica by Javier Gracia Carpio. (c) 2013