vrml.eai.field
Class EventOutMFNode
java.lang.Object
vrml.eai.field.BaseField
vrml.eai.field.EventOut
vrml.eai.field.EventOutMField
vrml.eai.field.EventOutMFNode
public abstract class EventOutMFNode
- extends EventOutMField
Reference to a MFNode event-out slot. Use this class to read
values from MFNode event-out slots.
The following example gets the nodes from the "children" field of a
Group node and prints their types to the console:
vrml.eai.Node group = ...;
vrml.eai.field.EventOutMFNode children_changed = (vrml.eai.field.EventOutMFNode)group.getEventOut("children_changed");
vrml.eai.Node[] nodes = children_changed.getValue();
for (int i = 0; i < nodes.length; ++i)
if (nodes[i] == null)
System.out.println("null");
else
System.out.println(nodes[i].getType());
Fields inherited from class vrml.eai.field.BaseField |
MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f |
Method Summary |
abstract Node |
get1Value(int index)
Returns one element of a MFNode event-out slot. |
abstract Node[] |
getValue()
Returns the current value of a MFNode event-out slot. |
abstract void |
getValue(Node[] value)
Returns the current value of a MFNode event-out slot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventOutMFNode
protected EventOutMFNode()
getValue
public abstract Node[] getValue()
- Returns the current value of a MFNode event-out slot.
The following example gets the nodes from the "children" field of a
Group node and prints their types to the console:
vrml.eai.Node group = ...;
vrml.eai.field.EventOutMFNode children_changed = (vrml.eai.field.EventOutMFNode)group.getEventOut("children_changed");
vrml.eai.Node[] nodes = children_changed.getValue();
for (int i = 0; i < nodes.length; ++i)
if (nodes[i] == null)
System.out.println("null");
else
System.out.println(nodes[i].getType());
- Returns:
- The current nodes.
getValue
public abstract void getValue(Node[] value)
throws java.lang.ArrayIndexOutOfBoundsException
- Returns the current value of a MFNode event-out slot.
The following example gets the nodes from the "children" field of a
Group node and prints their types to the console:
vrml.eai.Node group = ...;
vrml.eai.field.EventOutMFNode children_changed = (vrml.eai.field.EventOutMFNode)group.getEventOut("children_changed");
int size = children_changed.size();
vrml.eai.Node[] nodes = new vrml.eai.Node[size];
children_changed.getValue(nodes);
for (int i = 0; i < size; ++i)
if (nodes[i] == null)
System.out.println("null");
else
System.out.println(nodes[i].getType());
- Parameters:
value
- An array of nodes that gets filled with the current
value of the MFNode event-out slot.
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- when the value array is
too small.
get1Value
public abstract Node get1Value(int index)
throws java.lang.ArrayIndexOutOfBoundsException
- Returns one element of a MFNode event-out slot.
The following example gets the first node from the "children" field
of a Group node and prints its type to the console:
vrml.eai.Node group = ...;
vrml.eai.field.EventOutMFNode children_changed = (vrml.eai.field.EventOutMFNode)group.getEventOut("children_changed");
vrml.eai.Node node = children_changed.get1Value(0);
if (node == null)
System.out.println("null");
else
System.out.println(node.getType());
- Parameters:
index
- The index of the element, starting at 0.
- Returns:
- The node.
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- when the index is invalid.