XMT-O Reference Software

xmtutil
Class DOMXMTOParameter

java.lang.Object
  |
  +--xmtutil.DOMXMTOParameter

public class DOMXMTOParameter
extends java.lang.Object

DOMParameter converts the parameter strings to java objects and back.

History:


Field Summary
private static java.util.Hashtable colorStrings_
           
private static boolean debug_
          Whether debug information is to be printed to the console.
private static java.text.DecimalFormat decimalFormat_
           
private static boolean initColorStrings_
           
private static boolean initPixelsPerPt_
           
private static java.lang.String JAVA_MONOSPACED
           
private static java.lang.String JAVA_SANSSERIF
           
private static java.lang.String JAVA_SERIF
           
private static java.lang.String[] outlineStyles_
           
private static float pixelsPerPt_
           
private static java.lang.String separator
           
 
Constructor Summary
DOMXMTOParameter()
           
 
Method Summary
static java.lang.String alignment2Param(java.lang.String horizontalAlignment, java.lang.String verticalAlignment)
          Converts the parameter into an Integer of Java font name.
static java.lang.String arrayOfTwoFloats2Param(java.util.Vector[] twoFloats)
          Converts an array of Float pairs to an XMTO parameter string.
static java.lang.String arrayOfTwoFloats2Param(java.util.Vector[] twoFloats, java.lang.String separator)
           
static java.lang.String color2Param(java.awt.Color color)
           
static java.lang.String colors2Param(java.awt.Color[] color)
          Converts an array of Colors to an XMTO parameter string.
static java.lang.String colors2Param(java.awt.Color[] color, java.lang.String separator)
           
static java.lang.String double2Param(double value)
          Converts the parameter into an Integer.
static java.lang.String float2Param(float value)
          Converts the parameter into an Integer.
static java.lang.String font2ParamFontName(java.awt.Font font)
          Converts the parameter into an Integer of Java font name.
static java.lang.String font2ParamFontSize(java.awt.Font font)
          Converts the parameter into an Integer of Java font style.
static java.lang.String font2ParamFontStyle(java.awt.Font font)
          Converts the parameter into an Integer of Java font style.
private static void initColorStrings()
          Initialize the stings for color parameters.
private static void initDecimalFormat()
           
private static void initPixelsPerPt()
          Initialize the pixels per point size according to the screen resolution.
static java.lang.String integers2Param(java.lang.Integer[] integer)
           
static java.lang.String integers2Param(java.lang.Integer[] integer, java.lang.String separator)
           
static java.lang.String mfBool2Param(java.lang.Boolean[] bools)
          Converts an array of Float to an XMTO parameter string.
static java.lang.String mfBool2Param(java.lang.Boolean[] bools, java.lang.String separator)
          Converts an array of Float to an XMTO parameter string.
static java.lang.String mfFloat2Param(java.lang.Float[] floats)
          Converts an array of Float to an XMTO parameter string.
static java.lang.String mfFloat2Param(java.lang.Float[] floats, java.lang.String separator)
          Converts an array of Float to an XMTO parameter string.
static java.lang.String outlineStyle2param(int style)
          Converts the style into the appropriate style string, otherwise convert it into a Integer string.
static java.lang.Integer[] param2ArrayOfOutlineStyles(java.lang.String param)
           
static java.lang.Integer[] param2ArrayOfOutlineStyles(java.lang.String param, java.lang.String separator)
          Convert a parameter string to an array of pairs of Floats.
static java.util.Vector[] param2ArrayOfTwoFloats(java.lang.String param)
           
static java.util.Vector[] param2ArrayOfTwoFloats(java.lang.String param, java.lang.String separator)
          Convert a parameter string to an array of pairs of Floats.
static java.awt.Color param2Color(java.lang.String param)
          Converts the parameter into a Color.
static java.awt.Color[] param2Colors(java.lang.String param)
          Convert a parameter to an array of color objects.
static java.awt.Color[] param2Colors(java.lang.String param, java.lang.String separator)
           
static java.lang.Double param2Double(java.lang.String param)
          Converts the parameter into an Float.
static java.lang.Float param2Float(java.lang.String param)
          Converts the parameter into an Float.
static java.awt.Font param2Font(java.lang.String paramFontName, java.lang.String paramFontStyle, java.lang.String paramSize)
          Converts the parameter into an Integer of Java font name.
static java.lang.String param2FontName(java.lang.String param)
          Converts the parameter into an Integer of Java font name.
static java.lang.Integer param2FontStyle(java.lang.String param)
          Converts the parameter into an Integer of Java font style.
