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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.trapezium.vrml.VrmlElement
      extended bycom.trapezium.vrml.SingleTokenElement
          extended bycom.trapezium.vrml.MultipleTokenElement
              extended bycom.trapezium.vrml.Scene
All Implemented Interfaces:
SelectNode, java.io.Serializable, com.trapezium.pattern.VisitorPattern

public class Scene
extends MultipleTokenElement
implements SelectNode

Scene graph component representing an entire VRML file, or the body of a PROTO. The only difference between the PROTO body and a Scene is that the PROTO body is required to have at least one node. This restriction is not part of the Scene, and is a check performed by the grammar package during parsing. The Scene has a single Declaration for each child element. The Scene gives the name scope for PROTO and DEF nodes. As a file is processed, any PROTO and DEF nodes are registered with the Scene. Name uniqueness is forced during this registration by appending "_1", "_2", etc.

Since:
1.0
Version:
1.1, 14 Jan 1998

Field Summary
(package private)  java.util.Hashtable colorTable
           
(package private)  java.util.Hashtable coordTable
           
(package private)  com.trapezium.parse.TokenEnumerator dataSource
          The Scene tokens exist only in relation to a specific TokenEnumerator kept by all Scenes
(package private)  com.trapezium.vrml.grammar.DEFNameFactory defNameFactory
          for the autoDEF feature
 java.util.Hashtable DEFNodes
          DEF/USE nodes scope is limited to file
(package private)  com.trapezium.vorlon.ErrorSummary errorSummary
          ErrorSummary info, possibly null
(package private)  java.util.Hashtable normalTable
           
 java.util.Hashtable PROTONodes
          PROTO node declarations available to Scene, identified by PROTO name
(package private)  com.trapezium.vrml.node.PROTO protoParent
          A Scene has a PROTO parent if it is embedded within a PROTO node
 java.util.Hashtable protoTable
          PROTO nodes by type
 java.util.Hashtable routeTable
          list of all ROUTEs, used to check for duplicates
(package private)  int sceneId
           
(package private)  java.util.Hashtable sourceScenes
          table of source Scenes for node copies
(package private) static int staticSceneId
          Main constructor, all other constructors go through this one
(package private)  java.util.Hashtable texCoordTable
           
(package private)  java.lang.String text
          optional text header used by display
static int untitledCount
          untitled scenes
(package private)  java.lang.String url
          main url
(package private)  java.util.Hashtable usageTable
           
(package private)  java.util.Hashtable verifyList
          List of nodes verified, created if necessary
(package private)  int vrmlElementCount
          Can get count from ComplexityVisitor and set here
 
Fields inherited from class com.trapezium.vrml.MultipleTokenElement
lastTokenOffset
 
Fields inherited from class com.trapezium.vrml.SingleTokenElement
firstTokenOffset
 
Fields inherited from class com.trapezium.vrml.VrmlElement
baseProfile, children, createCount, disableBaseProfile, errorString, noUnusedDEFwarning, nowarning, parent
 
Constructor Summary
Scene()
           
Scene(java.lang.String urlName)
          Construct a scene entirely from a url.
Scene(java.lang.String urlName, com.trapezium.parse.TokenEnumerator te)
           
Scene(java.lang.String urlName, com.trapezium.parse.TokenEnumerator te, com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)
           
 
Method Summary
 com.trapezium.vrml.node.Node addNode(com.trapezium.vrml.node.Node node)
          Add a Node to the scene.
 com.trapezium.vrml.node.Node addNode(java.lang.String sourceNode)
          Add a Node to the Scene.
 ROUTE addROUTE(ROUTE route)
          Add a ROUTE to the scene.
 ROUTE addROUTE(java.lang.String routeString)
          Add a ROUTE from a String
 void addRoute(java.lang.String sourceDEF, java.lang.String sourceField, java.lang.String destDEF, java.lang.String destField)
          add a ROUTE to the list kept by this Scene
 DEFResolver createDEFNames(com.trapezium.vrml.node.Node node)
          Rename conflicting DEFs with new names using DEFNameFactory.
(package private)  void createDEFtable()
          create DEF node hashtable if it doesn't already exist
 boolean DEFexists(java.lang.String id)
          is there a DEF node with a given name
 void deregisterDEF(com.trapezium.vrml.node.DEFUSENode def)
          deregister DEF node in Scene, used before a rename
 java.lang.String getBuiltInNodeName(java.lang.String name)
          Get the built in node name.
 int getClassCount(java.lang.String typeString)
          How many node classes, including PROTOs, exist for a particular actual type
 java.lang.String getClassList(java.lang.String typeString)
          Get a string listing current classes, including protos
 java.lang.String getClosestMatch(java.lang.String protoString, com.trapezium.util.ReturnInteger result)
          Get the name of an existing PROTO that is the closest match with the unknown PROTO name provided.
 java.util.Hashtable getColorTable()
           
 java.util.Hashtable getCoordTable()
           
 com.trapezium.vrml.node.DEFUSENode getDEF(com.trapezium.vrml.node.DEFUSENode use)
          get a def node given a "USE"
 com.trapezium.vrml.node.DEFUSENode getDEF(java.lang.String id)
          lookup a DEF node given an id
 com.trapezium.vrml.grammar.DEFNameFactory getDEFNameFactory()
          Get the DEFNameFactory associated with the Scene
 java.util.Hashtable getDEFtable()
           
 com.trapezium.vorlon.ErrorSummary getErrorSummary()
           
 java.lang.String getFirstNodeType()
          Get the first node type in the Scene.
 java.util.Hashtable getNameMapper(Scene scene)
          Get the name mapper for a particular source Scene.
 java.util.Hashtable getNormalTable()
           
 com.trapezium.vrml.node.PROTObase getPROTO(java.lang.String name)
          get the PROTO declaration associated with a PROTO name.
 com.trapezium.vrml.node.PROTO getPROTOparent()
           
 int getSceneId()
          Each scene assigned an id number as it is created
 java.util.Hashtable getTexCoordTable()
           
 java.lang.String getText()
          Get the text of the element as a String
 com.trapezium.parse.TokenEnumerator getTokenEnumerator()
          Get the data source for this Scene's text
static java.lang.String getUntitle()
           
 java.lang.String getUrl()
          Get the url used to identify the scene
 java.util.Hashtable getUsageTable()
           
 java.util.Hashtable getVerifyList()
           
 int getVrmlElementCount()
           
 boolean hasRoute(java.lang.String sourceDEF, java.lang.String sourceField, java.lang.String destDEF, java.lang.String destField)
          Check if a ROUTE is already known to this Scene
(package private)  void init(java.lang.String urlName, com.trapezium.parse.TokenEnumerator te, com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)
           
 boolean isPROTO(java.lang.String name)
          Is there a PROTO with the given name
 boolean isScene()
          template method, overrides VrmlElement.isScene(), used for finding Scene that contains a particular VrmlElement.
 com.trapezium.vrml.node.PROTOInstance PROTOFactory(java.lang.String PROTOName)
          Create an instance of a particular PROTO
 void registerDEF(com.trapezium.vrml.node.DEFUSENode def)
          register DEF node in Scene.
 void registerDEF(java.lang.String defName)
          just reserve the String of a DEF
 void registerPROTO(com.trapezium.vrml.node.PROTObase proto)
          Register PROTO node in Scene.
(package private)  void resolveDEF(Scene scene, java.lang.String originalName, java.lang.String newName)
          Resolve a DEF name conflict, generate a new name for the DEF.
 boolean selectNode(NodeSelection nodeSelection)
          Select a node, SelectNode interface
 void setDEFNameFactory(com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)
          Set the DEFNameFactory for the Scene
 void setErrorSummary(com.trapezium.vorlon.ErrorSummary errorSummary)
           
 void setPROTOparent(com.trapezium.vrml.node.PROTO rent)
           
 void setText(java.lang.String t)
           
 void setTokenEnumerator(com.trapezium.parse.TokenEnumerator t)
          Set the data source for this Scene's text
 void setVrmlElementCount(int n)
           
 
Methods inherited from class com.trapezium.vrml.MultipleTokenElement
adjust, getLastTokenOffset, 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, fieldValueTraverse, getBaseName, getChildAt, getError, getLastChild, getParent, getRoot, getScene, numberChildren, removeChild, removeVrmlElement, setError, setParent, traverse, twoPassTraverse, vrmlClone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

com.trapezium.parse.TokenEnumerator dataSource
The Scene tokens exist only in relation to a specific TokenEnumerator kept by all Scenes


