Class WF3DField

java.lang.Object
  |
  +--WF3DField

public final class WF3DField
extends java.lang.Object

This class is used to represent a VRML field of any type. The Java type that an instance of this class contains depends on the VRML field represented, and follow below conversion table:

VRML field typeWF3D Java typeThe object structure
SFBool boolean -
SFString String -
SFInt32 int -
SFNode WF3DNode -
SFRotation float[4] { Nx, Ny, Nz, angle }
SFColor int 0xRRGGBB
SFImage WF3DImg -
SFFloat float -
SFTime double -
SFVec2f float[2] { s, t }
SFVec3f float[3] { x, y, z }
MFString String[...] { string0, string1 ... }
MFInt32 int[...] { int0, int1, ... }
MFNode WF3DNode[...] { node0, node1, ...}
MFRotation float[...] { Nx0, Ny0, Nz0, angle0, Nx1, Ny1, Nz1, angle1, ... ]
MFColor int[...] { 0xRRGGBB0, 0xRRGGBB1, ... }
MFFloat float[...] { float0, float1 ... }
MFVec2f float[...] { x0, y0, x1, y1, ... }
MFVec3f float[...] [ x0, y0, z0, x1, y1, z1, ... ]



Field Summary
 WF3DNode parent
          The node this field belongs to.
 int type
          The field type.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 boolean getBoolean()
          Retrieves the boolean value (if type==Field.SFBool).
 double getDouble()
          Retrieves the double value (if type==Field.SFTime).
 float getFloat()
          Retrieves the float value (if type==Field.SFFloat).
 float[] getFloatArray()
          Retrieves the float array value (if type==Field.SFVec2f, type==Field.SFVec3f, type==Field.MFFloat, type==Field.MFVec2f or type==Field.MFVec3f).
 int getInt()
          Retrieves the int value (if type==Field.SFInt32 or type==Field.SFColor).
 int[] getIntArray()
          Retrieves the int array value (if type==Field.MFInt32 or type==Field.MFColor).
 WF3DNode getNode()
          Retrieves the WF3DNode value (if type==Field.SFNode or type==Field.MFNode).
 WF3DNode[] getNodeArray()
          Retrieves the WF3DNode array (if type==Field.MFNode).
 java.lang.String getString()
          Retrieves the String value (if type==Field.SFString or type==Field.MFString).
 java.lang.String[] getStringArray()
          Retrieves the String array value (if type==Field.MFString).
 void set()
          Signals that this field was set.
 void set(boolean booleanValue)
          Sets the field value, (if type==Field.SFBool).
 void set(double doubleValue)
          Sets the field value (if type==Field.SFTime).
 void set(float floatValue)
          Sets the field value (if type==Field.SFFloat).
 void set(int intValue)
          Sets the field value, (if type==Field.SFInt32).
 void set(java.lang.Object newValue)
          Sets the field value (if type==Field.SFString, type==Field.SFNode, type==Field.SFImage or type==(any Field.MF value)).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public int type
The field type. See class Field for a listing of existing field types.


parent

public WF3DNode parent
The node this field belongs to.

Method Detail

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.

set

public void set()
Signals that this field was set.


set

public void set(java.lang.Object newValue)
Sets the field value (if type==Field.SFString, type==Field.SFNode, type==Field.SFImage or type==(any Field.MF value)). The argument type must be compatible with the VRML field type this object represent (see above conversion table), or else this may cause an error.

Parameters:
newValue - The new value this field will contain.

set

public void set(boolean booleanValue)
Sets the field value, (if type==Field.SFBool). This function may only be called on objects representing a VRML field of type SFBool.


set

public void set(int intValue)
Sets the field value, (if type==Field.SFInt32). This function may only be called on objects representing a VRML field of type SFInt32 or SFColor.


set

public void set(float floatValue)
Sets the field value (if type==Field.SFFloat). This function may only be called on objects representing a VRML field of type SFFloat.


set

public void set(double doubleValue)
Sets the field value (if type==Field.SFTime). This function may only be called on objects representing a VRML field of type SFTime.


getBoolean

public boolean getBoolean()
Retrieves the boolean value (if type==Field.SFBool). This method will generate an error if the object represent any other than a VRML field of type SFBool.

Returns:
The boolean value this field contains.

getInt

public int getInt()
Retrieves the int value (if type==Field.SFInt32 or type==Field.SFColor). This method will generate an error if the object represent any other than a VRML field of type SFInt32 or SFColor.

Returns:
The int value this field contains.

getFloat

public float getFloat()
Retrieves the float value (if type==Field.SFFloat). This method will generate an error if the object represent any other than a VRML field of type SFFloat.

Returns:
The float value this field contains.

getDouble

public double getDouble()
Retrieves the double value (if type==Field.SFTime). This method will generate an error if the object represent any other than a VRML field of type SFTime.

Returns:
The double value this field contains.

getString

public java.lang.String getString()
Retrieves the String value (if type==Field.SFString or type==Field.MFString). In the case of MFString fields this method returns the first String element in the String array. This method will generate an error if the object represent any other than a VRML field of type SFString or MFString.

Returns:
The String value this field contains.

getNode

public WF3DNode getNode()
Retrieves the WF3DNode value (if type==Field.SFNode or type==Field.MFNode). In the case of MFNode this method returns the first WF3DNode element in the WF3DNode array. This method will generate an error if the object represent any other than a VRML field of type SFNode or MFNode.

Returns:
The WF3DNode value this field contains.

getIntArray

public int[] getIntArray()
Retrieves the int array value (if type==Field.MFInt32 or type==Field.MFColor). This method will generate an error if the object represent any other than a VRML field of type MFInt32 or MFColor.

Returns:
The int array value this field contains.

getFloatArray

public float[] getFloatArray()
Retrieves the float array value (if type==Field.SFVec2f, type==Field.SFVec3f, type==Field.MFFloat, type==Field.MFVec2f or type==Field.MFVec3f). This method will generate an error if the object represent any other than a VRML field of type SFVec2f, SFVec3f, MFFloat, MFVec2f or MFVec3f.

Returns:
The float array this field contains.

getStringArray

public java.lang.String[] getStringArray()
Retrieves the String array value (if type==Field.MFString). This method will generate an error if the object represent any other than a VRML field of type MFString.

Returns:
The String array this field contains.

getNodeArray

public WF3DNode[] getNodeArray()
Retrieves the WF3DNode array (if type==Field.MFNode). This method will generate an error if the object represent any other than a VRML field of type MFNode.

Returns:
The WF3DNode array this field contains.