|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--zinger.nibbles.drivers.SnakeDriverAdapter
A simple adapter class for SnakeDriver
interface. Direction can be changed asynchrously
by calling enqueue(int)
method.
To receive notifications
override the where
method and return its result at the end. Because of this behavior,
extensions of this class should not be assigned to more than one instance of Snake
.
enqueue(int)
,
where(zinger.nibbles.Snake)
,
Snake
Field Summary | |
private int |
direction
|
private int[] |
directionQueue
|
private int |
offset
|
private int |
start
|
Constructor Summary | |
SnakeDriverAdapter()
|
Method Summary | |
protected void |
clear()
Clears the queue. |
protected void |
enqueue(int direction)
|
int |
where(Snake snake)
This method is called on every turn as initiated by Field . |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int direction
private int[] directionQueue
private int start
private int offset
Constructor Detail |
public SnakeDriverAdapter()
Method Detail |
public int where(Snake snake)
SnakeDriver
Field
.where
in interface SnakeDriver
zinger.nibbles.SnakeDriver
Field.timeCall(zinger.nibbles.Timer)
protected void enqueue(int direction)
protected void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |