com.quinncurtis.chart3djava
Class TimeArray

java.lang.Object
  extended by com.quinncurtis.chart3djava.DoubleArray
      extended by com.quinncurtis.chart3djava.TimeArray

public class TimeArray
extends DoubleArray

Author:
Richard Quinn TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Constructor Summary
TimeArray()
          Default constructor.
TimeArray(java.util.GregorianCalendar[] x)
          Constructor initializes the array using the specified data values.
TimeArray(java.util.GregorianCalendar[] x, int maxcap)
          Constructor initializes the array using the specified data values.
TimeArray(int n)
          Constructor creates an array of Length n, initialized to zero.
 
Method Summary
 int add(java.util.GregorianCalendar r)
          Adds a new element at the end of the array, increasing the length of the array by one.
 int addRange(java.util.GregorianCalendar[] 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(java.util.GregorianCalendar[] source, int sourceoffset, double[] dest, int destoffset, int count)
          Copy routine for arrays of Time objects.
 java.lang.Object clone()
          Returns an object that is a clone of this array object.
 void copy(TimeArray source)
          Copies the source array to the current instance.
 java.util.GregorianCalendar[] getTimeDataBuffer()
          Returns a reference to the Array object that represents protected data buffer.
 java.util.GregorianCalendar getTimeElement(int index)
          Get the value of a single element in the array.
 java.util.GregorianCalendar[] getTimeElements()
          Returns a copy of the data values in the array sized to the number of elements.
 void setElement(int index, java.util.GregorianCalendar r)
          Set the value of a single element in the array.
 int setElements(java.util.GregorianCalendar[] source)
          Initializes the elements of the array, starting at element 0.
 int setElements(java.util.GregorianCalendar[] source, int count)
          Initializes the elements of the array, starting at element 0 and continuing for count elements.
 int setElements(TimeArray source)
          Initializes the elements of the array, starting at element 0.
 int setElements(TimeArray source, int count)
          Initializes the elements of the array, starting at element 0 and continuing for count elements.
 java.util.GregorianCalendar[] TimeDataBuffer()
          Returns a reference to the Array object that represents protected data buffer.
 
Methods inherited from class com.quinncurtis.chart3djava.DoubleArray
add, addRange, arrayCopy, clear, copy, copyArray, DataBuffer, delete, getDataBuffer, getElement, getElements, insert, length, maxCapacity, nDCopy, removeAt, reset, resize, resizeCapacity, setElement, setElements, setElements, setElements, setElements, setLength, shiftLeft, shiftLeftThenResize, shiftRight, TrimToSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeArray

public TimeArray()
Default constructor.


TimeArray

public TimeArray(int n)
Constructor creates an array of Length n, initialized to zero.

Parameters:
n - The array is sized to n elements.

TimeArray

public TimeArray(java.util.GregorianCalendar[] x,
                 int maxcap)
Constructor initializes the array using the specified data values. The number of elements of the array is set to the Length of the initializing array, while the protected buffer used to hold the data is sized to maxcap.

Parameters:
x - The initializing data values.
maxcap - The protected buffer holding the data values is sized to the value of maxcap. If the number of data values exceeds the maxcap limit, the size of maxcap is automatically doubled.

TimeArray

public TimeArray(java.util.GregorianCalendar[] x)
Constructor initializes the array using the specified data values. The number of elements of the array is set to the Length of the source array, and the protected buffer used to hold the data is set to the same size.

Parameters:
x - The initializing data values.
Method Detail

arrayCopy

public static void arrayCopy(java.util.GregorianCalendar[] source,
                             int sourceoffset,
                             double[] dest,
                             int destoffset,
                             int count)
Copy routine for arrays of Time objects.

Parameters:
source - Source array
sourceoffset - Offset to start copying from
dest - Destination array
destoffset - Destination offset to start copying to.
count - Number of elements to copy

copy

public void copy(TimeArray source)
Copies the source array to the current instance.

Parameters:
source - The source array object.

clone

public java.lang.Object clone()
Returns an object that is a clone of this array object.

Overrides:
clone in class DoubleArray
Returns:
Returns a clone of this array object.

add

public int add(java.util.GregorianCalendar r)
Adds a new element at the end of the array, increasing the length of the array by one. If the maxCapacity property is exceeded the maxCapacity property is automatically doubled and the protected buffer resized accordingly.

Parameters:
r - The new value to add at the end of the array.
Returns:
Returns the new value of the Length property.

addRange

public int addRange(java.util.GregorianCalendar[] 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. If the maxCapacity property is exceeded the maxCapacity property is automatically doubled and the protected buffer resized accordingly.

Parameters:
x - An array of new values that are added to the end of the array.
Returns:
Returns the new value of the Length property.

setElements

public int setElements(java.util.GregorianCalendar[] source)
Initializes the elements of the array, starting at element 0. The size of the array is set equal to the length of the source array. If the source array is larger than the current length of the array, the array is resized accordingly.

Parameters:
source - An array of new values used to initialize the array. The array will end up the same size as the source array.
Returns:
Returns the new value of the Length property.

setElements

public int setElements(java.util.GregorianCalendar[] source,
                       int count)
Initializes the elements of the array, starting at element 0 and continuing for count elements. The size of the array is set equal to the length of the source array, or the count, whichever is smaller. If the new length larger than the current length of the array, the array is resized accordingly.

Parameters:
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.
Returns:
Returns the new value of the Length property.

setElements

public int setElements(TimeArray source,
                       int count)
Initializes the elements of the array, starting at element 0 and continuing for count elements. The size of the array is set equal to the length of the source array, or the count, whichever is smaller. If the new length larger than the current length of the array, the array is resized accordingly.

Parameters:
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.
Returns:
Returns the new value of the Length property.

setElements

public int setElements(TimeArray source)
Initializes the elements of the array, starting at element 0. The size of the array is set equal to the length of the source array. If the source array is larger than the current length of the array, the array is resized accordingly.

Parameters:
source - An array of new values used to initialize the array. The array will end up the same size as the source array.
Returns:
Returns the new value of the Length property.

setElement

public void setElement(int index,
                       java.util.GregorianCalendar r)
Set the value of a single element in the array.

Parameters:
index - The index to set in the array.
r - The array element at index is set to the value r.*

getTimeElement

public java.util.GregorianCalendar getTimeElement(int index)
Get the value of a single element in the array.

Parameters:
index - The array index.
Returns:
Returns the value of the array at the specified index.

getTimeDataBuffer

public java.util.GregorianCalendar[] getTimeDataBuffer()
Returns a reference to the Array object that represents protected data buffer. It may be sized to the maxCapacity value, instead of the number of items in the buffer. This reference will remain valid only as long as the array is not forced to resize, forcing a reallocation of the protected buffer.

Returns:
Returns a reference to the Array object that represents the protected data buffer.

getTimeElements

public java.util.GregorianCalendar[] getTimeElements()
Returns a copy of the data values in the array sized to the number of elements.

Returns:
Returns a copy of the data values in the array sized to the number of elements.

TimeDataBuffer

public java.util.GregorianCalendar[] TimeDataBuffer()
Returns a reference to the Array object that represents protected data buffer. This reference will remain valid only as long as the array is not forced to resize, forcing a reallocation of the protected buffer.

Returns:
Returns a reference to the Array object that represents protected data buffer.