NetCharts Pro

netcharts.pro.common
Class NFVector

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.common.NFVector
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
NFAxisSeries, NFBarSeries, NFBaseRadialAxisSeries, NFBaseRadialLineSeries, NFBaseSeries, NFBaseSet, NFBoxSeries, NFColorTable, NFDialSeries, NFGridSeries, NFLineSeries, NFNodeEdgeSeries, NFNodeSeries, NFNoteSeries, NFPieSeries, NFPolySet, NFSliceSeries, NFStockSeries, NFTimeSeries

public class NFVector
extends NFBaseClass

NFVector allows for a vector of multidimensional data. If more than one dimension exists, an Object array with the appropriate number of columns is put into the vector element. The addElement(Object elements[]) method is used only when you need to add multi-dimensional data to the NFVector, like in the case of X-Y data points where each data point is actually a two-dimensional data set. And in that case, each component of the multi-dimensional set must exist, even if it's null. For single dimension properties, such as bar values, tic labels, colors in a color table, etc. each element should be added individually to the NFVector, not as a array. For example:

    NFVector v = new NFVector();
    v.addElement("Monday"); 
    v.addElement("Tuesday");
 
NOT
    NFVector v = new NFVector();
    v.addElement(new String[] {"Monday", "Tuesday"}); 
 


Constructor Summary
NFVector()
          Creates an empty NFVector.
NFVector(java.util.Vector initialValues)
          Creates an NFVector initially populated from the specified Vector.
 
Method Summary
 void addElement(java.lang.Object element)
          Add the object to the vector.
 void addElement(java.lang.Object[] elements)
          Add the object array to the vector.
 java.lang.Object clone()
          Does a deep copy of this NFVector object - if objects in the vector are of type NFBaseClass they will be cloned as well.
 java.lang.Object elementAt(int index)
          Returns the element at the given index
 java.lang.Object elementAt(int row, int col)
          Returns the element at the given row and column index.
 java.lang.String getCDL()
          Gets the CDL representation of this vector
 void getCDL(java.lang.String paramName, java.lang.StringBuffer sb)
          Append CDL parameters representing this NFVector to the given StringBuffer.
 void getCDL(java.lang.String paramName, java.lang.StringBuffer sb, boolean getIfEmpty)
          Append CDL parameters representing this NFVector to the given StringBuffer.
 boolean getCDLHasTuples()
          Gets the hasTuples property
 void getCDLKeyValues(java.lang.String paramName, java.util.Vector v)
          Append CDL parameters representing this NFVector to the given StringBuffer.
 void getCDLKeyValuesHasPoints(java.lang.String paramName, java.util.Vector v)
          Append CDL parameters representing this NFVector to the given StringBuffer.
 int getMaxDimensions()
          Return the maximum number of dimensions in this Vector.
 boolean getQuoteStrings()
          Returns the quote strings property
 int getSize()
          Return the number of elements in this NFVector.
 boolean isEmptyStringAsNull()
          Returns the empty string as null property
 void loadDataModel(NFDataModel dataModel)
          Loads the vector from the given object implementing the NFDataModel interface.
 void loadDataModel(java.lang.Object dataObject, java.lang.String[] methods, int nrows)
          Loads the vector from the given object implementing the NFDataModel interface.
 void loadDataModel(java.lang.Object dataObject, java.lang.String method, int nrows)
          Loads the vector from the given object implementing the NFDataModel interface.
 void removeElementAt(int index)
          Remove the object at the given index.
 void reset()
          Clears any values within the NFVector.
 void setCDL(java.lang.Object cdlObject, java.lang.Class clazz)
          Sets the CDL representation of this vector.
 void setCDLHasTuples(boolean hasTuples)
          Sets the hasTuples property
 void setCDLNullString(java.lang.String nullCDLString)
          Sets the nullCDLString.
 void setElementAt(java.lang.Object element, int index)
          Set the object into the vector.
 void setEmptyStringAsNull(boolean emptyStringAsNull)
          Sets the empty string as null property
 void setQuoteStrings(boolean quoteStrings)
          Sets the quote strings property
 void setSize(int size)
          Set the vector size
 int size()
          Return the number of elements in this NFVector.
 void skipNulls(boolean skipNulls)
          When skipNulls is true, null data in the vector will not be passed to the rendering engine.
 java.lang.Object[] toArray(java.lang.Object[] a)
          Returns an array containing all of the elements in this Vector in the correct order.
 java.lang.String toString()
          Returns a new String object representing this vector.
 
Methods inherited from class netcharts.pro.common.NFBaseClass
getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NFVector

public NFVector()
Creates an empty NFVector.


NFVector

public NFVector(java.util.Vector initialValues)
Creates an NFVector initially populated from the specified Vector.

Parameters:
initialValues - A Vector containing a set of initial values
Method Detail

elementAt

public java.lang.Object elementAt(int row,
                                  int col)
Returns the element at the given row and column index.

Parameters:
row -
col -
Returns:
object at the given (row,col) index or null if not defined.

elementAt

public java.lang.Object elementAt(int index)
Returns the element at the given index

Parameters:
index -
Returns:
object or object array at the given row index or null if not defined.

addElement

public void addElement(java.lang.Object element)
Add the object to the vector. May add null objects.

Parameters:
element - Object to add

setElementAt

public void setElementAt(java.lang.Object element,
                         int index)
Set the object into the vector. May set null objects

Parameters:
element - object to add
index - Row index to put the object.

removeElementAt

public void removeElementAt(int index)
Remove the object at the given index.

Parameters:
index - Row index to remove. If the index is greater than the number of rows in the vector it will just return without error.

addElement

public void addElement(java.lang.Object[] elements)
Add the object array to the vector. May set null object

Parameters:
elements - Object array to add

setSize

public void setSize(int size)
Set the vector size

Parameters:
size - Sets the size of the vector. If size is zero, it will reset the number of dimensions to 1

getSize

public int getSize()
Return the number of elements in this NFVector.

Returns:
size Number of elements

size

public int size()
Return the number of elements in this NFVector.

Returns:
size Number of elements

reset

public void reset()
Clears any values within the NFVector.


getMaxDimensions

public int getMaxDimensions()
Return the maximum number of dimensions in this Vector.

Returns:
maxDimensions This number is equivalent to the size of the largest object array added to the vector or 1 if no object arrays have been added.

setQuoteStrings

public void setQuoteStrings(boolean quoteStrings)
Sets the quote strings property

Parameters:
quoteStrings - When set to true, when this object's toString or getCDL method is called, objects of type String will be delimited with double quotes.

getQuoteStrings

public boolean getQuoteStrings()
Returns the quote strings property

Returns:
quoteStrings When set to true, when this object's toString or getCDL method is called, objects of type String will be quoted.

isEmptyStringAsNull

public boolean isEmptyStringAsNull()
Returns the empty string as null property

Returns:
emptyStringAsNull When set to true, empty strings will be returned as null objects

setEmptyStringAsNull

public void setEmptyStringAsNull(boolean emptyStringAsNull)
Sets the empty string as null property

Parameters:
emptyStringAsNull - When set to true, empty strings will be returned as null objects

loadDataModel

public void loadDataModel(NFDataModel dataModel)
Loads the vector from the given object implementing the NFDataModel interface. Objects from the data model are put into the NFVector

Parameters:
dataModel - The data model object to load from.

loadDataModel

public void loadDataModel(java.lang.Object dataObject,
                          java.lang.String method,
                          int nrows)
                   throws java.lang.NoSuchMethodException,
                          java.lang.SecurityException
Loads the vector from the given object implementing the NFDataModel interface. Objects from the data model are put into the NFVector

Parameters:
dataObject - The data model object to load from
method - The method to call for each data row found
nrows - The number of data rows
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException

loadDataModel

public void loadDataModel(java.lang.Object dataObject,
                          java.lang.String[] methods,
                          int nrows)
                   throws java.lang.NoSuchMethodException,
                          java.lang.SecurityException
