|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart3djava.Point3DArray
public class Point3DArray
Summary description for Point3DArray. It is a improved version of the standard Array type because it allows automatic and dynamic resizing of the array. The array has a Length property that specifies the number of elements in the array, and a maxCapacity property that specifies the size of the protected Array buffer. The protected buffer can be sized much larger than the Length property, allowing the array to grow in length without forcing a time consuming reallocation and the subsequent copying of all of the data values. Not really important if you are dealing with 10 or 20 element arrays, but very important if you have 1,000,000 element arrays.
Constructor Summary | |
---|---|
Point3DArray()
Default constructor. |
|
Point3DArray(ChartPoint3D[] x)
Constructor initializes the array using the specified data values. |
|
Point3DArray(ChartPoint3D[] x,
int maxcap)
Constructor initializes the array using the specified data values. |
|
Point3DArray(int n)
Constructor creates an array of Length n, initialized to zero. |
|
Point3DArray(int n,
ChartPoint3D initvalue)
Constructor initializes the array using the specified data values. |
Method Summary | |
---|---|
int |
add(ChartPoint3D r)
Adds a new element at the end of the array, increasing the length of the array by one. |
int |
addRange(ChartPoint3D[] x)
Adds a array of new values at the end of the array, increasing the length of the array by the length of the source array. |
static void |
arrayCopy(ChartPoint3D[] source,
int sourceoffset,
ChartPoint3D[] dest,
int destoffset,
int count)
Copy routine for arrays of ChartPoint3D objects. |
void |
clear()
Resets (same as Clear) the Length property to 0, the MaxCapacity property to 16 and reallocates the protected buffer to MaxCapacity. |
java.lang.Object |
clone()
Returns an object that is a clone of this array object. |
void |
closePolygon()
Returns a copy of the data values in the array sized to the number of elements. |
void |
copy(Point3DArray source)
Copies the source array to the current instance. |
int |
count()
This accessor returns the value of the length field which is number of data points in a simple dataset, or the number of x-values in a group dataset. |
ChartPoint3D[] |
DataBuffer()
Returns a reference to the Array object that represents protected data buffer. |
int |
delete(int index)
Removes an element at the specified index, decreasing the length of the array by one. |
ChartPoint3D[] |
getCopyOfElements()
Returns a copy of the data values in the array sized to the number of elements. |
ChartPoint3D[] |
getDataBuffer()
Returns a reference to the Array object that represents protected data buffer. |
ChartPoint3D |
getElement(int index)
Get the value of a single element in the array. |
ChartPoint3D[] |
getElements()
Returns a copy of the data values in the array sized to the number of elements. |
int |
insert(int index,
ChartPoint3D r)
Inserts an element in the array at the specified index, increasing the length of the array by one. |
int |
length()
This accessor returns the value of the length field which is number of data points in a simple dataset, or the number of x-values in a group dataset. |
int |
maxCapacity()
This accessor returns the value of the maxCapacity field. |
void |
nDCopy(Point3DArray source)
Non-Destructive copy does not reallocate buffers, limits copy to the number of elements in the smaller of two arrays, the source or the current instance. |
int |
removeAt(int index)
Removes an element at the specified index, decreasing the length of the array by one. |
void |
reset()
Resets the Length property to 0, the MaxCapacity property to 16 and reallocates the protected buffer to MaxCapacity. |
int |
resize(int newlength)
The length of the arrays is set to the specified value. |
void |
resizeCapacity(int newcapacity)
This method reallocates the protected data buffer to the new capacity value. |
void |
setElement(int index,
ChartPoint3D r)
Set the value of a single element in the array. |
int |
setElements(ChartPoint3D[] source)
Initializes the elements of the array, starting at element 0. |
int |
setElements(ChartPoint3D[] source,
int count)
Initializes the elements of the array, starting at element 0 and continuing for count elements. |
int |
setElements(Point3DArray source)
Initializes the elements of the array, starting at element 0. |
int |
setElements(Point3DArray source,
int count)
Initializes the elements of the array, starting at element 0 and continuing for count elements. |
int |
setLength(int newlength)
Resizes the array to the specified length. |
void |
shiftLeft(int shiftcount,
boolean fillzero)
Shifts the elements of the array to the left. |
int |
shiftLeftThenResize(int shiftcount,
boolean trim)
Shifts the elements of the array to the left. |
void |
shiftRight(int shiftcount,
boolean fillzero)
Shifts the elements of the array to the right. |
void |
trimToSize()
The MaxCapacity property is set equal to the Length property of the array and the protected buffer are resized to the new MaxCapacity value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Point3DArray()
public Point3DArray(int n)
n
- The array is sized to n elements.public Point3DArray(ChartPoint3D[] x, int maxcap)
x
- The initializing data values.maxcap
- The protected buffer holding the data values is sized to the value of maxcap.
If the number of datavalues exceeds the maxcap limit, the size of maxcap is automatically doubled.public Point3DArray(ChartPoint3D[] x)
x
- The initializing data values.public Point3DArray(int n, ChartPoint3D initvalue)
n
- The array is sized to n elements.initvalue
- The array is initialized to this value.Method Detail |
---|
public static void arrayCopy(ChartPoint3D[] source, int sourceoffset, ChartPoint3D[] dest, int destoffset, int count)
source
- Source arraysourceoffset
- Offset to start copying fromdest
- Destination arraydestoffset
- Destination offset to start copying to.count
- Number of elements to copypublic void copy(Point3DArray source)
source
- The source array object.public void nDCopy(Point3DArray source)
source
- The source array object.public java.lang.Object clone()
clone
in class java.lang.Object
public void resizeCapacity(int newcapacity)
newcapacity
- The protected buffer holding the data values is sized to the new value of new capacity.
The Length property remains unchanged if the new buffer size is larger than the old buffer size, only the
buffer size is changed, not the current number of elements in the array. param>public void reset()
public void clear()
public void shiftLeft(int shiftcount, boolean fillzero)
shiftcount
- The elements are shifted to left by shiftcount elements.fillzero
- Set to true if elements to the right of the final shift point are to be set to zero.
In the example above this would apply to elements 8 and 9 in the final, shifted array.public void shiftRight(int shiftcount, boolean fillzero)
shiftcount
- The elements are shifted to right by shiftcount elements.fillzero
- Set to true if elements to the left of the final shift point are to be set to zero.
In the example above this would apply to elements 0 and 1 in the final, shifted array.public int shiftLeftThenResize(int shiftcount, boolean trim)
shiftcount
- The elements are shifted to left by shiftcount elements.trim
- Set to true if the MaxCapacity property is to be set equal to Length property,
sizing the protected data buffers to the exact array size.
public int insert(int index, ChartPoint3D r)
index
- The array element where the new value is inserted.r
- The new value to insert.
public int removeAt(int index)
index
- The array element that is deleted.
public int delete(int index)
index
- The array element that is deleted.
public int setLength(int newlength)
newlength
- The array is resized to the new length.
public void trimToSize()
public int resize(int newlength)
newlength
- The array is resized to the new length.
public int add(ChartPoint3D r)
r
- The new value to add at the end of the array.
public int addRange(ChartPoint3D[] x)
x
- An array of new values that are added to the end of the array.
public int setElements(ChartPoint3D[] source)
source
- An array of new values used to initialize the array. The
array will end up the same size as the source array.
public int setElements(ChartPoint3D[] source, int count)
source
- An array of new values used to initialize the array. The
array will end up the same size as the source array, or the count value, whichever is smaller.count
- Specifies the number of elements to initialize.
public int setElements(Point3DArray source, int count)
source
- An array of new values used to initialize the array. The
array will end up the same size as the source array, or the count value, whichever is smaller.count
- Specifies the number of elements to initialize.
public int setElements(Point3DArray source)
source
- An array of new values used to initialize the array. The
array will end up the same size as the source array.
public void setElement(int index, ChartPoint3D r)
index
- The index to set in the array.r
- The array element at index is set to the value r.public ChartPoint3D getElement(int index)
index
- The array index.
public ChartPoint3D[] getElements()
public ChartPoint3D[] getCopyOfElements()
public void closePolygon()
public ChartPoint3D[] getDataBuffer()
public int length()
public int count()
public int maxCapacity()
public ChartPoint3D[] DataBuffer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |