public class SymbolTable extends java.lang.Object implements SceneGraphObjectReferenceControl
| Modifier and Type | Field and Description |
|---|---|
private java.util.ArrayList |
branchGraphDependencies |
private java.util.ArrayList |
branchGraphs |
private Controller |
control |
private int |
currentBranchGraphID |
private java.util.HashMap |
danglingReferences |
private java.util.HashMap |
j3dNodeIndex |
private java.util.HashMap |
namedObjects |
private int |
nextBranchGraphID |
private int |
nodeID |
private java.util.ArrayList |
nodeIDIndex |
private java.util.LinkedList |
sharedNodes |
private java.util.Stack |
unsavedNodeComponentsStack |
| Constructor and Description |
|---|
SymbolTable(Controller control)
Creates new SymbolTable
|
| Modifier and Type | Method and Description |
|---|---|
int |
addBranchGraphReference(SceneGraphObject node,
int branchGraphID)
Add a refernce to the BranchGraph root
Also returns the nodes id
Used to associate graphs with a locale without storing the graph at the
current time.
|
private void |
addInterGraphDependency(SymbolTableData symbol)
Add a dependency to the current branchgraph on
symbol
Only nodes (not nodeComponents) affect intergraph dependencies |
void |
addNamedObject(java.lang.String name,
SceneGraphObject object)
Associate the name with the scene graph object
|
void |
addNamedObjects(java.util.HashMap map)
Add all the named objects in
map |
int |
addReference(SceneGraphObject node)
Add a refernce to the specified node
Also returns the nodes id
|
int |
addReference(SymbolTableData symbol)
Add a refernce to the specified node
Also returns the nodes id
|
boolean |
branchGraphHasDependencies(int graphID)
Return true if the graph is dependent on nodes in
other graphs
Only Nodes (not node components) cause dependencies
|
private void |
checkforDanglingReferences()
At this stage their should be no dangling references
|
void |
clear()
Clear all elements from the symbol table
|
void |
clearUnshared()
Clear all the Symbols that are not shared with other Graphs in the file
Remove all Symbols from all structures with referenceCounts=1
|
private void |
confirmInterGraphDependency()
Check for and remove any inter graph dependency
labels that have been resolved to the current graph
|
private SymbolTableData |
createDanglingSymbol(SceneGraphObject node)
Create or return the SymbolTableData for a node which does not
necessary have a State object yet
|
private SymbolTableData |
createNodeComponentSymbol(SceneGraphObject node) |
SymbolTableData |
createSymbol(SceneGraphObject node)
Create a new symbol and provide a new nodeID
This is used during the save process
|
SymbolTableData |
createSymbol(SceneGraphObjectState state,
SceneGraphObject node,
int nodeID)
Create a new symbol using the specified nodeID
This is used during the load process.
|
void |
endUnsavedNodeComponentFrame() |
int |
getBranchGraphCount() |
int[] |
getBranchGraphDependencies(int graphID)
Return an array of each BranchGraph on which graphID is dependent for
closure of the graph
Only Nodes (not node components) cause dependencies
If there are no dependencies int[0] is returned
|
long |
getBranchGraphFilePosition(int graphID) |
SymbolTableData |
getBranchGraphRoot(int graphID) |
SceneGraphObject |
getJ3dNode(int nodeID)
Return the Java3D node associated with the nodeID.
|
SceneGraphObject |
getNamedObject(java.lang.String name)
Return the SceneGraphObject associated with the name
|
void |
getNamedObjectMap(java.util.HashMap map)
Add the namedObject mappings to
map |
java.lang.String[] |
getNames()
Get all the names of the named objects
|
SymbolTableData |
getSharedGroup(int nodeID)
Get the symbol for the shared group
If the sharedgroup has not been loaded then load it before
returning (if we are using RandomAccessFileControl
|
SymbolTableData |
getSymbol(int nodeID)
Return the node with the give ID
|
SymbolTableData |
getSymbol(SceneGraphObject node)
Get the table entry for node
|
java.util.ListIterator |
getUnsavedNodeComponents() |
int |
getUnsavedNodeComponentsSize() |
void |
incNodeComponentRefCount(int nodeID)
Update the reference count for the node component.
|
boolean |
isLoaded(int nodeID)
Return true if this node has already been loaded
|
private void |
nodeIDIndexEnsureCapacity(int size) |
void |
readTable(java.io.DataInput in,
boolean streamRead)
Read and store the entire symbol table
|
private void |
removeNullDependencies(java.util.HashSet set)
Remove dependencies on objects which are not attached to a
branchgraph
|
SceneGraphObject |
resolveReference(int nodeID)
Given a nodeID return the corresponding scene graph object.
|
void |
setBranchGraphID(SymbolTableData symbol)
Set the branchGraphID in the symbol to the current branch graph ID
|
void |
setBranchGraphRoot(SymbolTableData symbol,
long filePointer)
Mark the node referenced by this Symbol as a branch graph root
The filePointer is the position of the BranchGraph in the file, this
is not the same as the BranchGroups position due to the extra data stored
for a graph.
|
void |
setFilePosition(long ptr,
SceneGraphObjectState state)
Set the position of the object referenced by state
|
void |
startUnsavedNodeComponentFrame() |
java.lang.String |
toString() |
void |
writeTable(java.io.DataOutput out) |
private int nodeID
private java.util.HashMap j3dNodeIndex
private java.util.ArrayList nodeIDIndex
private java.util.HashMap danglingReferences
private java.util.Stack unsavedNodeComponentsStack
private java.util.LinkedList sharedNodes
private java.util.HashMap namedObjects
private java.util.ArrayList branchGraphs
private java.util.ArrayList branchGraphDependencies
private Controller control
private int currentBranchGraphID
private int nextBranchGraphID
public SymbolTable(Controller control)
private void checkforDanglingReferences()
private void removeNullDependencies(java.util.HashSet set)
public void writeTable(java.io.DataOutput out)
throws java.io.IOException
java.io.IOExceptionpublic void readTable(java.io.DataInput in,
boolean streamRead)
throws java.io.IOException
streamRead - - true if reading from a Stream in which case only the
branchGraphs and named objects are read.java.io.IOExceptionpublic void setBranchGraphRoot(SymbolTableData symbol, long filePointer)
public SymbolTableData getBranchGraphRoot(int graphID)
public void setBranchGraphID(SymbolTableData symbol)
public int[] getBranchGraphDependencies(int graphID)
public boolean branchGraphHasDependencies(int graphID)
public int getBranchGraphCount()
public long getBranchGraphFilePosition(int graphID)
public SymbolTableData createSymbol(SceneGraphObject node)
public SymbolTableData createSymbol(SceneGraphObjectState state, SceneGraphObject node, int nodeID)
private void nodeIDIndexEnsureCapacity(int size)
private SymbolTableData createDanglingSymbol(SceneGraphObject node)
private SymbolTableData createNodeComponentSymbol(SceneGraphObject node)
public int getUnsavedNodeComponentsSize()
public java.util.ListIterator getUnsavedNodeComponents()
public void startUnsavedNodeComponentFrame()
public void endUnsavedNodeComponentFrame()
private void confirmInterGraphDependency()
private void addInterGraphDependency(SymbolTableData symbol)
symbol
Only nodes (not nodeComponents) affect intergraph dependenciespublic void incNodeComponentRefCount(int nodeID)
public int addReference(SceneGraphObject node)
addReference in interface SceneGraphObjectReferenceControlpublic int addReference(SymbolTableData symbol)
public int addBranchGraphReference(SceneGraphObject node, int branchGraphID)
public boolean isLoaded(int nodeID)
public SceneGraphObject getJ3dNode(int nodeID)
public SymbolTableData getSymbol(SceneGraphObject node)
public SymbolTableData getSymbol(int nodeID)
public SymbolTableData getSharedGroup(int nodeID)
public void setFilePosition(long ptr,
SceneGraphObjectState state)
public void addNamedObject(java.lang.String name,
SceneGraphObject object)
public void addNamedObjects(java.util.HashMap map)
mappublic SceneGraphObject getNamedObject(java.lang.String name) throws NamedObjectException, ObjectNotLoadedException
public java.lang.String[] getNames()
public void getNamedObjectMap(java.util.HashMap map)
mappublic java.lang.String toString()
toString in class java.lang.Objectpublic void clear()
public void clearUnshared()
public SceneGraphObject resolveReference(int nodeID)
resolveReference in interface SceneGraphObjectReferenceControlCopyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.