1 package com.jme3.scene;
2 
3 /**
4  * <code>SceneGraphVisitorAdapter</code> is used to traverse the scene
5  * graph tree. The adapter version of the interface simply separates
6  * between the {@link Geometry geometries} and the {@link Node nodes} by
7  * supplying visit methods that take them.
8  * Use by calling {@link Spatial#depthFirstTraversal(com.jme3.scene.SceneGraphVisitor) }
9  * or {@link Spatial#breadthFirstTraversal(com.jme3.scene.SceneGraphVisitor)}.
10  */
11 public class SceneGraphVisitorAdapter implements SceneGraphVisitor {
12 
13     /**
14      * Called when a {@link Geometry} is visited.
15      *
16      * @param geom The visited geometry
17      */
visit(Geometry geom)18     public void visit(Geometry geom) {}
19 
20     /**
21      * Called when a {@link visit} is visited.
22      *
23      * @param geom The visited node
24      */
visit(Node geom)25     public void visit(Node geom) {}
26 
27     @Override
visit(Spatial spatial)28     public final void visit(Spatial spatial) {
29         if (spatial instanceof Geometry) {
30             visit((Geometry)spatial);
31         } else {
32             visit((Node)spatial);
33         }
34     }
35 }
36