|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.grogra.imp3d.Visitor3D
public abstract class Visitor3D
This base implementation of the Visitor
interface
tracks information about the current coordinate transformation
and layer of objects. Invocations of visit
methods
are forwarded to the abstract methods
visitEnterImpl(Object, boolean, Path)
and
visitLeaveImpl(Object, boolean, Path)
.
Field Summary | |
---|---|
protected int |
layer
The current layer. |
protected GraphState |
state
The graph state in which this visitor runs. |
protected Matrix4d |
transformation
The current transformation from local coordinates to global coordinates. |
Fields inherited from interface de.grogra.graph.Visitor |
---|
STOP |
Constructor Summary | |
---|---|
Visitor3D()
|
Method Summary | |
---|---|
Matrix4d |
getCurrentTransformation()
Returns the current affine transformation from local coordinates to global coordinates. |
GraphState |
getGraphState()
Returns the graph state within which the visitor is operating. |
protected void |
init(GraphState gs,
EdgePattern pattern,
Matrix4d t)
Initializes this visitor. |
protected java.lang.Object |
visitEnter(java.lang.Object object,
boolean asNode,
Path path)
|
java.lang.Object |
visitEnter(Path path,
boolean node)
Informs this visitor about a node or edge in the graph. |
protected abstract void |
visitEnterImpl(java.lang.Object object,
boolean asNode,
Path path)
This method has to be implemented by subclasses. |
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. |
protected abstract void |
visitLeaveImpl(java.lang.Object object,
boolean asNode,
Path path)
This method has to be implemented by subclasses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int layer
protected GraphState state
protected Matrix4d transformation
Constructor Detail |
---|
public Visitor3D()
Method Detail |
---|
public Matrix4d getCurrentTransformation()
public GraphState getGraphState()
Visitor
getGraphState
in interface Visitor
protected void init(GraphState gs, EdgePattern pattern, Matrix4d t)
gs
- the graph state in which the visitor runspattern
- the pattern which is used to extract the scene tree to
visit from the complete grapht
- the initial transformation from local to global coordinatesprotected java.lang.Object visitEnter(java.lang.Object object, boolean asNode, Path path)
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
protected abstract void visitEnterImpl(java.lang.Object object, boolean asNode, Path path)
object
is entered.
object
- the object being enteredasNode
- is object
a node or an edge?path
- the path to object
if object
is a node, the path to the node where object
points to
if object
is an edgepublic 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 continuedprotected abstract void visitLeaveImpl(java.lang.Object object, boolean asNode, Path path)
object
is left.
object
- the object being leftasNode
- is object
a node or an edge?path
- the path to object
if object
is a node, the path to the node where object
points to
if object
is an edge
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |