NetCharts Pro

netcharts.pro.util
Class NFProUtil

java.lang.Object
  |
  +--netcharts.pro.util.NFProUtil

public class NFProUtil
extends java.lang.Object

NFProUtil contains a number of utility classes.


Field Summary
static boolean dontValidate
           
static java.lang.String ON
           
 
Constructor Summary
NFProUtil()
           
 
Method Summary
static java.lang.Object[] cdlTuple2ObjectArray(java.lang.String cdl)
          Converts an array of string-based input data into an object array.
static boolean checkString(java.lang.String in, java.lang.String check)
          Will check the value of the String against the specified value.
static boolean checkString(java.lang.String in, java.lang.String check, boolean ignoreCase)
          Will check the value of the String against the specified value.
static java.lang.String dataBean2CDL(netcharts.util.NFDataBean dataBean)
           
static java.lang.String dataBean2CDL(netcharts.util.NFDataBean dataBean, java.lang.String param)
           
static boolean dataBean2KeyValues(netcharts.util.NFDataBean dataBean, java.lang.String param, java.util.Vector addTo)
           
static java.lang.Object determineValue(java.lang.String value)
          This method will return an object of the first available type between Integer, Double and String.
static java.lang.String escapeQuotes(java.lang.String in)
          Replaces quotes with the proper html entities.
static java.lang.String escapeQuotes(java.lang.String in, boolean escapeSingleQuotes)
          Replaces quotes with the proper html entities.
static java.lang.StringBuffer filterStream(java.io.InputStream is, java.util.Hashtable filterValues)
          This method replaces variables in the given input stream with the corresponding variable/value entry in the given hashtable, if one exists.
static java.lang.String formatForHtml(java.lang.String in)
          HTML encodes the string
static java.lang.String[] getAttributeArray(java.lang.String value)
          Converts a CDL "tuple" into an array of strings.
static NFCdf getCDLTemplate(java.io.File cdlFile)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile
static NFCdf getCDLTemplate(java.io.File cdlFile, java.util.Vector errorVector)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile
static NFCdf getCDLTemplate(java.io.InputStream cdlStream)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream
static NFCdf getCDLTemplate(java.io.InputStream cdlStream, java.util.Vector errorVector)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream
static NFCdf getCDLTemplate(java.lang.String cdlString)
          Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object.
static NFCdf getCDLTemplate(java.lang.String cdlString, java.util.Vector errorVector)
          Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object.
static NFCdf getCDLTemplate(java.net.URL cdlURL)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL
static NFCdf getCDLTemplate(java.net.URL cdlURL, java.util.Vector errorVector)
          Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL
static java.lang.Object getDataObject(NFBaseClass base)
           
static java.lang.Object getDataObject(java.lang.String cdl)
          Converts the input string into a Double or Date.
static java.lang.String getQuotedString(java.lang.String string)
          This method will return a string with surrounding double quotes.
static java.lang.Object getStyleObject(NFBaseClass base)
           
static java.lang.Object getStyleObjectData(NFBaseClass base)
           
static java.lang.String[] getTupleArray(java.lang.String value)
          Converts a CDL "tuple vectors" into an array of tuple elements.
static java.lang.Object getUserObject(NFBaseClass base)
           
static java.lang.Object getUserObject(NFBaseClass base, java.lang.String key)
           
static boolean notANull(java.lang.String cdl)
          Determines if the CDL element represents a "null" value.
static java.lang.String removeQuotes(java.lang.String string)
          This method will remove any preceding and trailing quotes from the String.
static java.lang.String replaceVar(java.lang.String origString, java.lang.String variable, java.lang.String newValue, boolean all)
          Replaces the variable string with the replacement value.
static void setDataObject(NFBaseClass base, java.lang.Object userObject)
           
static void setStyleObject(NFBaseClass base, java.lang.Object userObject)
           
static void setStyleObjectData(NFBaseClass base, java.lang.Object data)
           
static void setUserObject(NFBaseClass base, java.lang.Object userObject)
           
static void setUserObject(NFBaseClass base, java.lang.Object userObject, java.lang.String key)
           
static java.lang.String[] splitNameAndSetIndex(java.lang.String itemParam)
          Splits a name and set number (e.g.
static java.lang.String trimParens(java.lang.String value)
          Removes leading and following parentheses.
static java.lang.String trimQuotes(java.lang.String value)
          Removes leading and following quotes.
static java.lang.String userObject2CDL(java.lang.Object userObject)
           
static java.lang.String userObject2CDL(java.lang.Object userObject, java.lang.String param)
           
static boolean userObject2KeyValues(java.lang.Object userObject, java.lang.String param, java.util.Vector addTo)
           
static void verifyConstant(java.util.Hashtable hash, int value, java.lang.String itemName)
          Verify constant value.
static void verifyDiscreteData(java.lang.Object data)
          Verify data object.
static void verifyVectorContent(NFVector vector, java.lang.Class clazz)
          Verify vector contents.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dontValidate

public static boolean dontValidate

ON

public static java.lang.String ON
Constructor Detail

NFProUtil

public NFProUtil()
Method Detail

getTupleArray

public static java.lang.String[] getTupleArray(java.lang.String value)
Converts a CDL "tuple vectors" into an array of tuple elements.
Parameters:
value - A CDL tuple of the form (a, b, c),(d, e, f)
Returns:
a string array of elemnts in the form [a,b,c],[d,e,f]

getAttributeArray

public static java.lang.String[] getAttributeArray(java.lang.String value)
Converts a CDL "tuple" into an array of strings.
Parameters:
value - A CDL tuple of the form (a, b, c)
Returns:
a string array of elemnts in the form [a][b][c]

trimParens

public static java.lang.String trimParens(java.lang.String value)
Removes leading and following parentheses.
Parameters:
value - String value in the form "(a, b, c)"
Returns:
string value in the form "a, b, c"

trimQuotes

public static java.lang.String trimQuotes(java.lang.String value)
Removes leading and following quotes.
Parameters:
value - String value in the form "a, b, c"
Returns:
string value in the form a, b, c

getDataObject

public static java.lang.Object getDataObject(java.lang.String cdl)
Converts the input string into a Double or Date.
Parameters:
cdl - String representation of a double or Date object.
Returns:
Double or Date object. If it can't be converted, the original string is returned.

cdlTuple2ObjectArray

public static java.lang.Object[] cdlTuple2ObjectArray(java.lang.String cdl)
Converts an array of string-based input data into an object array.
Parameters:
cdl - Comma delimited string of data.
Returns:
array of Double or Date objects. If it can't be converted, the original string data element is put into the array.

splitNameAndSetIndex

public static final java.lang.String[] splitNameAndSetIndex(java.lang.String itemParam)
Splits a name and set number (e.g. DataSet1) into its composite parts "DataSet" and "1"
Parameters:
itemParam - Set name
Returns:
array of name and index.

verifyConstant

public static void verifyConstant(java.util.Hashtable hash,
                                  int value,
                                  java.lang.String itemName)
Verify constant value. Throws an IllegalArgumentException if the constant is not found in the hashtable.
Parameters:
hash - Hashtable to check for the constant.
value - The constant that should be in the hashtable
itemName - the name of the item to be included in the exception.

verifyVectorContent

public static void verifyVectorContent(NFVector vector,
                                       java.lang.Class clazz)
Verify vector contents. Throws an IllegalArgumentException if the vector contains data other than what is expected.
Parameters:
vector - Vector of objects
clazz - The class (or superclass) of the objects.

verifyDiscreteData

public static void verifyDiscreteData(java.lang.Object data)
Verify data object. Data objects can either be a null, Number, or Date. Throws an IllegalArgumentException if valid data is not passed.
Parameters:
data - The data object

getCDLTemplate

public static NFCdf getCDLTemplate(java.io.File cdlFile)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile
Parameters:
cdlFile - A file containing CDL parameters.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.io.File cdlFile,
                                   java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlFile
Parameters:
cdlFile - A file containing CDL parameters.
errorVector - The Vector to contain possible errors.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.net.URL cdlURL)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL
Parameters:
cdlURL - A URL that returns CDL parameters when called.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.net.URL cdlURL,
                                   java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlURL
Parameters:
cdlURL - A URL that returns CDL parameters when called.
errorVector - The Vector to contain possible errors.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.io.InputStream cdlStream)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream
Parameters:
cdlStream - An input stream containing CDL parameters.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.io.InputStream cdlStream,
                                   java.util.Vector errorVector)
Creates a "Chart Definition File" or NFCdf template object based on the contents of the cdlStream input stream
Parameters:
cdlStream - An input stream containing CDL parameters.
errorVector - The Vector to contain possible errors.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.lang.String cdlString)
                            throws java.lang.Exception
Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object.
Parameters:
cdlString - A string containing CDL parameters.
Returns:
the NFCdf object.

getCDLTemplate

public static NFCdf getCDLTemplate(java.lang.String cdlString,
                                   java.util.Vector errorVector)
                            throws java.lang.Exception
Creates a "Chart Definition File" or NFCdf template object based on the given cdlString String object.
Parameters:
cdlString - A string containing CDL parameters.
errorVector - The Vector to contain possible errors.
Returns:
the NFCdf object.

filterStream

public static java.lang.StringBuffer filterStream(java.io.InputStream is,
                                                  java.util.Hashtable filterValues)
                                           throws java.io.IOException
