Package xj3d.filter
Class FieldValueHandler
java.lang.Object
xj3d.filter.FieldValueHandler
Utility class for converting between String and Binary data
representations and managing the setting of ContentHandler's
fieldValue() methods.
- Version:
- $Revision: 1.13 $
- Author:
- Rex Melton
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFieldValueHandler
(String version, ContentHandler handler) Construct an instance of this class that will create it's own field parser.FieldValueHandler
(VRMLFieldReader reader, ContentHandler handler) Construct an instance of this class with a field reader already determined. -
Method Summary
Modifier and TypeMethodDescriptionstatic float[]
flatten
(float[][] in) Flatten the argument array of float arrays into a single float arraystatic float[]
flatten
(float[][] in, int num_total) Flatten the argument array of float arrays into a single float arraystatic int[]
flatten
(int[][] in) Flatten the argument array of int arrays into a single int arraystatic int[]
flatten
(int[][] in, int num_total) Flatten the argument array of int arrays into a single int arraystatic String[]
Flatten the argument array of String arrays into a single String arraystatic String[]
Flatten the argument array of String arrays into a single String arraygetFieldDefault
(String nodeName, String fieldName) Return the default value of a fieldint
getFieldType
(String nodeName, String fieldName) Return the field typevoid
setFieldValue
(String nodeName, String fieldName, boolean value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, boolean[] value, int length) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, double value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, double[] value, int length) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, float value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, float[] value, int length) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, int value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, int[] value, int length) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, long value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, long[] value, int length) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, Object value) Set the field value into the content handler without knowing the type of data that we started with.void
setFieldValue
(String nodeName, String fieldName, String value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, String[] value) Set the field value into the content handler.void
setFieldValue
(String nodeName, String fieldName, String[] value, int length) Set the field value into the content handler.void
setParsingType
(ParsingType type) static String[]
Split the argument String into an array of Strings.static double[]
Return an array of double values for a String of whitespace separated valuesstatic double[]
Return an array of double values for String valuesstatic float[]
Return an array of float values for a String of whitespace separated valuesstatic float[]
Return an array of float values for String valuesstatic int[]
Return an array of int values for a String of whitespace separated valuesstatic int[]
Return an array of int values for String valuesstatic String[]
toString
(boolean[] bArray) Return an array of String values for boolean valuesstatic String[]
toString
(boolean[] bArray, int num) Return an array of String values for boolean valuesstatic String[]
toString
(double[] dArray) Return an array of String values for double valuesstatic String[]
toString
(double[] dArray, int num) Return an array of String values for double valuesstatic String[]
toString
(float[] fArray) Return an array of String values for float valuesstatic String[]
toString
(float[] fArray, int num) Return an array of String values for float valuesstatic String[]
toString
(int[] iArray) Return an array of String values for int valuesstatic String[]
toString
(int[] iArray, int num) Return an array of String values for int valuesstatic String[]
toString
(long[] lArray) Return an array of String values for long valuesstatic String[]
toString
(long[] lArray, int num) Return an array of String values for long values
-
Field Details
-
parsingType
How strict to parse
-
-
Constructor Details
-
FieldValueHandler
Construct an instance of this class that will create it's own field parser.- Parameters:
version
- The spec version stringhandler
- The content handler instance to send the parsed output to
-
FieldValueHandler
Construct an instance of this class with a field reader already determined.- Parameters:
reader
- The field reader instance to usehandler
- The content handler instance to send the parsed output to
-
-
Method Details
-
setParsingType
-
setFieldValue
Set the field value into the content handler without knowing the type of data that we started with.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The String representation of the data.
-
setFieldValue
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The String[] representation of the data.length
- The number of valid values in the array.
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The int[] representation of the data.length
- The number of valid values in the array.
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The long[] representation of the data.length
- The number of valid values in the array.
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The boolean[] representation of the data.length
- The number of valid values in the array.
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The float[] representation of the data.length
- The number of valid values in the array.
-
setFieldValue
-
setFieldValue
Set the field value into the content handler.- Parameters:
nodeName
- The name of the node.fieldName
- The name of the node field.value
- The double[] representation of the data.length
- The number of valid values in the array.
-
getFieldType
Return the field type- Parameters:
nodeName
- The name of the nodefieldName
- The name of the node field- Returns:
- The field type
- Throws:
InvalidFieldTypeException
- when the field name doesn't exist
-
getFieldDefault
public VRMLFieldData getFieldDefault(String nodeName, String fieldName) throws InvalidFieldTypeException Return the default value of a field- Parameters:
nodeName
- The name of the nodefieldName
- The name of the node field- Returns:
- The field type
- Throws:
InvalidFieldTypeException
- when the field name doesn't exist
-
toDouble
Return an array of double values for String values- Parameters:
sArray
- An array of String values to convert- Returns:
- A double array of converted values
- Throws:
NumberFormatException
-
toFloat
Return an array of float values for String values- Parameters:
sArray
- An array of String values to convert- Returns:
- A float array of converted values
- Throws:
NumberFormatException
-
toInt
Return an array of int values for String values- Parameters:
sArray
- An array of String values to convert- Returns:
- An int array of converted values
- Throws:
NumberFormatException
-
toDouble
Return an array of double values for a String of whitespace separated values- Parameters:
s
- A String containing values to convert- Returns:
- A double array of converted values
- Throws:
NumberFormatException
-
toFloat
Return an array of float values for a String of whitespace separated values- Parameters:
s
- A String containing values to convert- Returns:
- A float array of converted values
- Throws:
NumberFormatException
-
toInt
Return an array of int values for a String of whitespace separated values- Parameters:
s
- A String containing values to convert- Returns:
- An int array of converted values
- Throws:
NumberFormatException
-
toString
Return an array of String values for boolean values- Parameters:
bArray
- An array of boolean values to convert- Returns:
- A String array of converted values
-
toString
Return an array of String values for boolean values- Parameters:
bArray
- An array of boolean values to convertnum
- The number of values from the array to process- Returns:
- A String array of converted values
-
toString
Return an array of String values for double values- Parameters:
dArray
- An array of double values to convert- Returns:
- A String array of converted values
-
toString
Return an array of String values for double values- Parameters:
dArray
- An array of double values to convertnum
- The number of values from the array to process- Returns:
- A String array of converted values
-
toString
Return an array of String values for float values- Parameters:
fArray
- An array of float values to convert- Returns:
- A String array of converted values
-
toString
Return an array of String values for float values- Parameters:
fArray
- An array of float values to convertnum
- The number of values from the array to process- Returns:
- A String array of converted values
-
toString
Return an array of String values for int values- Parameters:
iArray
- An array of int values to convert- Returns:
- A String array of converted values
-
toString
Return an array of String values for int values- Parameters:
iArray
- An array of int values to convertnum
- The number of values from the array to process- Returns:
- A String array of converted values
-
toString
Return an array of String values for long values- Parameters:
lArray
- An array of long values to convert- Returns:
- A String array of converted values
-
toString
Return an array of String values for long values- Parameters:
lArray
- An array of long values to convertnum
- The number of values from the array to process- Returns:
- A String array of converted values
-
split
-
flatten
-
flatten
-
flatten
public static int[] flatten(int[][] in) Flatten the argument array of int arrays into a single int array- Parameters:
in
- An array of int arrays.- Returns:
- A single array
-
flatten
public static int[] flatten(int[][] in, int num_total) Flatten the argument array of int arrays into a single int array- Parameters:
in
- An array of int arrays.num_total
- The total number of ints contained in the in argument- Returns:
- A single array
-
flatten
public static float[] flatten(float[][] in) Flatten the argument array of float arrays into a single float array- Parameters:
in
- An array of float arrays.- Returns:
- A single array
-
flatten
public static float[] flatten(float[][] in, int num_total) Flatten the argument array of float arrays into a single float array- Parameters:
in
- An array of float arrays.num_total
- The total number of floats contained in the in argument- Returns:
- A single array
-