- java.lang.Object
-
- com.pervasive.datarush.analytics.pmml.PMMLArrays
-
public final class PMMLArrays extends Object
Utility methods for formatting and parsing PMML arrays
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPMMLArrays.ArrayTypeEnumeration of PMML array types
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddChildArrayElement(Element element, double[] values)Adds a childArrayelement to the given element.static voidaddChildArrayElement(Element element, int[] values)Adds a childArrayelement to the given element.static voidaddChildArrayElement(Element element, long[] values)Adds a childArrayelement to the given element.static voidaddChildArrayElement(Element element, Object[] values, PMMLArrays.ArrayType type)Adds a childArrayelement to the given element.static voidaddChildArrayElement(Element element, BigDecimal[] values)Adds a childArrayelement to the given element.static voidaddSparseChildArrayElement(Element element, DoubleTokenSequence sequence)Adds a childREAL-SparseArrayelement to the given element.static voidaddSparseChildArrayElement(Element element, IntTokenSequence sequence)Adds a childINT-SparseArrayelement to the given element.static voidaddSparseChildArrayElement(Element element, NumericTokenSequence sequence)Adds a childREAL-SparseArrayelement to the given element.static BigDecimal[]parseChildArrayElementAsBigDecimals(Element element)Parses the single childArrayelement as an array of BigDecimals.static double[]parseChildArrayElementAsDoubles(Element element)Parses the single childArrayelement as an array of doubles.static int[]parseChildArrayElementAsInts(Element element)Parses the single childArrayelement as an array of ints.static String[]parseChildArrayElementAsStrings(Element element)Parses the single childArrayelement as an array of strings.static BigDecimal[][]parseChildArrayElementsAsBigDecimals(Element element)Parses all childArrayelements as arrays of BigDecimals.static Double[][]parseChildArrayElementsAsDoubles(Element element)Parses all childArrayelements as arrays of doubles.static String[][]parseChildArrayElementsAsStrings(Element element)Parses all childArrayelements as arrays of strings.static DoubleTokenSequenceparseSparseChildArrayElement(Element element)Parses the single childREAL-SparseArrayorINT-SparseArrayelement.
-
-
-
Method Detail
-
addChildArrayElement
public static void addChildArrayElement(Element element, double[] values)
Adds a childArrayelement to the given element. The child array will be of typePMMLArrays.ArrayType.real.- Parameters:
element- the parent elementvalues- the values of the array
-
addChildArrayElement
public static void addChildArrayElement(Element element, BigDecimal[] values)
Adds a childArrayelement to the given element. The child array will be of typePMMLArrays.ArrayType.real.- Parameters:
element- the parent elementvalues- the values of the array
-
addChildArrayElement
public static void addChildArrayElement(Element element, int[] values)
Adds a childArrayelement to the given element. The child array will be of typePMMLArrays.ArrayType.integer.- Parameters:
element- the parent elementvalues- the values of the array
-
addChildArrayElement
public static void addChildArrayElement(Element element, long[] values)
Adds a childArrayelement to the given element. The child array will be of typePMMLArrays.ArrayType.integer.- Parameters:
element- the parent elementvalues- the values of the array
-
addChildArrayElement
public static void addChildArrayElement(Element element, Object[] values, PMMLArrays.ArrayType type)
Adds a childArrayelement to the given element. The child array will be of the specified type- Parameters:
element- the parent elementvalues- the values of the arraytype- the type of the elements of the array
-
addSparseChildArrayElement
public static void addSparseChildArrayElement(Element element, DoubleTokenSequence sequence)
Adds a childREAL-SparseArrayelement to the given element.- Parameters:
element- the parent elementsequence- the sequence (generally a sparse sequence)
-
addSparseChildArrayElement
public static void addSparseChildArrayElement(Element element, NumericTokenSequence sequence)
Adds a childREAL-SparseArrayelement to the given element.- Parameters:
element- the parent elementsequence- the sequence (generally a sparse sequence)
-
addSparseChildArrayElement
public static void addSparseChildArrayElement(Element element, IntTokenSequence sequence)
Adds a childINT-SparseArrayelement to the given element.- Parameters:
element- the parent elementsequence- the sequence (generally a sparse sequence)
-
parseChildArrayElementsAsStrings
public static String[][] parseChildArrayElementsAsStrings(Element element)
Parses all childArrayelements as arrays of strings. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- a two-dimensional array of strings. the outer array corresponds to the children elements
-
parseChildArrayElementsAsDoubles
public static Double[][] parseChildArrayElementsAsDoubles(Element element)
Parses all childArrayelements as arrays of doubles. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- a two-dimensional array of double. the outer array corresponds to the children elements
-
parseChildArrayElementsAsBigDecimals
public static BigDecimal[][] parseChildArrayElementsAsBigDecimals(Element element)
Parses all childArrayelements as arrays of BigDecimals. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- a two-dimensional array of BigDecimals. the outer array corresponds to the children elements
-
parseChildArrayElementAsStrings
public static String[] parseChildArrayElementAsStrings(Element element)
Parses the single childArrayelement as an array of strings. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- an array of strings
- Throws:
InvalidPMMLException- if there are multiple children arrays
-
parseChildArrayElementAsDoubles
public static double[] parseChildArrayElementAsDoubles(Element element)
Parses the single childArrayelement as an array of doubles. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- an array of doubles
- Throws:
InvalidPMMLException- if there are multiple children arrays
-
parseChildArrayElementAsBigDecimals
public static BigDecimal[] parseChildArrayElementAsBigDecimals(Element element)
Parses the single childArrayelement as an array of BigDecimals. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- an array of BigDecimals
- Throws:
InvalidPMMLException- if there are multiple children arrays
-
parseChildArrayElementAsInts
public static int[] parseChildArrayElementAsInts(Element element)
Parses the single childArrayelement as an array of ints. The type declared in the PMML is ignored.- Parameters:
element- the parent element- Returns:
- an array of ints
- Throws:
InvalidPMMLException- if there are multiple children arrays
-
parseSparseChildArrayElement
public static DoubleTokenSequence parseSparseChildArrayElement(Element element)
Parses the single childREAL-SparseArrayorINT-SparseArrayelement.- Parameters:
element- the parent element- Returns:
- a sparse token sequence
- Throws:
InvalidPMMLException- if there are multiple children arrays
-
-