Interface MFTime
Time values are represented as per the VRML IS specification Section 4.11 Time. That is, time is set as VRML "Time" - the number of seconds since Jan 1, 1970 GMT, rather than a Java time which is a long, the number of milliseconds since Jan 1, 1970 GMT. To convert between the two simply divide java time by 1000 and cast to a double.
Note that in setting time values from an external application, the idea of
the time that java represents and the time that the VRML world currently
has set may well be different. It is best to source the current "time" from
a node or eventOut in the VRML world rather than relying exclusively on
the value returned from System.currentTimeMillies
. This is
especially important to note if you are dealing with high speed, narrow
interval work such as controlling animation.
- Version:
- 1.0 30 April 1998
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(double value) Places a new value at the end of the existing value, increasing the field length accordingly.void
clear()
Removes all values in the field and changes the field size to zero.double
get1Value
(int index) Get a particular time value in the given eventOut array.void
getValue
(double[] vec) Write the value of the event out to the given array.void
insertValue
(int index, double value) Inserts a value into an existing index of the field.void
removeValue
(int index) Removes one value from the field.void
set1Value
(int index, double value) Set a particular time value in the given eventIn array.void
setValue
(int size, double[] value) Set the value of the array of times.void
setValue
(int size, long[] value) Set the value of the array of times based on Java time values.Methods inherited from interface org.web3d.x3d.sai.X3DField
addX3DEventListener, getDefinition, getUserData, isReadable, isWritable, removeX3DEventListener, setUserData
-
Method Details
-
append
void append(double value) Places a new value at the end of the existing value, increasing the field length accordingly.- Parameters:
value
- The value to append
-
clear
void clear()Removes all values in the field and changes the field size to zero. -
getValue
void getValue(double[] vec) Write the value of the event out to the given array.- Parameters:
vec
- The array to be filled in where- Throws:
ArrayIndexOutOfBoundsException
- The provided array was too small
-
get1Value
double get1Value(int index) Get a particular time value in the given eventOut array.If the index is out of the bounds of the current array of data values an ArrayIndexOutOfBoundsException will be generated.
- Parameters:
index
- The position to get the time value- Returns:
- The time value.
- Throws:
ArrayIndexOutOfBoundsException
- The index was outside of the bounds of the current array.
-
insertValue
Inserts a value into an existing index of the field. Current field values from the index to the end of the field are shifted down and the field length is increased by one to accommodate the new element. If the index is out of the bounds of the current field an ArrayIndexOutofBoundsException will be generated.- Parameters:
index
- The position at which to insertvalue
- The new element to insert- Throws:
ArrayIndexOutOfBoundsException
- The index was outside the current field size.
-
removeValue
Removes one value from the field. Values at indices above the removed element will be shifted down by one and the size of the field will be reduced by one.- Parameters:
index
- The position of the value to remove.- Throws:
ArrayIndexOutOfBoundsException
- The index was outside the current field size.
-
setValue
void setValue(int size, double[] value) Set the value of the array of times. Time values are not required to conform to any range checks.- Parameters:
size
- The number of items to be copied from the arrayvalue
- The array of time values
-
setValue
void setValue(int size, long[] value) Set the value of the array of times based on Java time values. Time values are not required to conform to any range checks.- Parameters:
size
- The number of items to be copied from the arrayvalue
- The array of time values
-
set1Value
void set1Value(int index, double value) Set a particular time value in the given eventIn array. To the VRML world this will generate a full MFTime event with the nominated index value changed.If the index is out of the bounds of the current array of data values an ArrayIndexOutOfBoundsException will be generated.
- Parameters:
index
- The position to set the time valuevalue
- The time value to set.- Throws:
ArrayIndexOutOfBoundsException
- The index was outside of the bounds of the current array.
-