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

Quick Search    Search Deep

com.trapezium.vrml
Class VrmlElement  view VrmlElement download VrmlElement.java

java.lang.Object
  extended bycom.trapezium.vrml.VrmlElement
All Implemented Interfaces:
java.io.Serializable, com.trapezium.pattern.VisitorPattern
Direct Known Subclasses:
SingleTokenElement

public abstract class VrmlElement
extends java.lang.Object
implements com.trapezium.pattern.VisitorPattern, java.io.Serializable

A VrmlElement is the base class for any object in the VRML 2.0 object hierarchy. Specific subclasses get created as a ".wrl" file is parsed. The grammar determines which type of element to create during parsing. Each VrmlElement contains zero or more children, which are also VrmlElement. The object hierarchy for this is very simple. The root level object is a Scene, with children that are Nodes or ROUTEs. Node children are fields. This object hierarchy parallels the VRML syntax. The VrmlElement implements the visitor pattern, which allows the object structure to be traversed after it is created. See LintVisitor for how parsing errors get displayed.

Since:
1.0
Version:
1.21, field bug fix, self reference PROTO USE 1.12, 29 May 1998, base profile nonconformance category 1.12, 7 May 1998, make Serializable 1.12, 29 March 1998, added "adjust" method, 1.1, 14 Jan 1998

Field Summary
static boolean baseProfile
          Option, only record nonconformance messages
(package private)  java.lang.Object children
          children are seen only through the Visitor pattern
static int createCount
          Used to track number of VrmlElements created during parsing, not thread safe
static boolean disableBaseProfile
          Option, disable nonconformance messages
 java.lang.String errorString
          any error creating a specific element is noted here, see setError, getError
static boolean noUnusedDEFwarning
          Option, disable unused DEF warnings
static boolean nowarning
          Option, disable warnings entirely
(package private)  VrmlElement parent
          parent, necessary for scoping searches
 
Constructor Summary
VrmlElement()
          default constructor
 
Method Summary
 void addChild(java.lang.Object child)
          Add a child VrmlElement
 void addWarning(int tokenOffset, java.lang.String warning)
          Add a warning Value child.
abstract  void adjust(int boundary, int amount)
          Adjust token values
 boolean contains(java.lang.Object child)
          Check if a specific child exists.
 boolean containsErrors()
          Does this element or any of its children have any errors
 void deregisterSelf()
          does nothing unless DEFUSENode
 void dump(java.lang.String header)
          debugging dump method
 void dump(java.lang.String header, boolean tokensToo)
          and another debugging dump method
 void dumpUserDefined(java.lang.String header)
          another debugging dump method
 void fieldValueTraverse(com.trapezium.pattern.Visitor v)
          template method, Field objects override this to traverse their field value.
 java.lang.String getBaseName()
          get the class name without package
 VrmlElement getChildAt(int offset)
          Get the specific child.
 java.lang.String getError()
          get the error string
abstract  int getFirstTokenOffset()
          Get first token
 VrmlElement getLastChild()
          Get the last child of this VrmlElement
abstract  int getLastTokenOffset()
          Get last token
 VrmlElement getParent()
          get this element's parent
 VrmlElement getRoot()
          Get the root of the scene graph
 VrmlElement getScene()
          Get the root scene containing this element.
 com.trapezium.parse.TokenEnumerator getTokenEnumerator()
          Get the TokenEnumerator for this element
 boolean isScene()
          template method, Scene overrides this to return true
abstract  boolean isTraversable()
          is this VrmlElement traversable
 int numberChildren()
          Get the number of children
private  void readObject(java.io.ObjectInputStream oos)
          Read in serialized object, mark progress if GlobalProgressIndicator is set up.
 void removeChild(java.lang.Object child)
          Remove a child.
 void removeVrmlElement(VrmlElement f)
          Remove a child, and update the text as well.
 void setError(java.lang.String s)
          set the error string
abstract  void setFirstTokenOffset(int tokenOffset)
           
abstract  void setLastTokenOffset(int tokenOffset)
          Set last token
 void setParent(VrmlElement p)
          set a child's parent
 void traverse(com.trapezium.pattern.Visitor v)
          Visitor pattern, traverse structure with a particular visitor
 void twoPassTraverse(com.trapezium.pattern.Visitor v)
          Visitor pattern, traverse structure with a particular visitor
 VrmlElement vrmlClone(VrmlElement protoInstance)
           
private  void writeObject(java.io.ObjectOutputStream oos)
          Write out the object for serialization, mark progress if GlobalProgressIndicator is set up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nowarning