static java.lang.String param2HorizontalAlignment(java.lang.String param)
          Converts the parameter into an Integer of Java font name.
static java.lang.Integer param2Integer(java.lang.String param)
          Converts the parameter into an Integer.
static java.lang.Integer[] param2Integers(java.lang.String param)
           
static java.lang.Integer[] param2Integers(java.lang.String param, java.lang.String separator)
           
static java.lang.Float[] param2KeySplines(java.lang.String param)
          Convert a parameter string to an array of Floats (MFFloat).
static java.lang.Boolean[] param2MFBool(java.lang.String param)
          Convert a parameter string to an array of Booleans (MFBool).
static java.lang.Boolean[] param2MFBool(java.lang.String param, java.lang.String separator)
          Convert a parameter string to an array of Floats (MFFloat).
static java.lang.Float[] param2MFFloat(java.lang.String param)
          Convert a parameter string to an array of Floats (MFFloat).
static java.lang.Float[] param2MFFloat(java.lang.String param, java.lang.String separator)
          Convert a parameter string to an array of Floats (MFFloat).
static java.lang.Integer param2OutlineStyle(java.lang.String param)
          Converts the parameter into an Integer.
static java.awt.Point param2Point(java.lang.String param)
          Converts the parameter into an Integer.
static java.awt.Point[] param2Points(java.lang.String param)
          Convert a parameter to an array of Points.
static java.awt.Point[] param2Points(java.lang.String param, java.lang.String separator)
           
static java.lang.String[] param2TextLines(java.lang.String param)
          Converts the parameter for the textLines attribute of the string element into an array of lines of text.
static java.lang.String param2TextString(java.lang.String param)
          Converts the parameter for the textLines attribute of the string element into an single text string with new line character separating the lines of text.
static java.lang.Long param2Time(java.lang.String param)
          Converts the parameter into a ms time in a Long.
static java.util.Vector param2TwoDoubles(java.lang.String param)
          Converts the parameter into an Integer.
static java.util.Vector param2TwoFloats(java.lang.String param)
          Converts the parameter into an Integer.
static java.lang.String param2VerticalAlignment(java.lang.String param)
          Converts the parameter into an Integer of Java font name.
static java.lang.String point2Param(java.awt.Point point)
           
static java.lang.String points2Param(java.awt.Point[] point)
          Converts an array of Points to an XMTO parameter string.
static java.lang.String points2Param(java.awt.Point[] point, java.lang.String separator)
           
static void setDebug(boolean debug)
          Enable debugging information to be printed to the console.
static java.lang.String textLines2Param(java.lang.String[] textLines)
          Converts the array of lines of text into a parameter for the textLines attribute of the string element.
static java.lang.String textString2Param(java.lang.String textString)
          Converts the Text string into a parameter for the textLines attribute of the string element.
static java.lang.String time2Param(long time)
           
static java.lang.String twoDoubles2Param(double first, double second)
          Converts the parameter into an Integer.
static java.lang.String twoFloats2Param(float first, float second)
          Converts the parameter into an Integer.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug_

private static boolean debug_
Whether debug information is to be printed to the console. default is not have debug information printed (false).

decimalFormat_

private static java.text.DecimalFormat decimalFormat_

JAVA_SERIF

private static final java.lang.String JAVA_SERIF

JAVA_SANSSERIF

private static final java.lang.String JAVA_SANSSERIF

JAVA_MONOSPACED

private static final java.lang.String JAVA_MONOSPACED

initPixelsPerPt_

private static boolean initPixelsPerPt_

pixelsPerPt_

private static float pixelsPerPt_

initColorStrings_

private static boolean initColorStrings_

colorStrings_

private static java.util.Hashtable colorStrings_

separator

private static final java.lang.String separator

outlineStyles_

private static final java.lang.String[] outlineStyles_
Constructor Detail

DOMXMTOParameter

public DOMXMTOParameter()
Method Detail

alignment2Param

public static java.lang.String alignment2Param(java.lang.String horizontalAlignment,
                                               java.lang.String verticalAlignment)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font.

arrayOfTwoFloats2Param

public static java.lang.String arrayOfTwoFloats2Param(java.util.Vector[] twoFloats)
Converts an array of Float pairs to an XMTO parameter string. Each pair is a Vector of two Float objects. The elements in the output are separated by the separator char. The parameter string is of the form "x y z, x y z, ..."

arrayOfTwoFloats2Param

public static java.lang.String arrayOfTwoFloats2Param(java.util.Vector[] twoFloats,
                                                      java.lang.String separator)

