Class MFVec4f
java.lang.Object
org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
org.web3d.vrml.scripting.ecmascript.builtin.MFVec4f
- All Implemented Interfaces:
org.mozilla.javascript.Scriptable
MFVec4f field object.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
BAD_FORMAT_MSG, dataChanged, INVALID_TYPE_MSG, readOnly, READONLY_MSG, scriptField
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares two objects for equality base on the components being the same.get
(int index, org.mozilla.javascript.Scriptable start) Get the value at the given index.Get the value of the named function.float[]
Get the data in this node in its raw form as an array of primitives.void
getRawData
(float[] value) Fetch the raw data held by this instance and copy it into the provided array.boolean
has
(int index, org.mozilla.javascript.Scriptable start) Check for the indexed property presence.boolean
Check for the named property presence.static org.mozilla.javascript.Scriptable
jsConstructor
(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) Constructor for a new Rhino objectboolean
jsFunction_equals
(Object val) Comparison of this object to another of the same type.Creates a string version of this node.void
Sets a property based on the index.void
Sets the named property with a new value.toString()
Format the internal values of this field as a string.void
updateRawData
(float[] values, int numValid) Update the node's raw data from the underlying model.Methods inherited from class org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
delete, delete, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, hasChanged, hasInstance, locateFunction, registerFunction, setParentScope, setPrototype, setReadOnly, setScriptField
-
Constructor Details
-
MFVec4f
public MFVec4f()Default public constructor required by Rhino for when created by an Ecmascript call. -
MFVec4f
public MFVec4f(float[] values, int numValid) Construct a field based on a flattened array of data (sourced from a node).- Parameters:
numValid
- The number of valid values to copy from the array
-
MFVec4f
Construct a field based on an array of SFVec4f objects.- Parameters:
args
- the objects
-
-
Method Details
-
jsConstructor
public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) Constructor for a new Rhino object- Returns:
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) Check for the indexed property presence. Because the spec says that any index value can be used to add new items we return true for all cases where the index is positive.- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classFieldScriptableObject
- Parameters:
start
-- Returns:
- true if it is a defined eventOut or field
-
has
Check for the named property presence.- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classFieldScriptableObject
- Parameters:
start
-- Returns:
- true if it is a defined eventOut or field
-
get
Get the value at the given index.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classFieldScriptableObject
- Returns:
-
get
Get the value of the named function. If no function object is registered for this name, the method will return null.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classFieldScriptableObject
- Parameters:
name
- The variable namestart
- The object where the lookup began- Returns:
- the corresponding function object or null
-
put
Sets a property based on the index. According to C.6.13.1 if the index is greater than the current number of nodes, expand the size by one and add the new value to the end.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classFieldScriptableObject
- Parameters:
index
- The index of the property to setstart
- The object who's property is being setvalue
- The value being requested
-
put
Sets the named property with a new value. We don't allow the users to dynamically change the length property of this node. That would cause all sorts of problems. Therefore it is read-only as far as this implementation is concerned.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classFieldScriptableObject
- Parameters:
name
- The name of the property to definestart
- The object who's property is being setvalue
- The value being requested
-
jsFunction_toString
Creates a string version of this node. Just calls the standard toString() method of the object.- Returns:
- A VRML string representation of the field
-
jsFunction_equals
Comparison of this object to another of the same type. Just calls the standard equals() method of the object.- Parameters:
val
- The value to compare to this object- Returns:
- true if the components of the object are the same
-
toString
-
equals
-
updateRawData
public void updateRawData(float[] values, int numValid) Update the node's raw data from the underlying model. If this wrapper has a local changed copy of the data that has not yet been committed to the underlying model, this request is ignored and the current data stays.- Parameters:
values
- The list of values to update herenumValid
- The number of valid values to copy from the array The number of valid values to use from the array
-
getRawData
public float[] getRawData()Get the data in this node in its raw form as an array of primitives.- Returns:
- A flat array of values [x1, y1, z1, x2, y2, z2, ....]
-
getRawData
public void getRawData(float[] value) Fetch the raw data held by this instance and copy it into the provided array.- Parameters:
value
- The array to copy the data into
-