com.sun.j3d.utils.universe
Class ConfigCommand

java.lang.Object
  extended by com.sun.j3d.utils.universe.ConfigCommand

 class ConfigCommand
extends java.lang.Object

Contains the elements which compose a configuration file command, including the command name, type, and arguments.


Field Summary
(package private) static int ALIAS
          Specifies that this command creates an alias for a ConfigObject of the same base name.
(package private)  int argc
          The number of arguments in this command, including the command name.
(package private)  java.lang.Object[] argv
          An array containing all of this command's arguments, including the command name.
(package private) static int ATTRIBUTE
          Specifies that this command sets an attribute for a class known to ConfiguredUniverse.
(package private)  java.lang.String baseName
          The base name of this command, from which the name of the ConfigObject subclass that processes it is derived.
(package private) static int BUILTIN
          Specifies that this command is a deferred built-in command that can't be immediately evaluated by the parser.
(package private)  java.lang.String commandName
          The name of the command being invoked, which is always the first argument of the command.
(package private) static int CREATE
          Specifies that this command creates a new ConfigObject.
(package private)  java.lang.String fileName
          The file from which this command was read.
(package private) static int IGNORE
          Specifes that this command is entirely processed by the constructor and should be ignored by subsequent recipients.
(package private) static int INCLUDE
          Specifies that this command is an include file directive.
(package private)  java.lang.String instanceName
          The instance name of the ConfigObject subclass which processes this command.
(package private)  int lineNumber
          The line number from which this command was read.
(package private) static int PROPERTY
          Specifies that this command sets a Java system property or a property for a class unknown to ConfiguredUniverse.
(package private)  int type
          The type of this command, either CREATE, PROPERTY, ALIAS, BUILTIN, INCLUDE, or IGNORE.
 
Constructor Summary
ConfigCommand(java.util.Collection elements, java.lang.String fileName, int lineNumber)
          Constructs a ConfigCommand from configuration file command arguments.
 
Method Summary
private  java.lang.String checkName(java.lang.Object o)
          Checks if the given object is an instance of String.
(package private) static java.lang.String evaluateJavaProperty(java.lang.String key)
          Evaluates the specified Java property string if allowed by the security manager.
(package private) static java.lang.String[] formatMatrixRows(int rowCount, int colCount, double[] m)
          Formats a matrix with fixed fractional digits and integer padding to align the decimal points in columns.
(package private) static java.lang.String[] formatMatrixRows(Matrix3d m3)
          Calls formatMatrixRows(3, 3, m), where m is a an array of doubles retrieved from the given Matrix3d.
(package private) static java.lang.String[] formatMatrixRows(Matrix4d m4)
          Calls formatMatrixRows(4, 4, m), where m is a an array of doubles retrieved from the given Matrix4d.
private static void processJavaProperty(int argc, java.lang.Object[] argv)
          Sets the Java property specified in the command.
(package private) static java.lang.String setJavaProperty(java.lang.String key, java.lang.String value)
          Sets the given Java system property if allowed by the security manager.
 java.lang.String toString()
          Returns the String representation of this command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREATE

static final int CREATE
Specifies that this command creates a new ConfigObject.

See Also:
Constant Field Values

ATTRIBUTE

static final int ATTRIBUTE
Specifies that this command sets an attribute for a class known to ConfiguredUniverse. As of Java 3D 1.3.1, these commands are handled the same as property commands (see PROPERTY below) and this constant is no longer used.

See Also:
Constant Field Values

PROPERTY

static final int PROPERTY
Specifies that this command sets a Java system property or a property for a class unknown to ConfiguredUniverse. Properties for such a class are set by using the reflection API to invoke a method whose name is specified in the command's argument list. Such a method must accept an array of Object as its sole parameter, where that array contains all the command elements which appear after the method name.

As of Java 3D 1.3.1, this is handled the same as an attribute. The individual setProperty() method implementations of ConfigObject determine whether the method to set the property can be invoked directly or through introspection. If through introspection, then the evaluation of the property must be delayed until the target object is instantiated.

See Also:
Constant Field Values

ALIAS

static final int ALIAS
Specifies that this command creates an alias for a ConfigObject of the same base name.

See Also:
Constant Field Values

BUILTIN