This method replaces variables in the given input stream with the corresponding variable/value entry in the given hashtable, if one exists. A variable consists of a dollar sign, followed by any number of letters, digits, or underscores. This method returns a string buffer that contains the filtered input stream.

getUserObject

public static java.lang.Object getUserObject(NFBaseClass base)

getUserObject

public static java.lang.Object getUserObject(NFBaseClass base,
                                             java.lang.String key)

setUserObject

public static void setUserObject(NFBaseClass base,
                                 java.lang.Object userObject)

setUserObject

public static void setUserObject(NFBaseClass base,
                                 java.lang.Object userObject,
                                 java.lang.String key)

setDataObject

public static void setDataObject(NFBaseClass base,
                                 java.lang.Object userObject)

getDataObject

public static java.lang.Object getDataObject(NFBaseClass base)

setStyleObject

public static void setStyleObject(NFBaseClass base,
                                  java.lang.Object userObject)

getStyleObject

public static java.lang.Object getStyleObject(NFBaseClass base)

setStyleObjectData

public static void setStyleObjectData(NFBaseClass base,
                                      java.lang.Object data)

getStyleObjectData

public static java.lang.Object getStyleObjectData(NFBaseClass base)

userObject2CDL

public static java.lang.String userObject2CDL(java.lang.Object userObject)

userObject2CDL

public static java.lang.String userObject2CDL(java.lang.Object userObject,
                                              java.lang.String param)

userObject2KeyValues

public static boolean userObject2KeyValues(java.lang.Object userObject,
                                           java.lang.String param,
                                           java.util.Vector addTo)

dataBean2CDL

public static java.lang.String dataBean2CDL(netcharts.util.NFDataBean dataBean)

dataBean2CDL

public static java.lang.String dataBean2CDL(netcharts.util.NFDataBean dataBean,
                                            java.lang.String param)

dataBean2KeyValues

public static boolean dataBean2KeyValues(netcharts.util.NFDataBean dataBean,
                                         java.lang.String param,
                                         java.util.Vector addTo)

formatForHtml

public static java.lang.String formatForHtml(java.lang.String in)
HTML encodes the string
Parameters:
in - The string to encode for HTML.

replaceVar

public static java.lang.String replaceVar(java.lang.String origString,
                                          java.lang.String variable,
                                          java.lang.String newValue,
                                          boolean all)
Replaces the variable string with the replacement value.
Parameters:
origString - The original string containing variable to replace.
variable - The variable to replace.
variable - The value to replace the variable with.
all - Whether or not all variable instances should be replaced.

escapeQuotes

public static java.lang.String escapeQuotes(java.lang.String in,
                                            boolean escapeSingleQuotes)
Replaces quotes with the proper html entities.
Parameters:
in - The string to escape quotes in.
escapeSingleQuotes - If true, single quotes are escaped as well.
Returns:
The escaped string.

escapeQuotes

public static java.lang.String escapeQuotes(java.lang.String in)
Replaces quotes with the proper html entities. Single quotes are also escaped.
Parameters:
in - The string to escape quotes in.
Returns:
The escaped string.

notANull

public static boolean notANull(java.lang.String cdl)
Determines if the CDL element represents a "null" value. Internal use only.
Returns:
isnull

removeQuotes

public static java.lang.String removeQuotes(java.lang.String string)
This method will remove any preceding and trailing quotes from the String.
Parameters:
value -  
Returns:
 

getQuotedString

public static java.lang.String getQuotedString(java.lang.String string)
This method will return a string with surrounding double quotes. If the string already has double quotes, none will be added.
Parameters:
string - The String to add double quotes around.
Returns:
The string with surrounding double quotes.

checkString

public static boolean checkString(java.lang.String in,
                                  java.lang.String check)
Will check the value of the String against the specified value. If the string is surrounded by double-quotes, they will be ignored. This is a case-insensitive check.
Parameters:
in - The string containing the value to check.
check - The string to check against.
Returns:
true if the string matches, false otherwise.

checkString

public static boolean checkString(java.lang.String in,
                                  java.lang.String check,
                                  boolean ignoreCase)
Will check the value of the String against the specified value. If the string is surrounded by double-quotes, they will be ignored.
Parameters:
in - The string containing the value to check.
check - The string to check against.
ignoreCase - Whether or not to ignore case.
Returns:
true if the string matches, false otherwise.

determineValue

public static java.lang.Object determineValue(java.lang.String value)
This method will return an object of the first available type between Integer, Double and String. If the value is contained within quotes, the quotes will be remove to check whether the value is an Integer or a Double. If the value is a String, then the quotes will remain.
Parameters:
value - The value to check.
Returns:
A new value of either an Integer, Double or String.

NetCharts Pro


Visual Mining, Inc.
15825 Shady Grove Rd.
Suite 20
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2004
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: Apr 1, 2004