From 8d54026f6336f6334a2c141403612ba515f7bacf Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Fri, 14 May 2010 18:57:52 +0000 Subject: [PATCH] Whitespace git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@918 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/cast/ActionCache.java | 13 +- .../threerings/media/VirtualMediaPanel.java | 87 +++++------ .../media/image/TransformedMirage.java | 7 +- .../threerings/miso/client/DirtyItemList.java | 144 +++++++----------- 4 files changed, 102 insertions(+), 149 deletions(-) diff --git a/src/java/com/threerings/cast/ActionCache.java b/src/java/com/threerings/cast/ActionCache.java index 9bb24f7e..c96af273 100644 --- a/src/java/com/threerings/cast/ActionCache.java +++ b/src/java/com/threerings/cast/ActionCache.java @@ -27,16 +27,13 @@ package com.threerings.cast; public interface ActionCache { /** - * Fetches from the cache a composited set of images for a particular - * character for a particular action. + * Fetches from the cache a composited set of images for a particular character for a + * particular action. */ - public ActionFrames getActionFrames ( - CharacterDescriptor descrip, String action); + public ActionFrames getActionFrames (CharacterDescriptor descrip, String action); /** - * Requests that the specified set of action frames for the specified - * character be cached. + * Requests that the specified set of action frames for the specified character be cached. */ - public void cacheActionFrames ( - CharacterDescriptor descrip, String action, ActionFrames frames); + public void cacheActionFrames (CharacterDescriptor descrip, String action, ActionFrames frames); } diff --git a/src/java/com/threerings/media/VirtualMediaPanel.java b/src/java/com/threerings/media/VirtualMediaPanel.java index cc217543..273d171a 100644 --- a/src/java/com/threerings/media/VirtualMediaPanel.java +++ b/src/java/com/threerings/media/VirtualMediaPanel.java @@ -43,27 +43,24 @@ import com.threerings.media.util.Pathable; import static com.threerings.media.Log.log; /** - * Extends the base media panel with the notion of a virtual coordinate - * system. All entities in the virtual media panel have virtual - * coordinates and the virtual media panel displays a window into that - * virtual view. The panel can be made to scroll by adjusting the view - * offset slightly at the start of each tick and it will efficiently copy - * the unmodified view data and generate repaint requests for the exposed - * regions. + * Extends the base media panel with the notion of a virtual coordinate system. All entities in + * the virtual media panel have virtual coordinates and the virtual media panel displays a window + * into that virtual view. The panel can be made to scroll by adjusting the view offset slightly + * at the start of each tick and it will efficiently copy the unmodified view data and generate + * repaint requests for the exposed regions. */ public class VirtualMediaPanel extends MediaPanel { - /** The code for the pathable following mode wherein we keep the view - * centered on the pathable's location. */ + /** The code for the pathable following mode wherein we keep the view centered on the + * pathable's location. */ public static final byte CENTER_ON_PATHABLE = 0; - /** The code for the pathable following mode wherein we ensure that - * the marked pathable is always kept within the visible bounds of the - * view. */ + /** The code for the pathable following mode wherein we ensure that the marked pathable is + * always kept within the visible bounds of the view. */ public static final byte ENCLOSE_PATHABLE = 1; - /** The code for the pathable following mode wherein we set the upper-left - * corner of the view to the coordinates of the pathable. */ + /** The code for the pathable following mode wherein we set the upper-left corner of the view + * to the coordinates of the pathable. */ public static final byte TRACK_PATHABLE = 2; /** @@ -122,9 +119,10 @@ public class VirtualMediaPanel extends MediaPanel { _trackers.remove(tracker); } + /** - * Instructs the view to follow the supplied pathable; ensuring that - * the view's coordinates are adjusted according to the follow mode. + * Instructs the view to follow the supplied pathable; ensuring that the view's coordinates + * are adjusted according to the follow mode. * * @param pable the pathable to follow. * @param followMode the strategy for keeping the pathable in view. @@ -137,8 +135,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * Clears out the pathable that was being enclosed or followed due to - * a previous call to {@link #setFollowsPathable}. + * Clears out the pathable that was being enclosed or followed due to a previous call to + * {@link #setFollowsPathable}. */ public void clearPathable () { @@ -147,9 +145,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * We overload this to translate mouse events into the proper - * coordinates before they are dispatched to any of the mouse - * listeners. + * We overload this to translate mouse events into the proper coordinates before they are + * dispatched to any of the mouse listeners. */ @Override protected void processMouseEvent (MouseEvent event) @@ -159,9 +156,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * We overload this to translate mouse events into the proper - * coordinates before they are dispatched to any of the mouse - * listeners. + * We overload this to translate mouse events into the proper coordinates before they are + * dispatched to any of the mouse listeners. */ @Override protected void processMouseMotionEvent (MouseEvent event) @@ -171,9 +167,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * We overload this to translate mouse events into the proper - * coordinates before they are dispatched to any of the mouse - * listeners. + * We overload this to translate mouse events into the proper coordinates before they are + * dispatched to any of the mouse listeners. */ @Override protected void processMouseWheelEvent (MouseWheelEvent event) @@ -223,9 +218,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * Determines the absolute screen coordinates at which this panel is - * located and stores them for reference later when rendering. This - * is necessary in order to work around the Windows + * Determines the absolute screen coordinates at which this panel is located and stores them + * for reference later when rendering. This is necessary in order to work around the Windows * copyArea() bug. */ protected void findRootBounds () @@ -245,8 +239,7 @@ public class VirtualMediaPanel extends MediaPanel { int width = getWidth(), height = getHeight(); - // adjusts our view location to track any pathable we might be - // tracking + // adjusts our view location to track any pathable we might be tracking trackPathable(); // if we have a new target location, we'll need to generate dirty @@ -282,9 +275,8 @@ public class VirtualMediaPanel extends MediaPanel } - // now go ahead and update our location so that changes in - // between here and the call to paint() for this tick don't - // booch everything + // now go ahead and update our location so that changes in between here and the call + // to paint() for this tick don't booch everything _vbounds.x = _nx; _vbounds.y = _ny; addObscurerDirtyRegions(false); @@ -295,9 +287,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * Called during our tick when we have adjusted the view location. The - * {@link #_vbounds} will already have been updated to reflect our new - * view coordinates. + * Called during our tick when we have adjusted the view location. The {@link #_vbounds} will + * already have been updated to reflect our new view coordinates. * * @param dx the delta scrolled in the x direction (in pixels). * @param dy the delta scrolled in the y direction (in pixels). @@ -314,9 +305,8 @@ public class VirtualMediaPanel extends MediaPanel } /** - * Implements the standard pathable tracking support. Derived classes - * may wish to override this if they desire custom tracking - * functionality. + * Implements the standard pathable tracking support. Derived classes may wish to override + * this if they desire custom tracking functionality. */ protected void trackPathable () { @@ -375,14 +365,13 @@ public class VirtualMediaPanel extends MediaPanel int cx = (_dx > 0) ? _dx : 0; int cy = (_dy > 0) ? _dy : 0; - // set the clip to the bounds of the component (we can't - // assume the clip is anything sensible upon entry to paint() - // because the frame manager expects us to set our own clip) + // set the clip to the bounds of the component (we can't assume the clip is anything + // sensible upon entry to paint() because the frame manager expects us to set our own + // clip) gfx.setClip(0, 0, width, height); - // on windows, attempting to call copyArea() on a translated - // graphics context results in boochness; so we have to - // untranslate the graphics context, do our copyArea() and + // on windows, attempting to call copyArea() on a translated graphics context results + // in boochness; so we have to untranslate the graphics context, do our copyArea() and // then translate it back if (RunAnywhere.isWindows()) { gfx.translate(-_abounds.x, -_abounds.y); @@ -396,8 +385,8 @@ public class VirtualMediaPanel extends MediaPanel width - Math.abs(_dx), height - Math.abs(_dy), -_dx, -_dy); } catch (Exception e) { - // HACK when it throws an exception trying to do the - // copy area, just repaint everything + // HACK when it throws an exception trying to do the copy area, just repaint + // everything dirty = new Rectangle[] { new Rectangle(_vbounds) }; } } else { diff --git a/src/java/com/threerings/media/image/TransformedMirage.java b/src/java/com/threerings/media/image/TransformedMirage.java index 5c5a9e64..2551ec50 100644 --- a/src/java/com/threerings/media/image/TransformedMirage.java +++ b/src/java/com/threerings/media/image/TransformedMirage.java @@ -35,8 +35,8 @@ public class TransformedMirage implements Mirage { /** - * Constructor for backwards compatability that automatically repositions the - * transformed mirage so its new upper-left corner is still at the origin. + * Constructor for backwards compatibility that automatically repositions the transformed + * mirage so its new upper-left corner is still at the origin. */ public TransformedMirage (Mirage base, AffineTransform transform) { @@ -119,8 +119,7 @@ public class TransformedMirage } /** - * Compute the bounds of the base Mirage after it has been - * transformed. + * Compute the bounds of the base Mirage after it has been transformed. */ protected void computeTransformedBounds () { diff --git a/src/java/com/threerings/miso/client/DirtyItemList.java b/src/java/com/threerings/miso/client/DirtyItemList.java index 5c4ce249..b70d0b8b 100644 --- a/src/java/com/threerings/miso/client/DirtyItemList.java +++ b/src/java/com/threerings/miso/client/DirtyItemList.java @@ -37,22 +37,19 @@ import com.threerings.media.tile.ObjectTile; import static com.threerings.media.Log.log; /** - * The dirty item list keeps track of dirty sprites and object tiles - * in a scene. + * The dirty item list keeps track of dirty sprites and object tiles in a scene. */ public class DirtyItemList { /** - * Creates a dirt item list that will handle dirty items for the - * specified view. + * Creates a dirt item list that will handle dirty items for the specified view. */ public DirtyItemList () { } /** - * Appends the dirty sprite at the given coordinates to the dirty item - * list. + * Appends the dirty sprite at the given coordinates to the dirty item list. * * @param sprite the dirty sprite itself. * @param tx the sprite's x tile position. @@ -66,8 +63,7 @@ public class DirtyItemList } /** - * Appends the dirty object tile at the given coordinates to the dirty - * item list. + * Appends the dirty object tile at the given coordinates to the dirty item list. * * @param scobj the scene object that is dirty. */ @@ -87,8 +83,8 @@ public class DirtyItemList } /** - * Returns an array of the {@link DirtyItem} objects in the list - * sorted in proper rendering order. + * Returns an array of the {@link DirtyItem} objects in the list sorted in proper rendering + * order. */ public void sort () { @@ -121,8 +117,7 @@ public class DirtyItemList log.info("Sorted by rear-depth", "items", toString(_ditems)); } - // now insertion sort the items from back to front into the - // render-sorted array + // now insertion sort the items from back to front into the render-sorted array _items.clear(); POS_LOOP: for (int ii = 0; ii < size; ii++) { @@ -136,8 +131,7 @@ public class DirtyItemList continue POS_LOOP; } } - // we don't render in front of anyone, so we go at the - // front of the list + // we don't render in front of anyone, so we go at the front of the list _items.add(0, item); } @@ -160,9 +154,8 @@ public class DirtyItemList } /** - * Paints all the dirty items in this list using the supplied graphics - * context. The items are removed from the dirty list after being - * painted and the dirty list ends up empty. + * Paints all the dirty items in this list using the supplied graphics context. The items are + * removed from the dirty list after being painted and the dirty list ends up empty. */ public void paintAndClear (Graphics2D gfx) { @@ -197,8 +190,8 @@ public class DirtyItemList } /** - * Obtains a new dirty item instance, reusing an old one if possible - * or creating a new one otherwise. + * Obtains a new dirty item instance, reusing an old one if possible or creating a new one + * otherwise. */ protected DirtyItem getDirtyItem () { @@ -210,9 +203,8 @@ public class DirtyItemList } /** - * Returns an abbreviated string representation of the given dirty - * item describing only its origin coordinates and render priority. - * Intended for debugging purposes. + * Returns an abbreviated string representation of the given dirty item describing only its + * origin coordinates and render priority. Intended for debugging purposes. */ protected static String toString (DirtyItem a) { @@ -222,8 +214,8 @@ public class DirtyItemList } /** - * Returns an abbreviated string representation of the two given dirty - * items. See {@link #toString(DirtyItem)}. + * Returns an abbreviated string representation of the two given dirty items. See + * {@link #toString(DirtyItem)}. */ protected static String toString (DirtyItem a, DirtyItem b) { @@ -234,8 +226,8 @@ public class DirtyItemList } /** - * Returns an abbreviated string representation of the given dirty - * items. See {@link #toString(DirtyItem)}. + * Returns an abbreviated string representation of the given dirty items. See + * {@link #toString(DirtyItem)}. */ protected static String toString (SortableArrayList items) { @@ -259,9 +251,9 @@ public class DirtyItemList } /** - * A class to hold the items inserted in the dirty list along with - * all of the information necessary to render their dirty regions - * to the target graphics context when the time comes to do so. + * A class to hold the items inserted in the dirty list along with all of the information + * necessary to render their dirty regions to the target graphics context when the time comes + * to do so. */ public class DirtyItem { @@ -280,15 +272,13 @@ public class DirtyItemList /** * Initializes a dirty item. */ - public void init (Object obj, int x, int y) - { + public void init (Object obj, int x, int y) { this.obj = obj; this.ox = x; this.oy = y; - // calculate the item's leftmost and rightmost tiles; note - // that normal (Non-MultiTile) sprites occupy only a single tile, so leftmost and - // rightmost tiles are equivalent + // calculate the item's leftmost and rightmost tiles; note that normal (Non-MultiTile) + // sprites occupy only a single tile, so leftmost and rightmost tiles are equivalent lx = rx = ox; ly = ry = oy; if (obj instanceof SceneObject) { @@ -303,12 +293,10 @@ public class DirtyItemList } /** - * Paints the dirty item to the given graphics context. Only - * the portion of the item that falls within the given dirty - * rectangle is actually drawn. + * Paints the dirty item to the given graphics context. Only the portion of the item that + * falls within the given dirty rectangle is actually drawn. */ - public void paint (Graphics2D gfx) - { + public void paint (Graphics2D gfx) { if (obj instanceof Sprite) { ((Sprite)obj).paint(gfx); } else { @@ -319,18 +307,15 @@ public class DirtyItemList /** * Returns the "depth" of our rear-most tile. */ - public int getRearDepth () - { + public int getRearDepth () { return ry + lx; } /** - * Returns the render priority for this dirty item. It will be - * zero unless this is a display object which may have a custom - * render priority. + * Returns the render priority for this dirty item. It will be zero unless this is a + * display object which may have a custom render priority. */ - public int getRenderPriority () - { + public int getRenderPriority () { if (obj instanceof SceneObject) { return ((SceneObject)obj).getPriority(); } else { @@ -339,18 +324,15 @@ public class DirtyItemList } /** - * Releases all references held by this dirty item so that it - * doesn't inadvertently hold on to any objects while waiting to - * be reused. + * Releases all references held by this dirty item so that it doesn't inadvertently hold + * on to any objects while waiting to be reused. */ - public void clear () - { + public void clear () { obj = null; } @Override - public boolean equals (Object other) - { + public boolean equals (Object other) { // we're never equal to something that's not our kind if (!(other instanceof DirtyItem)) { return false; @@ -362,14 +344,12 @@ public class DirtyItemList } @Override - public int hashCode () - { + public int hashCode () { return obj.hashCode(); } @Override - public String toString () - { + public String toString () { StringBuilder buf = new StringBuilder(); buf.append("[obj=").append(obj); buf.append(", ox=").append(ox); @@ -383,24 +363,21 @@ public class DirtyItemList } /** - * A comparator class for use in sorting dirty items in ascending - * origin x- or y-axis coordinate order. + * A comparator class for use in sorting dirty items in ascending origin x- or y-axis + * coordinate order. */ protected static class OriginComparator implements Comparator { /** - * Constructs an origin comparator that sorts dirty items in - * ascending order based on their origin coordinate on the given - * axis. - */ - public OriginComparator (int axis) - { + * Constructs an origin comparator that sorts dirty items in ascending order based on + * their origin coordinate on the given axis. + */ + public OriginComparator (int axis) { _axis = axis; } // documentation inherited - public int compare (DirtyItem da, DirtyItem db) - { + public int compare (DirtyItem da, DirtyItem db) { // if they don't overlap, sort them normally if (_axis == X_AXIS) { if (da.ox != db.ox) { @@ -422,16 +399,14 @@ public class DirtyItemList } /** - * A comparator class for use in sorting the dirty sprites and - * objects in a scene in ascending x- and y-coordinate order - * suitable for rendering in the isometric view with proper visual + * A comparator class for use in sorting the dirty sprites and objects in a scene in ascending + * x- and y-coordinate order suitable for rendering in the isometric view with proper visual * results. */ protected class RenderComparator implements Comparator { // documentation inherited - public int compare (DirtyItem da, DirtyItem db) - { + public int compare (DirtyItem da, DirtyItem db) { // if the two objects are scene objects and they overlap, we // compare them solely based on their human assigned priority if ((da.obj instanceof SceneObject) && @@ -479,11 +454,10 @@ public class DirtyItemList } /** - * Returns whether two dirty items have a partitioning object - * between them on the given axis. + * Returns whether two dirty items have a partitioning object between them on the given + * axis. */ - protected int comparePartitioned (int axis, DirtyItem da, DirtyItem db) - { + protected int comparePartitioned (int axis, DirtyItem da, DirtyItem db) { // prepare for the partitioning check SortableArrayList sitems; Comparator comp; @@ -529,8 +503,7 @@ public class DirtyItemList break; } - // get the bounding item indices and the number of - // potentially-partitioning dirty items + // get the bounding item indices and the number of potentially-partitioning dirty items int aidx = sitems.binarySearch(da, comp); int bidx = sitems.binarySearch(db, comp); int size = bidx - aidx - 1; @@ -576,11 +549,9 @@ public class DirtyItemList } /** - * Compares the two dirty items assuming there are no partitioning - * objects between them. + * Compares the two dirty items assuming there are no partitioning objects between them. */ - protected int compareNonPartitioned (DirtyItem da, DirtyItem db) - { + protected int compareNonPartitioned (DirtyItem da, DirtyItem db) { if (da.ox == db.ox && da.oy == db.oy) { if (da.equals(db)) { @@ -674,16 +645,13 @@ public class DirtyItemList protected static final int X_AXIS = 0; protected static final int Y_AXIS = 1; - /** The comparator used to sort dirty items in ascending origin - * x-coordinate order. */ + /** The comparator used to sort dirty items in ascending origin x-coordinate order. */ protected static final Comparator ORIGIN_X_COMP = new OriginComparator(X_AXIS); - /** The comparator used to sort dirty items in ascending origin - * y-coordinate order. */ + /** The comparator used to sort dirty items in ascending origin y-coordinate order. */ protected static final Comparator ORIGIN_Y_COMP = new OriginComparator(Y_AXIS); - /** The comparator used to sort dirty items in ascending "rear-depth" - * order. */ + /** The comparator used to sort dirty items in ascending "rear-depth" order. */ protected static final Comparator REAR_DEPTH_COMP = new Comparator() { public int compare (DirtyItem o1, DirtyItem o2) { int depthDiff = (o1.getRearDepth() - o2.getRearDepth());