static final int BUILTIN
Specifies that this command is a deferred built-in command that can't be immediately evaluated by the parser. Its evaluation is delayed until all config objects are instantiated and their properties can be evaluated.

See Also:
Constant Field Values

INCLUDE

static final int INCLUDE
Specifies that this command is an include file directive.

See Also:
Constant Field Values

IGNORE

static final int IGNORE
Specifes that this command is entirely processed by the constructor and should be ignored by subsequent recipients.

See Also:
Constant Field Values

type

int type
The type of this command, either CREATE, PROPERTY, ALIAS, BUILTIN, INCLUDE, or IGNORE.


argc

int argc
The number of arguments in this command, including the command name.


argv

java.lang.Object[] argv
An array containing all of this command's arguments, including the command name.


commandName

java.lang.String commandName
The name of the command being invoked, which is always the first argument of the command.


baseName

java.lang.String baseName
The base name of this command, from which the name of the ConfigObject subclass that processes it is derived. This is constructed by stripping off the leading "New" prefix or the trailing "Attribute", "Property", or "Alias" suffix of the command name. The name of the ConfigObject subclass which handles the command is derived by adding "Config" as a prefix to the base name.


instanceName

java.lang.String instanceName
The instance name of the ConfigObject subclass which processes this command. Together with the base name this provides the handle by which a ConfigObject can be referenced by other commands in the configuration file.


fileName

java.lang.String fileName
The file from which this command was read.


lineNumber

int lineNumber
The line number from which this command was read.

Constructor Detail

ConfigCommand

ConfigCommand(java.util.Collection elements,
              java.lang.String fileName,
              int lineNumber)
Constructs a ConfigCommand from configuration file command arguments.

Parameters:
elements - arguments to this command, including the command name
fileName - name of the file from where the command was read
lineNumber - line number where the command is found in the file
Method Detail

processJavaProperty

private static void processJavaProperty(int argc,
                                        java.lang.Object[] argv)
Sets the Java property specified in the command. If the command has 3 arguments then it's an unconditional assignment. If the 3rd argument is "Default", then the property is set to the value of the 4th argument only if the specified property has no existing value.

Parameters:
argc - the number of arguments in the command
argv - command arguments as an array of Objects; the 1st is the command name (ignored), the 2nd is the name of the Java property, the 3rd is the value to be set or the keyword "Default", and the 4th is thevalue to be set if the Java property doesn't already exist

setJavaProperty

static java.lang.String setJavaProperty(java.lang.String key,
                                        java.lang.String value)
Sets the given Java system property if allowed by the security manager.

Parameters:
key - property name
value - property value
Returns:
previous property value if any

evaluateJavaProperty

static java.lang.String evaluateJavaProperty(java.lang.String key)
Evaluates the specified Java property string if allowed by the security manager.

Parameters:
key - string containing a Java property name
Returns:
string containing the Java property valaue

checkName

private final java.lang.String checkName(java.lang.Object o)
Checks if the given object is an instance of String.

Parameters:
o - the object to be checked
Returns:
the object cast to a String
Throws:
java.lang.IllegalArgumentException - if the object is not a String

formatMatrixRows

static java.lang.String[] formatMatrixRows(Matrix3d m3)
Calls formatMatrixRows(3, 3, m), where m is a an array of doubles retrieved from the given Matrix3d.

Parameters:
m3 - matrix to be formatted
Returns:
matrix rows formatted into strings

formatMatrixRows

static java.lang.String[] formatMatrixRows(Matrix4d m4)
Calls formatMatrixRows(4, 4, m), where m is a an array of doubles retrieved from the given Matrix4d.

Parameters:
m4 - matrix to be formatted
Returns:
matrix rows formatted into strings

formatMatrixRows

static java.lang.String[] formatMatrixRows(int rowCount,
                                           int colCount,
                                           double[] m)
Formats a matrix with fixed fractional digits and integer padding to align the decimal points in columns. Non-negative numbers print up to 7 integer digits, while negative numbers print up to 6 integer digits to account for the negative sign. 6 fractional digits are printed.

Parameters:
rowCount - number of rows in the matrix
colCount - number of columns in the matrix
m - matrix to be formatted
Returns:
matrix rows formatted into strings

toString

public java.lang.String toString()
Returns the String representation of this command.

Overrides:
toString in class java.lang.Object
Returns:
string representing this command


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.