Package org.web3d.vrml.lang
Class VRMLFieldDeclaration
java.lang.Object
org.web3d.vrml.lang.VRMLFieldDeclaration
Representation of any field definition in the VRML system.
Each node contains a collection of fields. Each field has a fixed index for all instances of this node.
This class represents the declaration of a field rather than the complete field instance. For this reason it is immutable. You should not be allowed to change items of a field declaration on the fly.
- Version:
- $Revision: 1.17 $
- Author:
- Justin Couch
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Definition of a field type that we don't know yet because it came from an unresolved IMPORT statement. -
Constructor Summary
ConstructorsConstructorDescriptionVRMLFieldDeclaration
(int accessType, String type, String name) Create an instance of a field declaration. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check for equivalence between this field declaration and another.int
Get the access type of the field.int
Get the size of the raw element.int
Get the field type.Get the field type.getName()
Get the name of this field.static String
toAccessTypeString
(int type, boolean isVRML) Convert a field access type into a string representation in the appropriate specification versiontoString()
Create a pretty string version of this field.toString
(boolean isVRML) Create a pretty string version of this field that modifies the field type based on the version of the spec.
-
Field Details
-
UNKNOWN_IMPORT
Definition of a field type that we don't know yet because it came from an unresolved IMPORT statement.- See Also:
-
-
Constructor Details
-
VRMLFieldDeclaration
public VRMLFieldDeclaration(int accessType, String type, String name) throws InvalidFieldTypeException Create an instance of a field declaration. The string type is automatically converted to the appropriate constant.- Parameters:
accessType
- The type of access that this node hastype
- The type of the node (eg SFInt32)name
- The name of this field- Throws:
InvalidFieldTypeException
- The type is not a recognised type in either X3D or VRML97.- See Also:
-
-
Method Details
-
equals
-
toString
Create a pretty string version of this field. It will produce a string of the form:access_type field_type field_name
Assumes X3D field semantics. If you need VRML naming usetoString(boolean)
. -
getName
Get the name of this field. This will be something like "children" or "translation".- Returns:
- The name of this field
-
getAccessType
public int getAccessType()Get the access type of the field. Under VRML97 this will be one of field, exposedField, eventIn or eventOut. For VRML 3.0, this will always be exposedField.- Returns:
- The access type of this node
- See Also:
-
getFieldType
public int getFieldType()Get the field type. This string represents the field type such as MFNode, SFInt32. A string is used to allow full extensibility.- Returns:
- A constant describing the field type
- See Also:
-
getFieldSize
public int getFieldSize()Get the size of the raw element. Ie an SFVec3f would be 3. The lone exception to this is the IMAGE types which will return 1.- Returns:
- A constant describing the element size.
-
getFieldTypeString
Get the field type. This string represents the field type such as MFNode, SFInt32. A string is used to allow full extensibility.- Returns:
- A string describing the field type
- See Also:
-
toString
Create a pretty string version of this field that modifies the field type based on the version of the spec. It will produce a string of the formaccess_type field_type field_name
- Parameters:
isVRML
- true if this should use the VRML terms, false for X3D- Returns:
- A string representation of this declaration
-
toAccessTypeString
Convert a field access type into a string representation in the appropriate specification version- Parameters:
type
- The access type constantisVRML
- true if this should use the VRML terms, false for X3D- Returns:
- The string representation of it
-