wyvern.kernel.maps
Class TopFinder.LayerVisitor

java.lang.Object
  extended bywyvern.kernel.maps.TopFinder.LayerVisitor
All Implemented Interfaces:
Visitor
Enclosing class:
TopFinder

protected static class TopFinder.LayerVisitor
extends java.lang.Object
implements Visitor

Used to visit every object at a map location and keep an ordered list of what it sees.


Constructor Summary
TopFinder.LayerVisitor(Predicate p)
          Constructs a new LayerVisitor with a predicate used to filter the visited objects.
 
Method Summary
 GameObject getObject()
          Returns the topmost object we found.
 void visit(GameObject obj)
          Remember one object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopFinder.LayerVisitor

public TopFinder.LayerVisitor(Predicate p)
Constructs a new LayerVisitor with a predicate used to filter the visited objects.

Method Detail

visit

public void visit(GameObject obj)
Remember one object.

Specified by:
visit in interface Visitor
Parameters:
obj - a GameObject

getObject

public GameObject getObject()
Returns the topmost object we found.

Returns:
the top object in the cell, or null if there were no objects in the cell (i.e. only default terrain)