Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.trapezium.vrml.node
Class PROTOInstance  view PROTOInstance download PROTOInstance.java

java.lang.Object
  extended bycom.trapezium.vrml.VrmlElement
      extended bycom.trapezium.vrml.SingleTokenElement
          extended bycom.trapezium.vrml.MultipleTokenElement
              extended bycom.trapezium.vrml.fields.Field
                  extended bycom.trapezium.vrml.node.Node
                      extended bycom.trapezium.vrml.node.PROTOInstance
All Implemented Interfaces:
java.io.Serializable, com.trapezium.pattern.VisitorPattern

public class PROTOInstance
extends Node

Scene graph component for a PROTO instance. The PROTOInstance has field values which are explicitly declared, and are part of the PROTO interface. It has node values which are copied from the PROTO declaration, with actual values from the instance substituted where indicated by IS fields. Note: The above level of PROTOInstance construction is not complete. USE nodeNameId

Since:
1.0
Version:
1.21, 16 July 1998, self ref PROTO USE bug, 1.12, 7 April 1998, added "getFieldNames" method, 1.1, 6 Jan 1998

Nested Class Summary
 
Nested classes inherited from class com.trapezium.vrml.fields.Field
 
Field Summary
(package private)  PROTObase protoBase
           
 
Fields inherited from class com.trapezium.vrml.node.Node
fieldNameList
 
Fields inherited from class com.trapezium.vrml.fields.Field
 
Fields inherited from class com.trapezium.vrml.MultipleTokenElement
 
Fields inherited from class com.trapezium.vrml.SingleTokenElement
 
Fields inherited from class com.trapezium.vrml.VrmlElement
baseProfile, createCount, disableBaseProfile, errorString, noUnusedDEFwarning, nowarning
 
Constructor Summary
PROTOInstance(PROTObase pb)
          Class constructor
 
Method Summary
 void checkInUse()
          Check if the instance fields are in use, handles case where the field is not referenced by IS in the PROTO declaration, but the field is DEFed in an instance, and USEd somewhere else.
 void copyBaseNodeInfo()
          Copy all nodes containing IS references from PROTO declaration body.
 java.lang.String getClosestFieldId(java.lang.String fieldName)
          get the field id with the closest spelling
 com.trapezium.vrml.grammar.FieldDescriptor getFieldDescriptor(java.lang.String fieldId)
          Get the FieldDescriptor, defined by IS usage for a field
 java.lang.String[] getFieldNames()
          Get a list of field names defined for the PROTO.
 java.lang.String getFieldType(java.lang.String fieldName)
          get the VRML97 field type SF or MF for the field.
 com.trapezium.vrml.fields.Field getInterfaceDeclaration(java.lang.String fieldName)
          get the interface declaration of the field
 int getInterfaceType(java.lang.String fieldId)
          Get the interface type of a particular field.
 java.lang.String getNodeName()
          Get the name of the Node type compatible with this PROTO
 PROTObase getPROTObase()
          Get a reference to the declaration of the PROTO
 java.lang.String getPROTOname()
          Get the name of the PROTO this instance is based on
 Node getPROTONodeType()
          Get the first node in the PROTO declaration, this node defines the type of the PROTO.
 boolean isPROTOnode()
          template method, overrides Node.isPROTOnode() which returns false.
 boolean isValidFieldId(java.lang.String fieldName)
          Check if field is part of the PROTO interface declaration.
 void verify(com.trapezium.parse.TokenEnumerator v)
          Validate the nodes contained in a PROTO instance.
 
Methods inherited from class com.trapezium.vrml.node.Node
addChildNode, addChildNode, addChildNode, addInterface, ddump, generatedParent, getBoolean, getBoolValue, getChildNode, getDefaultFieldValue, getDEFparent, getField, getFieldAt, getFieldValue, getFloatArray, getFloatValue, getInterfaceCount, getIntValue, getISfield, getLastField, getMFfield, getNode, getNodeValue, getNumberFields, getParent, isBindable, isDEF, isDEForUSE, isFieldUsedByROUTE, isImplicitFieldId, isSensor, isUSE, removeChildNode, removeField, setError, setField, setField, setField, setField, vrmlClone
 
