|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.imp3d.objects.SceneTree
public abstract class SceneTree
A SceneTree
is a simplified image of a
Graph
designed for usage in the context
of 3D analysis (e.g., export). The nodes of such a tree are created
by invocation of createTree(boolean)
, this in turn uses the factory
methods createInnerNode()
and createLeaf(Object, boolean, long)
.
Nested Class Summary | |
---|---|
static class |
SceneTree.InnerNode
This class represents an inner node of a scene tree. |
static class |
SceneTree.Leaf
This represents a leaf in a SceneTree . |
static class |
SceneTree.Node
The abstract base class for nodes of a SceneTree . |
static interface |
SceneTree.Visitor
A Visitor is used to visit a SceneTree . |
Field Summary | |
---|---|
protected GraphState |
state
|
Fields inherited from interface de.grogra.graph.Visitor |
---|
STOP |
Constructor Summary | |
---|---|
SceneTree(GraphState gs,
EdgePattern pattern)
Creates a new scene tree instance. |
|
SceneTree(View3D view)
Creates a new scene tree instance. |
Method Summary | |
---|---|
void |
accept(SceneTree.Visitor visitor)
This method is invoked if one wants to inform the visitor
of the complete set of nodes of this tree. |
protected abstract boolean |
acceptLeaf(java.lang.Object object,
boolean asNode)
This method defines for which objects of the graph a SceneTree.Leaf node shall be created. |
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
|
protected SceneTree.InnerNode |
createInnerNode()
This factory method is used by createTree(boolean) to create
an inner node. |
protected abstract SceneTree.Leaf |
createLeaf(java.lang.Object object,
boolean asNode,
long id)
This factory method is used by createTree(boolean) to create a leaf. |
SceneTree.Node |
createTree(boolean simplify)
|
SceneTree.Node |
createTree(boolean simplify,
boolean checkLayer)
This method creates the nodes of this tree by traversing the original graph using the edge pattern which has been specified in the constructor. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
|
int |
getChildCount(java.lang.Object parent)
|
GraphState |
getGraphState()
Returns the graph state within which the visitor is operating. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
java.lang.Object |
getRoot()
|
protected void |
init(SceneTree.Leaf leaf)
This method has to be invoked whenever a new SceneTree.Leaf is created
as a leaf of this tree. |
boolean |
isLeaf(java.lang.Object node)
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
|
java.lang.Object |
visitEnter(Path path,
boolean node)
Informs this visitor about a node or edge in the graph. |
java.lang.Object |
visitInstanceEnter()
Informs this visitor about the beginning of an instantiation. |
boolean |
visitInstanceLeave(java.lang.Object o)
Informs this visitor that an instantiation has been processed completely. |
boolean |
visitLeave(java.lang.Object o,
Path path,
boolean node)
Informs this visitor that a node or an edge has been processed completely. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GraphState state
Constructor Detail |
---|
public SceneTree(GraphState gs, EdgePattern pattern)
createTree(boolean)
.
gs
- the graph state to use for attribute queriespattern
- the pattern which defines which edges span
the tree as subgraph of the complete graphpublic SceneTree(View3D view)
SceneTree(GraphState, EdgePattern)
, where the parameters
are obtained from the view
.
view
- view for which the new scene tree is configuredMethod Detail |
---|
public void accept(SceneTree.Visitor visitor)
visitor
of the complete set of nodes of this tree.
visitor
- a visitor to visit the nodes of this treeprotected abstract boolean acceptLeaf(java.lang.Object object, boolean asNode)
SceneTree.Leaf
node shall be created.
object
- an object of the graphasNode
- is object a node or an edge?
true
iff a leaf shall be created for the objectpublic void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
protected SceneTree.InnerNode createInnerNode()
createTree(boolean)
to create
an inner node.
protected abstract SceneTree.Leaf createLeaf(java.lang.Object object, boolean asNode, long id)
createTree(boolean)
to create a leaf.
Note that the implementation has to invoke init(Leaf)
on the
created leaf.
object
- object of leafasNode
- represents leaf a node or an edge?id
- id to pass to the leaf constructor
public SceneTree.Node createTree(boolean simplify)
public SceneTree.Node createTree(boolean simplify, boolean checkLayer)
acceptLeaf(Object, boolean)
returns true
.
The leaves are inserted into a hierarchy of
SceneTree.InnerNode
s corresponding to the hierarchy of the original
graph.
simplify
- simplify structure (may destroy hierarchy)?
createInnerNode()
,
createLeaf(Object, boolean, long)
public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
public GraphState getGraphState()
Visitor
getGraphState
in interface Visitor
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
protected void init(SceneTree.Leaf leaf)
SceneTree.Leaf
is created
as a leaf of this tree. The tree may perform some initialization tasks
on the leaf
.
leaf
- a newly created Leaf
to be initializedpublic boolean isLeaf(java.lang.Object node)
isLeaf
in interface javax.swing.tree.TreeModel
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface javax.swing.tree.TreeModel
public java.lang.Object visitEnter(Path path, boolean node)
Visitor
path
contains the path from the root up to and including
the node or, in case an edge is visited, the edge and its terminal node. Later on,
Visitor.visitLeave(java.lang.Object, de.grogra.graph.Path, boolean)
will be invoked with
the returned value of this invocation, path
and node
as arguments. If this method returns
Visitor.STOP
, the corresponding visitLeave
-method
will be invoked immediately after this method, i.e., the visitor
does not dive more deeply in the hierarchy. Otherwise, if a
node is visited and there
are instantiations associated with or edges connected with
it (regardless of their direction), their corresponding visitor methods will be invoked
inbetween. Likewise, if an edge is visited, its indicent terminal node
will be visited next.
visitEnter
in interface Visitor
path
- current pathnode
- do we enter a node or an edge?
visitLeave
, may be Visitor.STOP
public java.lang.Object visitInstanceEnter()
Visitor
visitEnter
/visitLeave
of a node. Later on,
Visitor.visitInstanceLeave(Object)
will be invoked with
the returned value of this invocation as argument. If this method returns
Visitor.STOP
, the visitInstanceLeave
-method
will be invoked immediately after this method, i.e., the visitor
does not dive into the instantiation. Otherwise, the instantiation
is performed, starting with an edge.
visitInstanceEnter
in interface Visitor
visitInstanceLeave
, may be Visitor.STOP
public boolean visitInstanceLeave(java.lang.Object o)
Visitor
o
is the return value
of the corresponding invocation of Visitor.visitInstanceEnter()
.
If this invocation returns false
, no further
instantiations or edges of the current level of hierarchy will
be passed to this
visitor, i.e., the visitLeave
method for the enclosing
node will be invoked immediately.
visitInstanceLeave
in interface Visitor
o
- returned value of visitInstanceEnter
true
iff processing of current level shall be continuedpublic boolean visitLeave(java.lang.Object o, Path path, boolean node)
Visitor
o
is the return value
of the corresponding invocation of Visitor.visitEnter(de.grogra.graph.Path, boolean)
.
In case of a node and if this invocation returns false
, no further
edges of the current level of hierarchy will be passed to this
visitor, i.e., the visitLeave
methods for the enclosing
edge and node will be invoked immediately.
Likewise, in case of an edge and a return value false
, no further
instantiations or edges of the current level of hierarchy
will be passed to this
visitor, i.e., the visitLeave
method for the enclosing
node will be invoked immediately.
visitLeave
in interface Visitor
o
- returned value of visitEnter
path
- current path to node
node
- do we leave a node or an edge?
true
iff processing of current level shall be continued
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |