de.tabacha.cgo
Class Jump

java.lang.Object
  extended byde.tabacha.cgo.Move
      extended byde.tabacha.cgo.Jump
All Implemented Interfaces:
java.lang.Cloneable, Constants, java.io.Serializable

public final class Jump
extends Move

A move where the ball jumps.
$Id: Jump.java,v 1.7 2004/07/27 20:50:20 mk Exp $

Version:
$Revision: 1.7 $
See Also:
Serialized Form
Threadsafe?
false

Field Summary
 
Fields inherited from interface de.tabacha.cgo.Constants
BALL, COL_COUNT, DCOL, DOWN, DROW, E, EMPTY, FIRST_DIRECTION, KICK_OFF_FIELD, LAST_DIRECTION, N, NE, NW, OPPOSITE, PIECE, ROW_COUNT, S, SE, SW, UP, UPSIDEDOWN, W
 
Constructor Summary
Jump()
          Empty Constructor.
Jump(byte[] directions)
          Constructor.
 
Method Summary
 java.lang.Object clone()
           
 boolean hasNextLeap()
           
 boolean isEmpty()
          Returns true if this move contains zero jumps.
 byte nextLeap()
           
 byte pop()
          Removes and returns the last jump from this move.
 void push(byte direction)
          Adds a jump to the end of this move.
 int size()
          Returns the number of leaps of this jump.
 void startIteration()
           
 java.lang.String toString()
           
 void trimToSize()
          Minimize memory usage.
 Move upsideDown()
          The move returned is exactly this move mirrored along the central row.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Jump

public Jump()
Empty Constructor.


Jump

public Jump(byte[] directions)
Constructor.

Parameters:
directions - The list of the directions of the subsequent jumps.
Method Detail

clone

public java.lang.Object clone()

isEmpty

public boolean isEmpty()
Returns true if this move contains zero jumps.


size

public int size()
Returns the number of leaps of this jump.


trimToSize

public void trimToSize()
Minimize memory usage.


upsideDown

public Move upsideDown()
Description copied from class: Move
The move returned is exactly this move mirrored along the central row.

Specified by:
upsideDown in class Move

startIteration

public void startIteration()

hasNextLeap

public boolean hasNextLeap()

nextLeap

public byte nextLeap()

pop

public byte pop()
Removes and returns the last jump from this move.

Returns:
-1 if stack is empty.

push

public void push(byte direction)
Adds a jump to the end of this move.

Parameters:
direction - Where to jump in the end

toString

public java.lang.String toString()
Specified by:
toString in class Move