JavaView® v2.00.008

jv.loader
Class PsXmlLoader

java.lang.Object
  |
  +--jv.loader.PsXmlLoader

public class PsXmlLoader
extends java.lang.Object

Loader for Xml files fills a tree structure.

Version:
09.01.01, 1.50 revised (kp) Methods to write PsXmlSrc and PsXmlNode moved to individual classes.
07.01.01, 1.20 revised (kp) Methode writeNode made public.
16.04.00, 1.10 revised (kp) All methods made static.
16.01.00, 1.00 created (kp)
Author:
Konrad Polthier

Constructor Summary
PsXmlLoader()
           
 
Method Summary
static PsXmlNode addColor(PsXmlNode parentNode, java.lang.String type, java.awt.Color color)
           
static void addVector(PsXmlNode parentNode, java.lang.String type, PdVector vector, boolean bAttr)
           
static void addVector(PsXmlNode parentNode, java.lang.String type, PiVector vector, boolean bAttr)
           
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, PiVector[] vector, int length)
           
protected static boolean parse(java.io.BufferedReader bufReader, PsXmlSrc src)
          Parses an XML file and fills a tree of instance PsXmlNode.
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 java.lang.String[][] parseFunList(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 functions to be interpreted.
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 PiVector parseLabelAtt(PsXmlNode attr)
           
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
clone, equals, finalize, 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.

parse

protected static boolean parse(java.io.BufferedReader bufReader,
                               PsXmlSrc src)
                        throws java.io.IOException
Parses an XML file and fills a tree of instance PsXmlNode.
See Also:
read(String)

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:
PdVector instance of 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:
PiVector instance of integer components, null if no integers 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:
node - 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

parseFunList

public static java.lang.String[][] parseFunList(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 functions to be interpreted.
Parameters:
parentNode - parent node containing a set of color nodes as children
type - type of elements in array
attr - array of attributes the vector might have, may be null.
Returns:
parsed string array, or null if failed

parseLabelAtt

public static PiVector parseLabelAtt(PsXmlNode attr)

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 void addVector(PsXmlNode parentNode,
                             java.lang.String type,
                             PdVector vector,
                             boolean bAttr)

addVector

public static void addVector(PsXmlNode parentNode,
                             java.lang.String type,
                             PiVector vector,
                             boolean bAttr)

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 type,
                                 java.awt.Color color)

JavaView® v2.00.008

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