tesuji.games.go
Class FourCursor

java.lang.Object
  |
  +--tesuji.games.go.GoCursor
        |
        +--tesuji.games.go.FourCursor
All Implemented Interfaces:
Cursor, FlyWeight

public class FourCursor
extends tesuji.games.go.GoCursor

This is a four-way cursor. It will move to each direct neighbour of a given starting point. Although using the cursor definition is more elegant, just looping over the offset array is more efficient.

Creation date: (09-May-01 1:06:28 PM)

Product: Tesuji Software Go Library.

Copyright (c) 2001 Tesuji Software B.V.
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a Tesuji Software shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of Tesuji Software.


Field Summary
protected  int currentIndex
           
static int[] offset
           
protected  int[] path
           
protected  int start
           
 
Constructor Summary
FourCursor(int startPosition, java.util.Stack fourCursorStack)
           
 
Method Summary
 boolean continues()
           
 int next()
           
 void recycle()
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offset

public static final int[] offset

start

protected int start

path

protected int[] path

currentIndex

protected int currentIndex
Constructor Detail

FourCursor

public FourCursor(int startPosition,
                  java.util.Stack fourCursorStack)
Method Detail

continues

public final boolean continues()
Specified by:
continues in interface Cursor

next

public final int next()
Specified by:
next in interface Cursor

start

public void start()
Specified by:
start in interface Cursor

recycle

public void recycle()
Specified by:
recycle in interface FlyWeight