x3d
Interface Field


public abstract interface Field

The interface to any X3D field. Provides all methods available on fields.

Version:
1.0
Author:
Holger Grahn, Kristof Nast-Kolb, Bitmanagement Software

Field Summary
static int EVENTIN
           
static int EVENTOUT
           
static int EXPOSEDFIELD
           
static int MFColor
           
static int MFFloat
           
static int MFInt32
           
static int MFNode
           
static int MFRotation
           
static int MFString
           
static int MFTime
           
static int MFVec2f
           
static int MFVec3f
           
static int SFBool
           
static int SFColor
           
static int SFFloat
           
static int SFImage
           
static int SFInt32
           
static int SFNode
           
static int SFRotation
           
static int SFString
           
static int SFTime
           
static int SFVec2f
           
static int SFVec3f
           
static int UNKNOWN_FIELD
           
 
Method Summary
 void addObserver(EventObserver observer, java.lang.Object userData)
          Add an observer for a field with read capability (EventOut or ExposedField) the observer object will be notified of any changes to this field
 int getAccessType()
          Get the access type of this field, e.g.
 int getLength()
          get the number of values in this field returns the number of single values,
e.g an SFVec3f has the length 3
 java.lang.String getName()
          Get the name of this field.
 int getType()
          Get the basic type of this field, e.g.
 boolean getValueBool()
          get the value of an SFBool
 double getValueDouble()
          get the value of an SFTime
 double[] getValueDoubleArray(int start, int count)
          get the value of an MFTime implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
 float getValueFloat()
          get the value of an SFFloat
 float[] getValueFloatArray(int start, int count)
          get the value of an SFVec3f, MFFloat, etc.
 int getValueInt()
          get the value of an SFInt32
 int[] getValueIntArray(int start, int count)
          get the value of an MFInt32 implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
 Node getValueNode()
          get the value of an SFNode
 Node[] getValueNodeArray(int start, int count)
          get the value of an MFNode
 java.lang.String getValueString()
          get the value of an SFString
 java.lang.String[] getValueStringArray(int start, int count)
          get the value of an MFString implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
 void removeObserver(EventObserver observer, java.lang.Object userData)
          Remove a observer for changes in this field. the observer has been added before with addObserver
 void setValueBool(boolean value)
          set the value of an SFBool
 void setValueDouble(double value)
          set the value of an SFTime
 void setValueDoubleArray(int start, int count, double[] value)
          set the value of an MFTime
 void setValueFloat(float value)
          set the value of an SFFloat
 void setValueFloatArray(int start, int count, float[] value)
          set the value of an SFVec3f, MFFloat, etc.
 void setValueInt(int value)
          set the value of an SFInt32
 void setValueIntArray(int start, int count, int[] value)
          set the value of an MFInt32
 void setValueNode(Node value)
          set the value of an SFNode
 void setValueNodeArray(int start, int count, Node[] value)
          set the value of an MFNode
 void setValueString(java.lang.String value)
          set the value of an SFString
 void setValueStringArray(int start, int count, java.lang.String[] value)
          set the value of an MFString implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
 

Field Detail

SFBool

public static final int SFBool

SFColor

public static final int SFColor

SFFloat

public static final int SFFloat

SFImage

public static final int SFImage

SFInt32

public static final int SFInt32

SFNode

public static final int SFNode

SFRotation

public static final int SFRotation

SFString

public static final int SFString

SFTime

public static final int SFTime

SFVec2f

public static final int SFVec2f

SFVec3f

public static final int SFVec3f

MFColor

public static final int MFColor

MFFloat

public static final int MFFloat

MFInt32

public static final int MFInt32

MFNode

public static final int MFNode

MFRotation

public static final int MFRotation

MFString

public static final int MFString

MFTime

public static final int MFTime

MFVec2f

public static final int MFVec2f

MFVec3f

public static final int MFVec3f

UNKNOWN_FIELD

public static final int UNKNOWN_FIELD

EVENTIN

public static final int EVENTIN

EVENTOUT

public static final int EVENTOUT

EXPOSEDFIELD

public static final int EXPOSEDFIELD
Method Detail

getType

public int getType()
Get the basic type of this field, e.g. SFBool
Returns:
The type as defined by one of the above values

getAccessType

public int getAccessType()
Get the access type of this field, e.g. EVENTIN. EventIns can only be accessed for writing, EventOuts only for reading.
ExposedFields can be read and written.
Returns:
The access type as defined by one of the above access values

getName

public java.lang.String getName()
Get the name of this field.
Returns:
The field name.

addObserver

public void addObserver(EventObserver observer,
                        java.lang.Object userData)
Add an observer for a field with read capability (EventOut or ExposedField)

the observer object will be notified of any changes to this field

Parameters:
observer - The observer to add
userData - The data to associate with this observer instance, can be null

removeObserver

