/** * checks for cycles in the scene graph */ void checkForCycle() { if (visited) { throw new SceneGraphCycleException(J3dI18N.getString("Node15")); } visited = true; Node parent = getParent(); if (parent != null) { parent.checkForCycle(); } visited = false; }
/** * Returns the bounding object of a node. * @return the node's bounding object * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @exception SceneGraphCycleException if there is a cycle in the * scene graph */ public Bounds getBounds() { if (isLiveOrCompiled()) { if(!this.getCapability(ALLOW_BOUNDS_READ)) { throw new CapabilityNotSetException(J3dI18N.getString("Node2")); } } else { // this will throw a SceneGraphCycleException if there is // a cycle checkForCycle(); } return ((NodeRetained)this.retained).getBounds(); }