color2Param

public static java.lang.String color2Param(java.awt.Color color)

colors2Param

public static java.lang.String colors2Param(java.awt.Color[] color)
Converts an array of Colors to an XMTO parameter string. The elements in the output are separated by the separator char. The parameter string is of the form "r g b, r g b, ..."

colors2Param

public static java.lang.String colors2Param(java.awt.Color[] color,
                                            java.lang.String separator)

double2Param

public static java.lang.String double2Param(double value)
Converts the parameter into an Integer. If something goes wrong then return null.

float2Param

public static java.lang.String float2Param(float value)
Converts the parameter into an Integer. If something goes wrong then return null.

font2ParamFontName

public static java.lang.String font2ParamFontName(java.awt.Font font)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font.

font2ParamFontSize

public static java.lang.String font2ParamFontSize(java.awt.Font font)
Converts the parameter into an Integer of Java font style. If something goes wrong then return plain style.

font2ParamFontStyle

public static java.lang.String font2ParamFontStyle(java.awt.Font font)
Converts the parameter into an Integer of Java font style. If something goes wrong then return plain style.

initColorStrings

private static void initColorStrings()
Initialize the stings for color parameters.

initDecimalFormat

private static void initDecimalFormat()

initPixelsPerPt

private static void initPixelsPerPt()
Initialize the pixels per point size according to the screen resolution.

integers2Param

public static java.lang.String integers2Param(java.lang.Integer[] integer)

integers2Param

public static java.lang.String integers2Param(java.lang.Integer[] integer,
                                              java.lang.String separator)

mfBool2Param

public static java.lang.String mfBool2Param(java.lang.Boolean[] bools)
Converts an array of Float to an XMTO parameter string. The elements in the output are separated by the separator char.

mfBool2Param

public static java.lang.String mfBool2Param(java.lang.Boolean[] bools,
                                            java.lang.String separator)
Converts an array of Float to an XMTO parameter string. The elements in the output are separated by the separator char.

mfFloat2Param

public static java.lang.String mfFloat2Param(java.lang.Float[] floats)
Converts an array of Float to an XMTO parameter string. The elements in the output are separated by the separator char.

mfFloat2Param

public static java.lang.String mfFloat2Param(java.lang.Float[] floats,
                                             java.lang.String separator)
Converts an array of Float to an XMTO parameter string. The elements in the output are separated by the separator char.

outlineStyle2param

public static java.lang.String outlineStyle2param(int style)
Converts the style into the appropriate style string, otherwise convert it into a Integer string.

param2ArrayOfOutlineStyles

public static java.lang.Integer[] param2ArrayOfOutlineStyles(java.lang.String param)

param2ArrayOfOutlineStyles

public static java.lang.Integer[] param2ArrayOfOutlineStyles(java.lang.String param,
                                                             java.lang.String separator)
Convert a parameter string to an array of pairs of Floats. Each such pair is represented as a Vector of two Float objects.

param2ArrayOfTwoFloats

public static java.util.Vector[] param2ArrayOfTwoFloats(java.lang.String param)

param2ArrayOfTwoFloats

public static java.util.Vector[] param2ArrayOfTwoFloats(java.lang.String param,
                                                        java.lang.String separator)
Convert a parameter string to an array of pairs of Floats. Each such pair is represented as a Vector of two Float objects.

param2Color

public static java.awt.Color param2Color(java.lang.String param)
Converts the parameter into a Color. If something goes wrong then return null.

param2Colors

public static java.awt.Color[] param2Colors(java.lang.String param)
Convert a parameter to an array of color objects. The elements in the parameter are separated by the separator char. The parameter string is of the form "r g b, r g b, ..."

param2Colors

public static java.awt.Color[] param2Colors(java.lang.String param,
                                            java.lang.String separator)

param2Double

public static java.lang.Double param2Double(java.lang.String param)
Converts the parameter into an Float. If something goes wrong then return null.

param2Float

public static java.lang.Float param2Float(java.lang.String param)
Converts the parameter into an Float. If something goes wrong then return null.

param2Font

public static java.awt.Font param2Font(java.lang.String paramFontName,
                                       java.lang.String paramFontStyle,
                                       java.lang.String paramSize)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font.

param2FontName

public static java.lang.String param2FontName(java.lang.String param)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font.

param2FontStyle

public static java.lang.Integer param2FontStyle(java.lang.String param)
Converts the parameter into an Integer of Java font style. If something goes wrong then return plain style.

param2HorizontalAlignment

