JavaView© v3.95.000

jv.loader
Class PsXmlLoader

java.lang.Object
  extended byjv.loader.PsXmlLoader

public final class PsXmlLoader
extends java.lang.Object

Loader for Xml files fills a tree structure.


Constructor Summary
PsXmlLoader()
           
 
Method Summary
static PsXmlNode addColor(PsXmlNode parentNode, java.lang.String colorLabel, java.awt.Color color)
          Create a new node containing the given argument color.
static PsXmlNode addColor(PsXmlNode parentNode, java.lang.String typeLabel, java.lang.String colorLabel, java.awt.Color color)
          Create a new node with a child node containing the given argument color.
static PsXmlNode addMatrix(PsXmlNode parentNode, java.lang.String type, PdMatrix matrix)
          Write matrix whose element type is passed as argument.
static PsXmlNode addVector(PsXmlNode parentNode, java.lang.String type, PdVector vector, boolean bAttr)
          Create a new node with the content of the given argument vector.
static PsXmlNode addVector(PsXmlNode parentNode, java.lang.String type, PiVector vector, boolean bAttr)
          Create a new node with the content of the given argument vector.
static void addVectorList(PsXmlNode parentNode, java.lang.String type, java.awt.Color[] vector, int length)
           
static void addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector[][] vector, int length)
           
static void addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector[] vector, int length)
           
static void addVectorList(PsXmlNode parentNode, java.lang.String type, PdVector vector, int length)
           
static void addVectorList(PsXmlNode parentNode, java.lang.String type, PiVector[] vector, int length)
           
static java.awt.Color parseColorContent(PsXmlNode p)
          Parse a PsXmlNode whose content consists of rgb color components.
static java.awt.Color[] parseColorList(PsXmlNode parentNode, java.lang.String type)
          Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
static java.awt.Color parseColorRGB(PsXmlNode parentNode, java.lang.String type)
          Parse a PsXmlNode whose child has a set of rgb color components.
static PdVector[] parseDoubleList(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)
          Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of doubles.
static PiVector[] parseIntegerList(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)
          Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.
static PdMatrix parsePdMatrix(PsXmlNode parentNode, java.lang.String type)
          Parse a double matrix from a blank separated string of doubles.
static PdVector parsePdVector(PsXmlNode p, java.lang.String[] attr)
          Parse element content consisting of blank separated list of doubles.
static PdVector parsePdVector(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)
          Parse a PsXmlNode whose child has a set of double values.
static PdVector parsePdVector(java.lang.String string)
          Parse a double vector from a blank separated string of doubles.
static PiVector parsePiVector(PsXmlNode p, java.lang.String[] attr)
          Parse element content consisting of a blank separated list of integers.
static PiVector parsePiVector(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)
          Parse a PsXmlNode whose child has a set of integer values.
static PiVector parsePiVector(java.lang.String string)
          Parse an integer vector from a blank separated string of integers.
static void parseVectorAttr(P_Vector vec, PsXmlNode p, java.lang.String[] attr)
          Parse vector attributes of PdVector and PiVector.
static PsXmlSrc read(java.io.BufferedReader in)
          Read XML file and fill a new PsXmlSrc class.
static PsXmlSrc read(java.lang.String fileName)
          Read XML file and fill a new PsXmlSrc class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PsXmlLoader

public PsXmlLoader()
Method Detail

read

public static PsXmlSrc read(java.lang.String fileName)
Read XML file and fill a new PsXmlSrc class. Stream is closed after parsing the data.

Parameters:
fileName - File or URL to read data from.

read

public static PsXmlSrc read(java.io.BufferedReader in)
Read XML file and fill a new PsXmlSrc class.

Parameters:
in - BufferedReader to read textual data from.

parseDoubleList

public static PdVector[] parseDoubleList(PsXmlNode parentNode,
                                         java.lang.String type,
                                         java.lang.String[] attr)
Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of doubles.

Parameters:
parentNode - parent node containing a set of PdVector nodes as children
type - type of elements in array
attr - array of attributes the vector might have, may be null.
Returns:
parsed vector array, or null if failed

parsePdVector

public static PdVector parsePdVector(PsXmlNode parentNode,
                                     java.lang.String type,
                                     java.lang.String[] attr)
Parse a PsXmlNode whose child has a set of double values.

Parameters:
parentNode - node whose child has a set of double values.
Returns:
parsed vector, or null if failed

parsePdVector

public static PdVector parsePdVector(PsXmlNode p,
                                     java.lang.String[] attr)
Parse element content consisting of blank separated list of doubles.

Parameters:
p - node whose content is a list of double values.
attr - array of attributes the vector might have, may be null.
Returns:
parsed vector, or null if failed

parseVectorAttr

public static void parseVectorAttr(P_Vector vec,
                                   PsXmlNode p,
                                   java.lang.String[] attr)
Parse vector attributes of PdVector and PiVector.

Parameters:
vec - vector whose attributes will be set.
p - node with attribute values.
attr - array of attributes the node might have, may be null.

parsePdVector

public static PdVector parsePdVector(java.lang.String string)
Parse a double vector from a blank separated string of doubles.

Parameters:
string - string with double components
Returns:
vector with components, vector has length zero if no doubles available.

parsePdMatrix

public static PdMatrix parsePdMatrix(PsXmlNode parentNode,
                                     java.lang.String type)
Parse a double matrix from a blank separated string of doubles.

Parameters:
parentNode - parent node containing a matrix.
type - type of the matrix element in parent node.
Returns:
PdMatrix instance with double components, null if no doubles available.

parsePiVector

public static PiVector parsePiVector(java.lang.String string)
Parse an integer vector from a blank separated string of integers.

Parameters:
string - string with integer components
Returns:
vector with components, vector has length zero if no doubles available.

parseIntegerList

public static PiVector[] parseIntegerList(PsXmlNode parentNode,
                                          java.lang.String type,
                                          java.lang.String[] attr)
Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.

Parameters:
parentNode - parent node containing a set of PiVector nodes as children
type - type of elements in array
attr - array of attributes the vector might have, may be null.
Returns:
parsed vector array, or null if failed

parsePiVector

public static PiVector parsePiVector(PsXmlNode parentNode,
                                     java.lang.String type,
                                     java.lang.String[] attr)
Parse a PsXmlNode whose child has a set of integer values.

Parameters:
parentNode - node whose child has a set of integer values.
Returns:
parsed vector, or null if failed

parsePiVector

public static PiVector parsePiVector(PsXmlNode p,
                                     java.lang.String[] attr)
Parse element content consisting of a blank separated list of integers.

Parameters:
p - node whose content is a set of integer values.
attr - array of attributes the vector might have, may be null.
Returns:
parsed vector, or null if failed

parseColorList

public static java.awt.Color[] parseColorList(PsXmlNode parentNode,
                                              java.lang.String type)
Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of integers.

Parameters:
parentNode - parent node containing a set of color nodes as children
type - type of elements in array
Returns:
parsed color array, or null if failed

parseColorRGB

public static java.awt.Color parseColorRGB(PsXmlNode parentNode,
                                           java.lang.String type)
Parse a PsXmlNode whose child has a set of rgb color components.

Parameters:
parentNode - node whose child has a set of rgb colors values.
Returns:
parsed color, or null if failed

parseColorContent

public static java.awt.Color parseColorContent(PsXmlNode p)
Parse a PsXmlNode whose content consists of rgb color components.

Parameters:
p - node whose content is a set of rgb colors values.
Returns:
parsed color, or null if failed

addMatrix

public static PsXmlNode addMatrix(PsXmlNode parentNode,
                                  java.lang.String type,
                                  PdMatrix matrix)
Write matrix whose element type is passed as argument. Matrix components are converted to non-exponential form.

Returns:
child node if created.

addVectorList

public static void addVectorList(PsXmlNode parentNode,
                                 java.lang.String type,
                                 PdVector vector,
                                 int length)
Since:
JavaView 2.43

addVectorList

public static void addVectorList(PsXmlNode parentNode,
                                 java.lang.String type,
                                 PdVector[] vector,
                                 int length)

addVectorList

public static void addVectorList(PsXmlNode parentNode,
                                 java.lang.String type,
                                 PiVector[] vector,
                                 int length)

addVector

public static PsXmlNode addVector(PsXmlNode parentNode,
                                  java.lang.String type,
                                  PdVector vector,
                                  boolean bAttr)
Create a new node with the content of the given argument vector.

Returns:
child node if created.

addVector

public static PsXmlNode addVector(PsXmlNode parentNode,
                                  java.lang.String type,
                                  PiVector vector,
                                  boolean bAttr)
Create a new node with the content of the given argument vector.

Returns:
child node if created.

addVectorList

public static void addVectorList(PsXmlNode parentNode,
                                 java.lang.String type,
                                 PdVector[][] vector,
                                 int length)

addVectorList

public static void addVectorList(PsXmlNode parentNode,
                                 java.lang.String type,
                                 java.awt.Color[] vector,
                                 int length)

addColor

public static PsXmlNode addColor(PsXmlNode parentNode,
                                 java.lang.String typeLabel,
                                 java.lang.String colorLabel,
                                 java.awt.Color color)
Create a new node with a child node containing the given argument color.

Parameters:
parentNode - existing parent node
typeLabel - element type of the node
colorLabel - element type of the child node containing the color
color - color to be written to the child node.
Returns:
new node containing the color node

addColor

public static PsXmlNode addColor(PsXmlNode parentNode,
                                 java.lang.String colorLabel,
                                 java.awt.Color color)
Create a new node containing the given argument color.

Parameters:
parentNode - existing parent node
colorLabel - element type of the new color node
color - color to be written to the child node.
Returns:
new color node

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.