com.threerings.puzzle.drop.util
Class PieceDropper

java.lang.Object
  extended by com.threerings.puzzle.drop.util.PieceDropper
All Implemented Interfaces:
DropPieceCodes, com.threerings.util.DirectionCodes

public class PieceDropper
extends Object
implements DropPieceCodes

Handles dropping pieces in a board.


Nested Class Summary
static interface PieceDropper.DropObserver
          Called to inform a drop observer that a piece has been dropped.
static class PieceDropper.PieceDropInfo
          A class to hold information detailing the pieces to be dropped in a particular column.
 
Field Summary
 
Fields inherited from interface com.threerings.puzzle.drop.data.DropPieceCodes
DROP_BLOCK_PIECE_COUNT, PIECE_NONE
 
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
PieceDropper(PieceDropLogic logic)
          Constructs a piece dropper that uses the supplied piece drop logic to specialize itself for a particular puzzle.
 
Method Summary
 int dropPieces(DropBoard board, PieceDropper.DropObserver drobs)
          Effects any drops possible on the supplied board (modifying the board in the progress) and notifying the supplied drop observer of those drops.
 int fillBoard(DropBoard board, PieceDropper.DropObserver drobs)
          Drops new pieces onto the board to fill the gaps.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PieceDropper

public PieceDropper(PieceDropLogic logic)
Constructs a piece dropper that uses the supplied piece drop logic to specialize itself for a particular puzzle.

Method Detail

dropPieces

public int dropPieces(DropBoard board,
                      PieceDropper.DropObserver drobs)
Effects any drops possible on the supplied board (modifying the board in the progress) and notifying the supplied drop observer of those drops.

Returns:
the number of pieces dropped.

fillBoard

public int fillBoard(DropBoard board,
                     PieceDropper.DropObserver drobs)
Drops new pieces onto the board to fill the gaps.

Returns:
the number of pieces dropped.


Copyright © 2011. All Rights Reserved.