com.threerings.puzzle.drop.client

## Class DropBlockSprite

- java.lang.Object
- - com.threerings.media.AbstractMedia
  - - com.threerings.media.sprite.Sprite
    - - com.threerings.puzzle.drop.client.DropSprite
      - - com.threerings.puzzle.drop.client.DropBlockSprite

All Implemented Interfaces:
  com.threerings.media.util.Pathable, com.threerings.util.DirectionCodes, Shape

    public class DropBlockSprite
    extends DropSprite

The drop block sprite represents a block of multiple pieces that can be rotated to any of the four cardinal compass directions. As such, it may span multiple columns or rows depending on its orientation. The block has a "central" piece around which it rotates, with the other pieces referred to as "external" pieces.

### Field Summary

### Fields inherited from class com.threerings.media.AbstractMedia

`HUD_LAYER`

### Fields inherited from interface com.threerings.util.DirectionCodes

`CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST`

### Constructor Summary

Constructors
Constructor and Description
`DropBlockSprite(DropBoardView view, int col, int row, int orient, int[] pieces)` Constructs a drop block sprite and starts it dropping.
`DropBlockSprite(DropBoardView view, int col, int row, int orient, int[] pieces, int renderOrder)` Constructs a drop block sprite and starts it dropping.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `canPopup()` Can this sprite pop-up a row on a forgiving rotation?
`void` `didPopup()` Called if we pop up to decrement the remaining popups we have.
`Rectangle` `getBoardBounds()` Returns the bounds of the block in board piece coordinates.
`int[]` `getColumns()` Returns an array of the column numbers containing the block pieces.
`int` `getExternalColumn()` Returns the column the external piece is located in.
`int` `getExternalRow()` Returns the row the external piece is located in.
`int[]` `getRows()` Returns an array of the row numbers containing the block pieces.
`void` `setBoardLocation(int row, int col)` Sets the row and column the piece is located in.
`void` `setColumn(int col)` Sets the column the piece is located in.
`void` `setOrientation(int orient)` Updates the sprite image offset to reflect the direction in which the external piece is hanging.
`void` `setRow(int row)` Set the row the piece is located in.
`void` `toString(StringBuilder buf)`

### Methods inherited from class com.threerings.puzzle.drop.client.DropSprite

`drop, fastForward, getColumn, getDistance, getPercentDone, getPieces, getRow, getVelocity, inside, isBouncing, isDropping, paint, setBouncing, setColumnOffset, setPieces, setRowOffset, setVelocity, stop, tick`

### Methods inherited from class com.threerings.media.sprite.Sprite

`addSpriteObserver, cancelMove, contains, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, hitTest, intersects, isMoving, move, paintPath, pathBeginning, pathCompleted, removeSpriteObserver, setLocation, viewLocationDidChange`

### Methods inherited from class com.threerings.media.AbstractMedia

`contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, intersects, intersects, invalidate, queueNotification, renderCompareTo, setRenderOrder, toString`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface com.threerings.media.util.Pathable

`getBounds`

### Constructor Detail

#### DropBlockSprite

    public DropBlockSprite(DropBoardView view,
                           int col,
                           int row,
                           int orient,
                           int[] pieces)

Constructs a drop block sprite and starts it dropping.

Parameters:
  `view` - the board view upon which this sprite will be displayed.
  `col` - the column of the central piece.
  `row` - the row of the central piece.
  `orient` - the orientation of the sprite.
  `pieces` - the pieces displayed by the sprite.

#### DropBlockSprite

    public DropBlockSprite(DropBoardView view,
                           int col,
                           int row,
                           int orient,
                           int[] pieces,
                           int renderOrder)

Constructs a drop block sprite and starts it dropping.

Parameters:
  `view` - the board view upon which this sprite will be displayed.
  `col` - the column of the central piece.
  `row` - the row of the central piece.
  `orient` - the orientation of the sprite.
  `pieces` - the pieces displayed by the sprite.
  `renderOrder` - the rendering order of the sprite.

### Method Detail

#### getRows

    public int[] getRows()

Returns an array of the row numbers containing the block pieces. The first index is the row of the central piece. The array is cached and re-used internally and so the caller should make their own copy if they care to modify it.

#### getColumns

    public int[] getColumns()

Returns an array of the column numbers containing the block pieces. The first index is the column of the central piece. The array is cached and re-used internally and so the caller should make their own copy if they care to modify it.

#### getBoardBounds

    public Rectangle getBoardBounds()

Returns the bounds of the block in board piece coordinates. The bounds rectangle is cached and re-used internally and so the caller should make their own copy if they care to modify it.

#### getExternalRow

    public int getExternalRow()

Returns the row the external piece is located in.

#### getExternalColumn

    public int getExternalColumn()

Returns the column the external piece is located in.

#### setColumn

    public void setColumn(int col)

Description copied from class: `DropSprite`
Sets the column the piece is located in.

Overrides:
  `setColumn` in class `DropSprite`

#### setRow

    public void setRow(int row)

Description copied from class: `DropSprite`
Set the row the piece is located in.

Overrides:
  `setRow` in class `DropSprite`

#### setBoardLocation

    public void setBoardLocation(int row,
                                 int col)

Description copied from class: `DropSprite`
Sets the row and column the piece is located in.

Overrides:
  `setBoardLocation` in class `DropSprite`

#### setOrientation

    public void setOrientation(int orient)

Updates the sprite image offset to reflect the direction in which the external piece is hanging.

Specified by:
  `setOrientation` in interface `com.threerings.media.util.Pathable`
Overrides:
  `setOrientation` in class `DropSprite`

#### toString

    public void toString(StringBuilder buf)

Overrides:
  `toString` in class `DropSprite`

#### canPopup

    public boolean canPopup()

Can this sprite pop-up a row on a forgiving rotation?

#### didPopup

    public void didPopup()

Called if we pop up to decrement the remaining popups we have.