public void removeObserver(EventObserver observer,
                           java.lang.Object userData)
Remove a observer for changes in this field.

the observer has been added before with addObserver

Parameters:
observer - The observer to remove
userData - The userData associated with this observer instance

getLength

public int getLength()
get the number of values in this field returns the number of single values,
e.g an SFVec3f has the length 3
Returns:
the number of values of the field

getValueBool

public boolean getValueBool()
                     throws java.lang.IllegalArgumentException
get the value of an SFBool
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueDouble

public double getValueDouble()
                      throws java.lang.IllegalArgumentException
get the value of an SFTime
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueInt

public int getValueInt()
                throws java.lang.IllegalArgumentException
get the value of an SFInt32
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueFloat

public float getValueFloat()
                    throws java.lang.IllegalArgumentException
get the value of an SFFloat
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueString

public java.lang.String getValueString()
                                throws java.lang.IllegalArgumentException
get the value of an SFString
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueNode

public Node getValueNode()
                  throws java.lang.IllegalArgumentException
get the value of an SFNode
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

getValueDoubleArray

public double[] getValueDoubleArray(int start,
                                    int count)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.ArrayIndexOutOfBoundsException
get the value of an MFTime implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

getValueIntArray

public int[] getValueIntArray(int start,
                              int count)
                       throws java.lang.IllegalArgumentException,
                              java.lang.ArrayIndexOutOfBoundsException
get the value of an MFInt32 implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

getValueStringArray

public java.lang.String[] getValueStringArray(int start,
                                              int count)
                                       throws java.lang.IllegalArgumentException,
                                              java.lang.ArrayIndexOutOfBoundsException
get the value of an MFString implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

getValueFloatArray

public float[] getValueFloatArray(int start,
                                  int count)
                           throws java.lang.IllegalArgumentException,
                                  java.lang.ArrayIndexOutOfBoundsException
get the value of an SFVec3f, MFFloat, etc. implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

getValueNodeArray

public Node[] getValueNodeArray(int start,
                                int count)
                         throws java.lang.IllegalArgumentException,
                                java.lang.ArrayIndexOutOfBoundsException
get the value of an MFNode
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

setValueBool

public void setValueBool(boolean value)
                  throws java.lang.IllegalArgumentException
set the value of an SFBool
Parameters:
value - the new value for the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueDouble

public void setValueDouble(double value)
                    throws java.lang.IllegalArgumentException
set the value of an SFTime
Parameters:
value - the new value for the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueInt

public void setValueInt(int value)
                 throws java.lang.IllegalArgumentException
set the value of an SFInt32
Parameters:
value - the new value for the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueFloat

public void setValueFloat(float value)
                   throws java.lang.IllegalArgumentException
set the value of an SFFloat
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueString

public void setValueString(java.lang.String value)
                    throws java.lang.IllegalArgumentException
set the value of an SFString
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueNode

public void setValueNode(Node value)
                  throws java.lang.IllegalArgumentException
set the value of an SFNode
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type

setValueDoubleArray

public void setValueDoubleArray(int start,
                                int count,
                                double[] value)
                         throws java.lang.IllegalArgumentException,
                                java.lang.ArrayIndexOutOfBoundsException
set the value of an MFTime
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is written.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

setValueIntArray

public void setValueIntArray(int start,
                             int count,
                             int[] value)
                      throws java.lang.IllegalArgumentException,
                             java.lang.ArrayIndexOutOfBoundsException
set the value of an MFInt32
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is written.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

setValueStringArray

public void setValueStringArray(int start,
                                int count,
                                java.lang.String[] value)
                         throws java.lang.IllegalArgumentException,
                                java.lang.ArrayIndexOutOfBoundsException
set the value of an MFString implementations may return a reference instead of a copy of the data of the field if the applications changes data in the returned array, the field must be notified using setValue(array)
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is written.
Returns:
the value of the field
Throws:
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.
IllegalArgumentException, - if called for the wrong field type

setValueFloatArray

public void setValueFloatArray(int start,
                               int count,
                               float[] value)
                        throws java.lang.IllegalArgumentException,
                               java.lang.ArrayIndexOutOfBoundsException
set the value of an SFVec3f, MFFloat, etc. The sequence of single values is X, Y, Z, e.g. for an SFVec3f.
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is written.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

setValueNodeArray

public void setValueNodeArray(int start,
                              int count,
                              Node[] value)
                       throws java.lang.IllegalArgumentException,
                              java.lang.ArrayIndexOutOfBoundsException
set the value of an MFNode
Parameters:
start - the start value, normally 0
count - the number of values. if -1 the whole array is read.
Returns:
the value of the field
Throws:
IllegalArgumentException, - if called for the wrong field type
java.lang.ArrayIndexOutOfBoundsException - The start or count was outside the current data array bounds.

Questions or comments.
Copyright 1999, Bitmanagement Software, Inc.