diff --git a/core/src/build/conf/checkstyle.xml b/core/src/build/conf/checkstyle.xml index 1c1489b..a08dbad 100644 --- a/core/src/build/conf/checkstyle.xml +++ b/core/src/build/conf/checkstyle.xml @@ -45,9 +45,15 @@ - - - + + + + + + + + + diff --git a/core/src/main/java/edu/umd/cs/piccolo/PCamera.java b/core/src/main/java/edu/umd/cs/piccolo/PCamera.java index b8ac0df..af1def3 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PCamera.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PCamera.java @@ -443,7 +443,7 @@ public void fullPaint(final PPaintContext paintContext) { paintContext.pushCamera(this); super.fullPaint(paintContext); - paintContext.popCamera(this); + paintContext.popCamera(); } /** diff --git a/core/src/main/java/edu/umd/cs/piccolo/PNode.java b/core/src/main/java/edu/umd/cs/piccolo/PNode.java index 287d6c5..858fc50 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PNode.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PNode.java @@ -3642,5 +3642,5 @@ * @param node node needing repaint */ void nodeFullBoundsInvalidated(PNode node); - } + } } diff --git a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java index 66421bf..388f547 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java +++ b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java @@ -89,7 +89,7 @@ * Changes the cursor to the one provided and stores it on the cursor stack * for later retrieval. * - * @param cursor + * @param cursor cursor to push on cursor stack */ public void pushCursor(final Cursor cursor) { final PComponent component = getTopCamera().getComponent(); @@ -131,6 +131,8 @@ /** * Return the topmost camera this is painting. This is the camera associated * with the PCanvas that requested the current repaint. + * + * @return topmost camera on the pick path */ public PCamera getTopCamera() { return getPath().getTopCamera(); @@ -139,6 +141,8 @@ /** * Get the canvas associated with the top camera. This is the canvas where * the originating swing event came from. + * + * @return component attached to the top camera of the current pick path */ public PComponent getComponent() { return getTopCamera().getComponent(); @@ -148,6 +152,8 @@ * Return the input manager that dispatched this event. You can use this * input manager to find the current mouse focus, mouse over, and key focus * nodes. You can also set a new key focus node. + * + * @return input manager that dispatched this event */ public PInputManager getInputManager() { return inputManager; @@ -155,11 +161,18 @@ /** * Return the PPickPath associated with this input event. + * + * @return pick path associated with this event (may be null) */ public PPickPath getPath() { return pickPath; } + /** + * Sets the PIckPath associated with this mouse event. + * + * @param path path to associate with this mouse event + */ public void setPath(final PPickPath path) { pickPath = path; } @@ -167,6 +180,8 @@ /** * Return the bottom node on the current pickpath, that is the picked node * furthest from the root node. + * + * @return the currently picked node of this mouse event */ public PNode getPickedNode() { return pickPath.getPickedNode(); @@ -176,6 +191,11 @@ // Basics // **************************************************************** + /** + * Returns the key code associated with a key event. + * + * @return key code associated with a key event + */ public int getKeyCode() { if (isKeyEvent()) { final KeyEvent e = (KeyEvent) inputEvent; @@ -184,6 +204,11 @@ throw new IllegalStateException("Can't get keycode from mouse event"); } + /** + * Returns the character associated with a key event. + * + * @return char associated with a key event + */ public char getKeyChar() { if (isKeyEvent()) { final KeyEvent e = (KeyEvent) inputEvent; @@ -192,6 +217,12 @@ throw new IllegalStateException("Can't get keychar from mouse event"); } + /** + * Returns the location on the keyboard from which the key stroke + * originated. + * + * @return location on keyboard from which stroke originated. + */ public int getKeyLocation() { if (isKeyEvent()) { final KeyEvent e = (KeyEvent) inputEvent; @@ -200,6 +231,11 @@ throw new IllegalStateException("Can't get keylocation from mouse event"); } + /** + * Returns whether the key event involves the action key. + * + * @return true if key involved is the action key + */ public boolean isActionKey() { if (isKeyEvent()) { final KeyEvent e = (KeyEvent) inputEvent; @@ -208,6 +244,11 @@ throw new IllegalStateException("Can't get isActionKey from mouse event"); } + /** + * Returns the modifiers provided for the input event by swing. + * + * @return modifier flags for the input event + */ public int getModifiers() { if (!isFocusEvent()) { return inputEvent.getModifiers(); @@ -215,6 +256,11 @@ throw new IllegalStateException("Can't get modifiers from focus event"); } + /** + * Returns the extended modifiers provided for the input event by swing. + * + * @return extended modifies of input event + */ public int getModifiersEx() { if (!isFocusEvent()) { return inputEvent.getModifiersEx(); @@ -222,6 +268,11 @@ throw new IllegalStateException("Can't get modifiers ex from focus event"); } + /** + * Returns the click count of the mouse event. + * + * @return click count of mouse event + */ public int getClickCount() { if (isMouseEvent()) { return ((MouseEvent) inputEvent).getClickCount(); @@ -229,6 +280,11 @@ throw new IllegalStateException("Can't get clickcount from key event"); } + /** + * Returns the time at which the event was emitted. + * + * @return time at which the vent was emitted + */ public long getWhen() { if (!isFocusEvent()) { return inputEvent.getWhen(); @@ -236,6 +292,11 @@ throw new IllegalStateException("Can't get when from focus event"); } + /** + * Returns whether the alt key is currently down. + * + * @return true if alt key is down + */ public boolean isAltDown() { if (!isFocusEvent()) { return inputEvent.isAltDown(); @@ -243,6 +304,11 @@ throw new IllegalStateException("Can't get altdown from focus event"); } + /** + * Returns whether the control key is currently down. + * + * @return true if control key is down + */ public boolean isControlDown() { if (!isFocusEvent()) { return inputEvent.isControlDown(); @@ -250,6 +316,11 @@ throw new IllegalStateException("Can't get controldown from focus event"); } + /** + * Returns whether the meta key is currently down. + * + * @return true if meta key is down + */ public boolean isMetaDown() { if (!isFocusEvent()) { return inputEvent.isMetaDown(); @@ -257,6 +328,11 @@ throw new IllegalStateException("Can't get modifiers from focus event"); } + /** + * Returns whether the shift key is currently down. + * + * @return true if shift key is down + */ public boolean isShiftDown() { if (!isFocusEvent()) { return inputEvent.isShiftDown(); @@ -264,6 +340,11 @@ throw new IllegalStateException("Can't get shiftdown from focus event"); } + /** + * Returns whether the mouse event involves the left mouse button. + * + * @return true if left mouse button is involved the mouse event + */ public boolean isLeftMouseButton() { if (isMouseEvent()) { return SwingUtilities.isLeftMouseButton((MouseEvent) getSourceSwingEvent()); @@ -271,6 +352,11 @@ throw new IllegalStateException("Can't get isLeftMouseButton from focus event"); } + /** + * Returns whether the mouse event involves the middle mouse button. + * + * @return true if middle mouse button is involved the mouse event + */ public boolean isMiddleMouseButton() { if (isMouseEvent()) { return SwingUtilities.isMiddleMouseButton((MouseEvent) getSourceSwingEvent()); @@ -278,6 +364,11 @@ throw new IllegalStateException("Can't get isMiddleMouseButton from focus event"); } + /** + * Returns whether the mouse event involves the right mouse button. + * + * @return true if right mouse button is involved the mouse event + */ public boolean isRightMouseButton() { if (isMouseEvent()) { return SwingUtilities.isRightMouseButton((MouseEvent) getSourceSwingEvent()); @@ -289,6 +380,8 @@ * Return true if another event handler has already handled this event. * Event handlers should use this as a hint before handling the event * themselves and possibly reject events that have already been handled. + * + * @return true if event has been marked as handled */ public boolean isHandled() { return handled; @@ -300,11 +393,18 @@ * dispatched to event handlers even after it is marked as handled, but * other event handlers that might conflict are expected to ignore events * that have already been handled. + * + * @param handled whether the event is marked */ public void setHandled(final boolean handled) { this.handled = handled; } + /** + * Returns the mouse button value of the underlying mouse event. + * + * @return button value of underlying mouse event + */ public int getButton() { if (isMouseEvent()) { return ((MouseEvent) inputEvent).getButton(); @@ -312,6 +412,12 @@ throw new IllegalStateException("Can't get button from key event"); } + /** + * Returns the current value of the wheel rotation on Mouse Wheel Rotation + * events. + * + * @return wheel rotation value + */ public int getWheelRotation() { if (isMouseWheelEvent()) { return ((MouseWheelEvent) inputEvent).getWheelRotation(); @@ -319,6 +425,11 @@ throw new IllegalStateException("Can't get wheel rotation from non-wheel event"); } + /** + * Returns the underlying swing event that this PInputEvent is wrapping. + * + * @return underlying swing event + */ public InputEvent getSourceSwingEvent() { return inputEvent; } @@ -328,22 +439,48 @@ // events. // **************************************************************** + /** + * Returns whether the underlying event is a KeyEvent. + * + * @return true if is key event + */ public boolean isKeyEvent() { return inputEvent instanceof KeyEvent; } + /** + * Returns whether the underlying event is a MouseEvent. + * + * @return true if is mouse event + */ public boolean isMouseEvent() { return inputEvent instanceof MouseEvent; } + /** + * Returns whether the underlying event is a Mouse Wheel Event. + * + * @return true if is a mouse wheel event + */ + public boolean isMouseWheelEvent() { return inputEvent instanceof MouseWheelEvent; } + /** + * Returns whether the underlying event is a Focus Event. + * + * @return true if is focus event + */ public boolean isFocusEvent() { return inputEvent == null; } + /** + * Returns whether the underlying event is a mouse entered or exited event. + * + * @return true if is a mouse entered or exited event + */ public boolean isMouseEnteredOrMouseExited() { if (isMouseEvent()) { return inputEvent.getID() == MouseEvent.MOUSE_ENTERED || inputEvent.getID() == MouseEvent.MOUSE_EXITED; @@ -379,6 +516,8 @@ /** * Return the mouse position in PCanvas coordinates. + * + * @return mouse position in PCanvas coordinates */ public Point2D getCanvasPosition() { return (Point2D) inputManager.getCurrentCanvasPosition().clone(); @@ -387,6 +526,9 @@ /** * Return the delta between the last and current mouse position in PCanvas * coordinates. + * + * @return delta between last and current mouse position as measured by the + * PCanvas */ public PDimension getCanvasDelta() { final Point2D last = inputManager.getLastCanvasPosition(); @@ -396,6 +538,10 @@ /** * Return the mouse position relative to a given node on the pick path. + * + * @param nodeOnPath node on the current PPickPath + * + * @return mouse position relative to the provided node on pick path */ public Point2D getPositionRelativeTo(final PNode nodeOnPath) { final Point2D r = getCanvasPosition(); @@ -405,6 +551,10 @@ /** * Return the delta between the last and current mouse positions relative to * a given node on the pick path. + * + * @param nodeOnPath node from which to measure + * @return delta between current mouse position and a given node on the pick + * path */ public PDimension getDeltaRelativeTo(final PNode nodeOnPath) { final PDimension r = getCanvasDelta(); @@ -414,6 +564,8 @@ /** * Return the mouse position transformed through the view transform of the * bottom camera. + * + * @return mouse position as measured by the bottom camera */ public Point2D getPosition() { final Point2D r = getCanvasPosition(); @@ -424,6 +576,9 @@ /** * Return the delta between the last and current mouse positions transformed * through the view transform of the bottom camera. + * + * @return delta between last and current mouse position as measured by the + * bottom camera */ public PDimension getDelta() { final PDimension r = getCanvasDelta(); @@ -433,6 +588,8 @@ /** * Returns a string representation of this object for debugging purposes. + * + * @return string representation of this object */ public String toString() { final StringBuffer result = new StringBuffer(); diff --git a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java index 210d127..acbb879 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java +++ b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java @@ -52,7 +52,7 @@ * @author Jesse Grosjean */ public class PInputEventFilter { - + /** Mask representing all possible modifiers. */ public static int ALL_MODIFIERS_MASK = InputEvent.BUTTON1_MASK | InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK | InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK | InputEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK | InputEvent.META_MASK; diff --git a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventListener.java b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventListener.java index 4502786..3153616 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventListener.java +++ b/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventListener.java @@ -43,7 +43,12 @@ * @author Jesse Grosjean */ public interface PInputEventListener extends EventListener { - - public void processEvent(PInputEvent aEvent, int type); - + /** + * Called whenever an event is emitted. Used to notify listeners that an + * event is available for proecessing. + * + * @param event event that was emitted + * @param type type of event + */ + void processEvent(PInputEvent event, int type); } diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransformException.java b/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransformException.java index 5381784..cc676a8 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransformException.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PAffineTransformException.java @@ -1,5 +1,8 @@ package edu.umd.cs.piccolo.util; +/** + * This class is used to encapsulate exceptions that may occur while performing transform operations. + */ public class PAffineTransformException extends RuntimeException { /** * Allows for future serialization code to understand versioned binary diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PObjectOutputStream.java b/core/src/main/java/edu/umd/cs/piccolo/util/PObjectOutputStream.java index 775a09f..9d26cec 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PObjectOutputStream.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PObjectOutputStream.java @@ -111,7 +111,7 @@ protected void recordUnconditionallyWritten(final Object aRoot) throws IOException { class ZMarkObjectOutputStream extends PObjectOutputStream { public ZMarkObjectOutputStream() throws IOException { - super(PUtil.NULL_OUTPUT_STREAM); + super(NULL_OUTPUT_STREAM); enableReplaceObject(true); } @@ -125,4 +125,21 @@ } new ZMarkObjectOutputStream().writeObject(aRoot); } + + private static final OutputStream NULL_OUTPUT_STREAM = new OutputStream() { + public void close() { + } + + public void flush() { + } + + public void write(final byte[] b) { + } + + public void write(final byte[] b, final int off, final int len) { + } + + public void write(final int b) { + } + }; } diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java b/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java index a248143..33146f8 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java @@ -49,27 +49,54 @@ * @author Jesse Grosjean */ public class PPaintContext { - + /** Used for lowering quality of rendering when requested. */ public static final int LOW_QUALITY_RENDERING = 0; + + /** Used for improving quality of rendering when requested. */ public static final int HIGH_QUALITY_RENDERING = 1; + /** Font context to use while in low quality rendering. */ public static FontRenderContext RENDER_QUALITY_LOW_FRC = new FontRenderContext(null, false, true); + + /** Font context to use while in high quality rendering. */ public static FontRenderContext RENDER_QUALITY_HIGH_FRC = new FontRenderContext(null, true, true); + + /** + * @deprecated will disappear as soon as possible Global for accessing the + * current paint context while painting. + **/ public static PPaintContext CURRENT_PAINT_CONTEXT; + /** Used while calculating scale at which rendering is occurring. */ private static double[] PTS = new double[4]; + /** PaintContext is associated with this graphics context */ private final Graphics2D graphics; + + /** Used while computing transparency. */ protected PStack compositeStack; + + /** Used to optimize clipping region. */ protected PStack clipStack; + + /** Tracks clipping region in local coordinate system. */ protected PStack localClipStack; + protected PStack cameraStack; + protected PStack transformStack; + + /** The current render quality that all rendering should be done in. */ protected int renderQuality; - public PPaintContext(final Graphics2D aGraphics) { + /** + * Creates a PPaintContext associated with the given graphics context. + * + * @param graphics graphics context to associate with this paint context + */ + public PPaintContext(final Graphics2D graphics) { super(); - graphics = aGraphics; + this.graphics = graphics; compositeStack = new PStack(); clipStack = new PStack(); localClipStack = new PStack(); @@ -77,10 +104,10 @@ transformStack = new PStack(); renderQuality = HIGH_QUALITY_RENDERING; - Shape clip = aGraphics.getClip(); + Shape clip = graphics.getClip(); if (clip == null) { clip = new PBounds(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE); - aGraphics.setClip(clip); + graphics.setClip(clip); } localClipStack.push(clip.getBounds2D()); @@ -88,6 +115,11 @@ CURRENT_PAINT_CONTEXT = this; } + /** + * Returns the graphics context associated with this paint context. + * + * @return graphics context associated with this paint context + */ public Graphics2D getGraphics() { return graphics; } @@ -96,10 +128,24 @@ // Context Attributes. // **************************************************************** + /** + * Returns the clipping region in the local coordinate system applied by + * graphics + * + * @return clipping region in the local coordinate system applied by + * graphics + */ public Rectangle2D getLocalClip() { return (Rectangle2D) localClipStack.peek(); } + /** + * Returns scale of the current graphics context. By calculating how a unit + * segment gets transformed after transforming it by the graphics context's + * transform. + * + * @return scale of the current graphics context's transformation + */ public double getScale() { PTS[0] = 0;// x1 PTS[1] = 0;// y1 @@ -114,14 +160,33 @@ // popped. // **************************************************************** + /** + * Pushes the camera onto the camera stack. + * + * @param aCamera camera to push onto the stack + */ public void pushCamera(final PCamera aCamera) { cameraStack.push(aCamera); } + /** + * @deprecated in favor of popCamera() + * + * @param aCamera absolute not used in any way + */ public void popCamera(final PCamera aCamera) { cameraStack.pop(); } + /** + * Removes the camera at the top of the camera stack. + * + * @param aCamera absolute not used in any way + */ + public void popCamera() { + cameraStack.pop(); + } + public PCamera getCamera() { return (PCamera) cameraStack.peek(); } @@ -142,7 +207,7 @@ } public void pushTransparency(final float transparency) { - if (transparency == 1) { + if (transparency == 1.0f) { return; } final Composite current = graphics.getComposite(); @@ -158,7 +223,7 @@ } public void popTransparency(final float transparency) { - if (transparency == 1) { + if (transparency == 1.0f) { return; } final Composite c = (Composite) compositeStack.pop(); @@ -166,30 +231,43 @@ } public void pushTransform(final PAffineTransform aTransform) { - if (aTransform == null) { - return; + if (aTransform != null) { + final Rectangle2D newLocalClip = (Rectangle2D) getLocalClip().clone(); + aTransform.inverseTransform(newLocalClip, newLocalClip); + transformStack.push(graphics.getTransform()); + localClipStack.push(newLocalClip); + graphics.transform(aTransform); } - final Rectangle2D newLocalClip = (Rectangle2D) getLocalClip().clone(); - aTransform.inverseTransform(newLocalClip, newLocalClip); - transformStack.push(graphics.getTransform()); - localClipStack.push(newLocalClip); - graphics.transform(aTransform); } + /** + * Pops the topmost Transform from the top of the transform if the passed in + * transform is not null. + * + * @deprecated in favor of popTransform() + * @param aTransform transform that should be at the top of the stack + */ public void popTransform(final PAffineTransform aTransform) { - if (aTransform == null) { - return; + if (aTransform != null) { + graphics.setTransform((AffineTransform) transformStack.pop()); + localClipStack.pop(); } - graphics.setTransform((AffineTransform) transformStack.pop()); - localClipStack.pop(); } - // **************************************************************** - // Render Quality. - // ****************************************************************/ + /** + * Pops the topmost Transform from the top of the transform stack, or does nothing if it's empty. + */ + public void popTransform() { + if (!transformStack.isEmpty()) { + graphics.setTransform((AffineTransform) transformStack.pop()); + localClipStack.pop(); + } + } /** * Return the render quality used by this paint context. + * + * @return the current render quality */ public int getRenderQuality() { return renderQuality; diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java b/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java index 587430b..47bb7fe 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java @@ -63,22 +63,32 @@ * @author Jesse Grosjean */ public class PPickPath implements PInputEventListener { - + /** Global pick path. */ public static PPickPath CURRENT_PICK_PATH; + /** Used when calculating the scale. */ private static double[] PTS = new double[4]; + /** Stack of nodes representing all picked nodes. */ private PStack nodeStack; + + private final PCamera topCamera; private PStack transformStack; private PStack pickBoundsStack; - private final PCamera topCamera; private PCamera bottomCamera; private HashMap excludedNodes; - public PPickPath(final PCamera aCamera, final PBounds aScreenPickBounds) { + /** + * Creates a pick pack originating from the provided camera and with the + * given screen pick bounds. + * + * @param camera camera from which the pickpath originates + * @param aScreenPickBounds bounds of pick area + */ + public PPickPath(final PCamera camera, final PBounds aScreenPickBounds) { super(); pickBoundsStack = new PStack(); - topCamera = aCamera; + topCamera = camera; nodeStack = new PStack(); transformStack = new PStack(); pickBoundsStack.push(aScreenPickBounds); diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PStack.java b/core/src/main/java/edu/umd/cs/piccolo/util/PStack.java index 7f4edca..fa459dd 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PStack.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PStack.java @@ -45,13 +45,26 @@ */ private static final long serialVersionUID = 1L; + /** + * Creates an empty stack. + */ public PStack() { } + /** + * Pushes the provided object onto the top of the stack. + * + * @param o object to add to the stack + */ public void push(final Object o) { add(o); } + /** + * Returns topmost element on the stack, or null if stack is empty. + * + * @return topmost element on the stack, or null if empty + */ public Object peek() { final int s = size(); if (s == 0) { @@ -62,6 +75,11 @@ } } + /** + * Removes top element on the stack and returns it. + * + * @return topmost element on stack. + */ public Object pop() { return remove(size() - 1); } diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java b/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java index 37cb72f..7bbb63e 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java @@ -53,12 +53,15 @@ * @author Jesse Grosjean */ public class PUtil { - - public static long DEFAULT_ACTIVITY_STEP_RATE = 20; + /** + * PActivities are broken into steps, this is how many milliseconds should + * pass between steps. + */ + public static long DEFAULT_ACTIVITY_STEP_RATE = 20; public static int ACTIVITY_SCHEDULER_FRAME_DELAY = 10; - private static final int PATH_TERMINATOR = -1; - public static Iterator NULL_ITERATOR = Collections.EMPTY_LIST.iterator(); + + private static final int PATH_TERMINATOR = -1; public static Enumeration NULL_ENUMERATION = new Enumeration() { public boolean hasMoreElements() { return false; @@ -69,6 +72,9 @@ } }; + /** + * @deprecated This has been moved into a private static class of PObjectOutputStream + */ public static OutputStream NULL_OUTPUT_STREAM = new OutputStream() { public void close() { } @@ -86,16 +92,21 @@ } }; + /** + * Creates the simplest possible scene graph. 1 Camera, 1 Layer, 1 Root + * + * @return a basic scene with 1 camera, layer and root + */ public static PCamera createBasicScenegraph() { - final PRoot r = new PRoot(); - final PLayer l = new PLayer(); - final PCamera c = new PCamera(); + final PRoot root = new PRoot(); + final PLayer layer = new PLayer(); + final PCamera camera = new PCamera(); - r.addChild(c); - r.addChild(l); - c.addLayer(l); + root.addChild(camera); + root.addChild(layer); + camera.addLayer(layer); - return c; + return camera; } public static void writeStroke(final Stroke stroke, final ObjectOutputStream out) throws IOException {