Methods inherited from class com.trapezium.vrml.fields.Field
cloneFieldValue, fieldValueTraverse, getFieldId, getFieldType, getFieldValue, getFloat, getInterfaceType, getNodeParent, getNodeValue, isInUse, isISfield, markInUse, setFieldId, setFieldType, setFieldType, setFieldValue
 
Methods inherited from class com.trapezium.vrml.MultipleTokenElement
adjust, getLastTokenOffset, getText, isTraversable, setLastTokenOffset
 
Methods inherited from class com.trapezium.vrml.SingleTokenElement
getFirstTokenOffset, getName, setFirstTokenOffset
 
Methods inherited from class com.trapezium.vrml.VrmlElement
addChild, addWarning, contains, containsErrors, deregisterSelf, dump, dump, dumpUserDefined, getBaseName, getChildAt, getError, getLastChild, getParent, getRoot, getScene, getTokenEnumerator, isScene, numberChildren, removeChild, removeVrmlElement, setParent, traverse, twoPassTraverse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protoBase

PROTObase protoBase
Constructor Detail

PROTOInstance

public PROTOInstance(PROTObase pb)
Class constructor

Method Detail

isPROTOnode

public boolean isPROTOnode()
template method, overrides Node.isPROTOnode() which returns false.

Overrides:
isPROTOnode in class Node

getPROTONodeType

public Node getPROTONodeType()
Get the first node in the PROTO declaration, this node defines the type of the PROTO.


getPROTObase

public PROTObase getPROTObase()
Get a reference to the declaration of the PROTO


getFieldDescriptor

public com.trapezium.vrml.grammar.FieldDescriptor getFieldDescriptor(java.lang.String fieldId)
Get the FieldDescriptor, defined by IS usage for a field


getPROTOname

public java.lang.String getPROTOname()
Get the name of the PROTO this instance is based on


getNodeName

public java.lang.String getNodeName()
Get the name of the Node type compatible with this PROTO

Overrides:
getNodeName in class Node

getClosestFieldId

public java.lang.String getClosestFieldId(java.lang.String fieldName)
get the field id with the closest spelling

Overrides:
getClosestFieldId in class Node

getFieldType

public java.lang.String getFieldType(java.lang.String fieldName)
get the VRML97 field type SF or MF for the field.

Overrides:
getFieldType in class Node

getInterfaceDeclaration

public com.trapezium.vrml.fields.Field getInterfaceDeclaration(java.lang.String fieldName)
get the interface declaration of the field


isValidFieldId

public boolean isValidFieldId(java.lang.String fieldName)
Check if field is part of the PROTO interface declaration.

Overrides:
isValidFieldId in class Node

copyBaseNodeInfo

public void copyBaseNodeInfo()
Copy all nodes containing IS references from PROTO declaration body. IS references are resolved as the copy takes place.


verify

public void verify(com.trapezium.parse.TokenEnumerator v)
Validate the nodes contained in a PROTO instance.


getInterfaceType

public int getInterfaceType(java.lang.String fieldId)
Get the interface type of a particular field.

Overrides:
getInterfaceType in class Node

getFieldNames

public java.lang.String[] getFieldNames()
Get a list of field names defined for the PROTO.

Overrides:
getFieldNames in class Node

checkInUse

public void checkInUse()
Check if the instance fields are in use, handles case where the field is not referenced by IS in the PROTO declaration, but the field is DEFed in an instance, and USEd somewhere else. Note, at the time this is called (during parsing, we don't know if the DEF is USEd, so we just assume it is). In this case, the "not referenced" IS warning has to be removed.