vrmlElementCount

int vrmlElementCount
Can get count from ComplexityVisitor and set here


errorSummary

com.trapezium.vorlon.ErrorSummary errorSummary
ErrorSummary info, possibly null


verifyList

java.util.Hashtable verifyList
List of nodes verified, created if necessary


protoTable

public java.util.Hashtable protoTable
PROTO nodes by type


PROTONodes

public java.util.Hashtable PROTONodes
PROTO node declarations available to Scene, identified by PROTO name


DEFNodes

public java.util.Hashtable DEFNodes
DEF/USE nodes scope is limited to file


routeTable

public java.util.Hashtable routeTable
list of all ROUTEs, used to check for duplicates


usageTable

java.util.Hashtable usageTable

coordTable

java.util.Hashtable coordTable

texCoordTable

java.util.Hashtable texCoordTable

colorTable

java.util.Hashtable colorTable

normalTable

java.util.Hashtable normalTable

protoParent

com.trapezium.vrml.node.PROTO protoParent
A Scene has a PROTO parent if it is embedded within a PROTO node


defNameFactory

com.trapezium.vrml.grammar.DEFNameFactory defNameFactory
for the autoDEF feature


url

java.lang.String url
main url


staticSceneId

static int staticSceneId
Main constructor, all other constructors go through this one


sceneId

int sceneId

untitledCount

public static int untitledCount
untitled scenes


text

java.lang.String text
optional text header used by display


sourceScenes

java.util.Hashtable sourceScenes
table of source Scenes for node copies

Constructor Detail

Scene

public Scene(java.lang.String urlName)
Construct a scene entirely from a url.


Scene

public Scene()

Scene

public Scene(java.lang.String urlName,
             com.trapezium.parse.TokenEnumerator te)

Scene

public Scene(java.lang.String urlName,
             com.trapezium.parse.TokenEnumerator te,
             com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)
Method Detail

setTokenEnumerator

public void setTokenEnumerator(com.trapezium.parse.TokenEnumerator t)
Set the data source for this Scene's text


getTokenEnumerator

public com.trapezium.parse.TokenEnumerator getTokenEnumerator()
Get the data source for this Scene's text

Overrides:
getTokenEnumerator in class VrmlElement

setVrmlElementCount

public void setVrmlElementCount(int n)

getVrmlElementCount

public int getVrmlElementCount()

getErrorSummary

public com.trapezium.vorlon.ErrorSummary getErrorSummary()

setErrorSummary

public void setErrorSummary(com.trapezium.vorlon.ErrorSummary errorSummary)

getVerifyList

public java.util.Hashtable getVerifyList()

addRoute

public void addRoute(java.lang.String sourceDEF,
                     java.lang.String sourceField,
                     java.lang.String destDEF,
                     java.lang.String destField)
add a ROUTE to the list kept by this Scene


hasRoute

public boolean hasRoute(java.lang.String sourceDEF,
                        java.lang.String sourceField,
                        java.lang.String destDEF,
                        java.lang.String destField)
Check if a ROUTE is already known to this Scene


getUsageTable

public java.util.Hashtable getUsageTable()

getCoordTable

public java.util.Hashtable getCoordTable()

getTexCoordTable

public java.util.Hashtable getTexCoordTable()

getColorTable

public java.util.Hashtable getColorTable()

getNormalTable

public java.util.Hashtable getNormalTable()

getPROTOparent

public com.trapezium.vrml.node.PROTO getPROTOparent()

setPROTOparent

public void setPROTOparent(com.trapezium.vrml.node.PROTO rent)

init

void init(java.lang.String urlName,
          com.trapezium.parse.TokenEnumerator te,
          com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)

getSceneId

public int getSceneId()
Each scene assigned an id number as it is created


getUrl

public java.lang.String getUrl()
Get the url used to identify the scene


getDEFNameFactory

public com.trapezium.vrml.grammar.DEFNameFactory getDEFNameFactory()
Get the DEFNameFactory associated with the Scene


setDEFNameFactory

public void setDEFNameFactory(com.trapezium.vrml.grammar.DEFNameFactory defNameFactory)
Set the DEFNameFactory for the Scene


getUntitle

public static java.lang.String getUntitle()

setText

public void setText(java.lang.String t)