Loads the vector from the given object implementing the NFDataModel interface. Objects from the data model are put into the NFVector

Parameters:
dataObject - The data model object to load from
methods - The methods to call for each data row found
nrows - The number of data rows
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException

skipNulls

public void skipNulls(boolean skipNulls)
When skipNulls is true, null data in the vector will not be passed to the rendering engine.

Parameters:
skipNulls - default is false

setCDLHasTuples

public void setCDLHasTuples(boolean hasTuples)
Sets the hasTuples property

Parameters:
hasTuples - Used to determine parsing for setCDL

getCDLHasTuples

public boolean getCDLHasTuples()
Gets the hasTuples property

Returns:
hasTuples property. Used to determine parsing for setCDL

getCDL

public java.lang.String getCDL()
Gets the CDL representation of this vector

Returns:
cdl Converts this vector into a list of CDL elements. Each element in the vector will have its toString() method called.

getCDL

public void getCDL(java.lang.String paramName,
                   java.lang.StringBuffer sb)
Append CDL parameters representing this NFVector to the given StringBuffer. Converts this vector into a list of CDL elements. Each element in the vector will have its toString() method called.

Parameters:
param - The parameter name to use the base
sb - Target buffer to append the CDL parameters

getCDL

public void getCDL(java.lang.String paramName,
                   java.lang.StringBuffer sb,
                   boolean getIfEmpty)
Append CDL parameters representing this NFVector to the given StringBuffer. Converts this vector into a list of CDL elements. Each element in the vector will have its toString() method called.

Parameters:
param - The parameter name to use the base
sb - Target buffer to append the CDL parameters
getIfEmpty - Whether or not to append the parameter if no values exist within the NFVector

getCDLKeyValues

public void getCDLKeyValues(java.lang.String paramName,
                            java.util.Vector v)
Append CDL parameters representing this NFVector to the given StringBuffer. Converts this vector into a list of CDL elements. Each element in the vector will have its toString() method called.

Parameters:
param - The parameter name to use the base
v - The Vector to append the parameter definitions to

getCDLKeyValuesHasPoints

public void getCDLKeyValuesHasPoints(java.lang.String paramName,
                                     java.util.Vector v)
Append CDL parameters representing this NFVector to the given StringBuffer. Converts this vector into a list of CDL elements that are point based. Each element in the vector will have its toString() method called.

Parameters:
paramName - The parameter name to use the base
v - The Vector to append the parameter definitions to

setCDL

public void setCDL(java.lang.Object cdlObject,
                   java.lang.Class clazz)
Sets the CDL representation of this vector. Dynamically builds a list of objects from the CDL.

Parameters:
cdlObject - Puts the list represented by this cdl into the vector.
clazz - The Java class that each element of this vector represents.

toString

public java.lang.String toString()
Returns a new String object representing this vector.

Overrides:
toString in class java.lang.Object
Returns:
A new String object in the same form as that given by getCDL().

setCDLNullString

public void setCDLNullString(java.lang.String nullCDLString)
Sets the nullCDLString.

Parameters:
nullCDLString - Represents the value to use when the vector is being converted to a cdl string and an element is null. Set to "" by default.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Does a deep copy of this NFVector object - if objects in the vector are of type NFBaseClass they will be cloned as well.

Overrides:
clone in class NFBaseClass
Returns:
Object
Throws:
java.lang.CloneNotSupportedException

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Returns an array containing all of the elements in this Vector in the correct order. The runtime type of the returned array is that of the specified array. If the Vector fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this Vector.

If the Vector fits in the specified array with room to spare (i.e., the array has more elements than the Vector), the element in the array immediately following the end of the Vector is set to null. This is useful in determining the length of the Vector only if the caller knows that the Vector does not contain any null elements.

Parameters:
a - the array into which the elements of the Vector are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
an array containing the elements of the Vector.
Throws:
java.lang.ArrayStoreException - the runtime type of a is not a supertype of the runtime type of every element in this Vector.

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011