com.threerings.puzzle.drop.util
Class PieceDestroyer.SegmentLengthOperation

java.lang.Object
  extended by com.threerings.puzzle.drop.util.PieceDestroyer.SegmentLengthOperation
All Implemented Interfaces:
DropBoard.PieceOperation
Enclosing class:
PieceDestroyer

protected class PieceDestroyer.SegmentLengthOperation
extends Object
implements DropBoard.PieceOperation

A piece operation that calculates the length of the contiguous piece segment to which it is applied.


Field Summary
protected  int _len
          The segment length in pieces.
protected  int _piece
          The root segment piece.
 
Constructor Summary
protected PieceDestroyer.SegmentLengthOperation()
           
 
Method Summary
 boolean execute(DropBoard board, int col, int row)
          Called for each piece in the board segment the operation is being applied to.
 int getLength()
          Returns the length of the contiguous piece segment.
 void reset()
          Resets the operation for application to a new piece segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_piece

protected int _piece
The root segment piece.


_len

protected int _len
The segment length in pieces.

Constructor Detail

PieceDestroyer.SegmentLengthOperation

protected PieceDestroyer.SegmentLengthOperation()
Method Detail

reset

public void reset()
Resets the operation for application to a new piece segment.


getLength

public int getLength()
Returns the length of the contiguous piece segment.


execute

public boolean execute(DropBoard board,
                       int col,
                       int row)
Description copied from interface: DropBoard.PieceOperation
Called for each piece in the board segment the operation is being applied to.

Specified by:
execute in interface DropBoard.PieceOperation
Returns:
true if the operation should continue to be applied if being applied to multiple pieces, or false if it should terminate after this application.