com.threerings.puzzle.drop.util
Class PieceDestroyer

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

public class PieceDestroyer
extends Object
implements DropPieceCodes

Handles destroying contiguous piece segments in a drop board.


Nested Class Summary
static interface PieceDestroyer.DestroyLogic
          An interface to be implemented by specific puzzles to detail the parameters and methodology by which pieces are destroyed in the puzzle board.
 
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
PieceDestroyer(PieceDestroyer.DestroyLogic logic)
          Constructs a piece destroyer that destroys pieces as specified by the supplied destroy logic.
 
Method Summary
 List<SegmentInfo> destroyPieces(DropBoard board, DropBoard.PieceOperation destroyOp)
          Destroys all pieces in the given board that are in contiguous rows or columns of pieces, returning a list of SegmentInfo objects detailing the destroyed piece segments.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PieceDestroyer

public PieceDestroyer(PieceDestroyer.DestroyLogic logic)
Constructs a piece destroyer that destroys pieces as specified by the supplied destroy logic.

Method Detail

destroyPieces

public List<SegmentInfo> destroyPieces(DropBoard board,
                                       DropBoard.PieceOperation destroyOp)
Destroys all pieces in the given board that are in contiguous rows or columns of pieces, returning a list of SegmentInfo objects detailing the destroyed piece segments. Note that a single list is used internally to gather the segment info, and so callers that care to modify the list should create their own copy; also, the pieces in the segments may overlap, i.e., two segments may contain the same piece.



Copyright © 2011. All Rights Reserved.