public static boolean nowarning
Option, disable warnings entirely


noUnusedDEFwarning

public static boolean noUnusedDEFwarning
Option, disable unused DEF warnings


baseProfile

public static boolean baseProfile
Option, only record nonconformance messages


disableBaseProfile

public static boolean disableBaseProfile
Option, disable nonconformance messages


createCount

public static int createCount
Used to track number of VrmlElements created during parsing, not thread safe


errorString

public transient java.lang.String errorString
any error creating a specific element is noted here, see setError, getError


parent

VrmlElement parent
parent, necessary for scoping searches


children

java.lang.Object children
children are seen only through the Visitor pattern

Constructor Detail

VrmlElement

public VrmlElement()
default constructor

Method Detail

writeObject

private void writeObject(java.io.ObjectOutputStream oos)
                  throws java.io.IOException
Write out the object for serialization, mark progress if GlobalProgressIndicator is set up.


readObject

private void readObject(java.io.ObjectInputStream oos)
                 throws java.io.IOException
Read in serialized object, mark progress if GlobalProgressIndicator is set up.


getBaseName

public java.lang.String getBaseName()
get the class name without package


setFirstTokenOffset

public abstract void setFirstTokenOffset(int tokenOffset)

getFirstTokenOffset

public abstract int getFirstTokenOffset()
Get first token


setLastTokenOffset

public abstract void setLastTokenOffset(int tokenOffset)
                                 throws FunctionCallException
Set last token


getLastTokenOffset

public abstract int getLastTokenOffset()
Get last token


adjust

public abstract void adjust(int boundary,
                            int amount)
Adjust token values


vrmlClone

public VrmlElement vrmlClone(VrmlElement protoInstance)

addChild

public void addChild(java.lang.Object child)
Add a child VrmlElement


removeChild

public void removeChild(java.lang.Object child)
                 throws VrmlElementNotFoundException
Remove a child.


contains

public boolean contains(java.lang.Object child)
Check if a specific child exists.


deregisterSelf

public void deregisterSelf()
does nothing unless DEFUSENode


removeVrmlElement

public void removeVrmlElement(VrmlElement f)
                       throws VrmlElementNotFoundException
Remove a child, and update the text as well.


getChildAt

public VrmlElement getChildAt(int offset)
Get the specific child.


getLastChild

public VrmlElement getLastChild()
Get the last child of this VrmlElement


numberChildren

public int numberChildren()
Get the number of children


setParent

public void setParent(VrmlElement p)
set a child's parent


getParent

public VrmlElement getParent()
get this element's parent


setError

public void setError(java.lang.String s)
set the error string


getError

public java.lang.String getError()
get the error string


isTraversable

public abstract boolean isTraversable()
is this VrmlElement traversable


fieldValueTraverse

public void fieldValueTraverse(com.trapezium.pattern.Visitor v)
template method, Field objects override this to traverse their field value.


twoPassTraverse

public void twoPassTraverse(com.trapezium.pattern.Visitor v)
Visitor pattern, traverse structure with a particular visitor


traverse

public void traverse(com.trapezium.pattern.Visitor v)
Visitor pattern, traverse structure with a particular visitor

Specified by:
traverse in interface com.trapezium.pattern.VisitorPattern

getRoot

public VrmlElement getRoot()
Get the root of the scene graph


getScene

public VrmlElement getScene()
Get the root scene containing this element. This is necessary in some cases because the Scene contains the name space for DEFs and PROTOs. This is done within VrmlElement, because we need this name space for a particular element. The "isScene" method is a simple template method, returns false for all VrmlElement instances except for Scene.


containsErrors

public boolean containsErrors()
Does this element or any of its children have any errors


isScene

public boolean isScene()
template method, Scene overrides this to return true


getTokenEnumerator

public com.trapezium.parse.TokenEnumerator getTokenEnumerator()
Get the TokenEnumerator for this element


addWarning

public void addWarning(int tokenOffset,
                       java.lang.String warning)
Add a warning Value child. This exists for those cases where there is no VrmlElement for the tokenOffset associated with the warning. NOTE: this may be restricted (i.e. not called) by the ErrorSummary object contained in the Scene. The ErrorSummary restriction prevents OutOfMemory conditions when there are too many warnings in a file.


dump

public void dump(java.lang.String header)
debugging dump method


dumpUserDefined

public void dumpUserDefined(java.lang.String header)
another debugging dump method


dump

public void dump(java.lang.String header,
                 boolean tokensToo)
and another debugging dump method