getText

public java.lang.String getText()
Description copied from class: MultipleTokenElement
Get the text of the element as a String

Overrides:
getText in class MultipleTokenElement

getClassCount

public int getClassCount(java.lang.String typeString)
How many node classes, including PROTOs, exist for a particular actual type


getClassList

public java.lang.String getClassList(java.lang.String typeString)
Get a string listing current classes, including protos


createDEFtable

void createDEFtable()
create DEF node hashtable if it doesn't already exist


registerDEF

public void registerDEF(com.trapezium.vrml.node.DEFUSENode def)
register DEF node in Scene. This is done as file is processed so at this point names are changed to enforce uniqueness.


deregisterDEF

public void deregisterDEF(com.trapezium.vrml.node.DEFUSENode def)
deregister DEF node in Scene, used before a rename


registerDEF

public void registerDEF(java.lang.String defName)
just reserve the String of a DEF


getDEF

public com.trapezium.vrml.node.DEFUSENode getDEF(com.trapezium.vrml.node.DEFUSENode use)
get a def node given a "USE"


getDEF

public com.trapezium.vrml.node.DEFUSENode getDEF(java.lang.String id)
lookup a DEF node given an id


DEFexists

public boolean DEFexists(java.lang.String id)
is there a DEF node with a given name


getDEFtable

public java.util.Hashtable getDEFtable()

registerPROTO

public void registerPROTO(com.trapezium.vrml.node.PROTObase proto)
Register PROTO node in Scene.


getBuiltInNodeName

public java.lang.String getBuiltInNodeName(java.lang.String name)
Get the built in node name. First check for the name in the PROTO nodes, and if found, use the proto to determine the built in node name. Otherwise, assume it is a built in node, and use that name.


getPROTO

public com.trapezium.vrml.node.PROTObase getPROTO(java.lang.String name)
get the PROTO declaration associated with a PROTO name. If not found in this scene, and this scene is contained within another scene (i.e. this scene itself is contained in a PROTO), check its parent scene for the PROTO also.


PROTOFactory

public com.trapezium.vrml.node.PROTOInstance PROTOFactory(java.lang.String PROTOName)
Create an instance of a particular PROTO


isPROTO

public boolean isPROTO(java.lang.String name)
Is there a PROTO with the given name


isScene

public boolean isScene()
template method, overrides VrmlElement.isScene(), used for finding Scene that contains a particular VrmlElement.

Overrides:
isScene in class VrmlElement

getFirstNodeType

public java.lang.String getFirstNodeType()
Get the first node type in the Scene. When Scene is contained in a PROTO, this first type is the the actual type for PROTO nodes.


getClosestMatch

public java.lang.String getClosestMatch(java.lang.String protoString,
                                        com.trapezium.util.ReturnInteger result)
Get the name of an existing PROTO that is the closest match with the unknown PROTO name provided.


addROUTE

public ROUTE addROUTE(ROUTE route)
Add a ROUTE to the scene. If the ROUTE has DEFs that conflict with previously existing DEFs in this scene, then the Scene may have re DEFfed those Nodes to eliminate the conflict (if the Scene was constructed with a DEFNameFactory). In this case, the ROUTE DEF names are renamed in exactly the same way. Otherwise, the ROUTE names are preserved, which may result in a parsing error if the DEF names they refer to do not exist.


addROUTE

public ROUTE addROUTE(java.lang.String routeString)
Add a ROUTE from a String


addNode

public com.trapezium.vrml.node.Node addNode(com.trapezium.vrml.node.Node node)
Add a Node to the scene.


addNode

public com.trapezium.vrml.node.Node addNode(java.lang.String sourceNode)
Add a Node to the Scene.


createDEFNames

public DEFResolver createDEFNames(com.trapezium.vrml.node.Node node)
Rename conflicting DEFs with new names using DEFNameFactory.


resolveDEF

void resolveDEF(Scene scene,
                java.lang.String originalName,
                java.lang.String newName)
Resolve a DEF name conflict, generate a new name for the DEF.


getNameMapper

public java.util.Hashtable getNameMapper(Scene scene)
Get the name mapper for a particular source Scene.


selectNode

public boolean selectNode(NodeSelection nodeSelection)
Select a node, SelectNode interface

Specified by:
selectNode in interface SelectNode