public static java.lang.String param2HorizontalAlignment(java.lang.String param)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font. NOTE: this should be a MFfield, but for now try our best at determining alignment

param2Integer

public static java.lang.Integer param2Integer(java.lang.String param)
Converts the parameter into an Integer. If something goes wrong then return null.

param2Integers

public static java.lang.Integer[] param2Integers(java.lang.String param)

param2Integers

public static java.lang.Integer[] param2Integers(java.lang.String param,
                                                 java.lang.String separator)

param2KeySplines

public static java.lang.Float[] param2KeySplines(java.lang.String param)
Convert a parameter string to an array of Floats (MFFloat). If something goes wrong then return null.

param2MFBool

public static java.lang.Boolean[] param2MFBool(java.lang.String param)
Convert a parameter string to an array of Booleans (MFBool). If something goes wrong then return null.

param2MFBool

public static java.lang.Boolean[] param2MFBool(java.lang.String param,
                                               java.lang.String separator)
Convert a parameter string to an array of Floats (MFFloat). If something goes wrong then return null.

param2MFFloat

public static java.lang.Float[] param2MFFloat(java.lang.String param)
Convert a parameter string to an array of Floats (MFFloat). If something goes wrong then return null.

param2MFFloat

public static java.lang.Float[] param2MFFloat(java.lang.String param,
                                              java.lang.String separator)
Convert a parameter string to an array of Floats (MFFloat). If something goes wrong then return null.

param2OutlineStyle

public static java.lang.Integer param2OutlineStyle(java.lang.String param)
Converts the parameter into an Integer. The parameter can be one of the valid line style strings. If something goes wrong then return null.

param2Point

public static java.awt.Point param2Point(java.lang.String param)
Converts the parameter into an Integer. If something goes wrong then return null.

param2Points

public static java.awt.Point[] param2Points(java.lang.String param)
Convert a parameter to an array of Points. The elements in the parameter are separated by the separator char. The parameter string is of the form "x y z, x y z, ..." For 2D points, "z" is not specified.

param2Points

public static java.awt.Point[] param2Points(java.lang.String param,
                                            java.lang.String separator)

param2TextLines

public static java.lang.String[] param2TextLines(java.lang.String param)
Converts the parameter for the textLines attribute of the string element into an array of lines of text. The parameter is a MFString.

param2TextString

public static java.lang.String param2TextString(java.lang.String param)
Converts the parameter for the textLines attribute of the string element into an single text string with new line character separating the lines of text. The parameter is a MFString.

param2Time

public static java.lang.Long param2Time(java.lang.String param)
Converts the parameter into a ms time in a Long. If something goes wrong then return null.

param2TwoDoubles

public static java.util.Vector param2TwoDoubles(java.lang.String param)
Converts the parameter into an Integer. If something goes wrong then return null.

param2TwoFloats

public static java.util.Vector param2TwoFloats(java.lang.String param)
Converts the parameter into an Integer. If something goes wrong then return null.

param2VerticalAlignment

public static java.lang.String param2VerticalAlignment(java.lang.String param)
Converts the parameter into an Integer of Java font name. If something goes wrong then return serif font. NOTE: this should be a MFfield, but for now try our best at determining alignment

point2Param

public static java.lang.String point2Param(java.awt.Point point)

points2Param

public static java.lang.String points2Param(java.awt.Point[] point)
Converts an array of Points to an XMTO parameter string. The elements in the output are separated by the separator char. The parameter string is of the form "x y z, x y z, ..."

points2Param

public static java.lang.String points2Param(java.awt.Point[] point,
                                            java.lang.String separator)

setDebug

public static void setDebug(boolean debug)
Enable debugging information to be printed to the console.
Parameters:
debug - sets debug information is printed

textLines2Param

public static java.lang.String textLines2Param(java.lang.String[] textLines)
Converts the array of lines of text into a parameter for the textLines attribute of the string element. The parameter is a MFString.

textString2Param

public static java.lang.String textString2Param(java.lang.String textString)
Converts the Text string into a parameter for the textLines attribute of the string element. The input text string is a single string containing multiple lines of text. The multiple lines are delimted by new line ('\n') characters.

time2Param

public static java.lang.String time2Param(long time)

twoDoubles2Param

public static java.lang.String twoDoubles2Param(double first,
                                                double second)
Converts the parameter into an Integer. If something goes wrong then return null.

twoFloats2Param

public static java.lang.String twoFloats2Param(float first,
                                               float second)
Converts the parameter into an Integer. If something goes wrong then return null.

XMT-O Reference Software