Interface DrawPolicy


public interface DrawPolicy
Called by Sparse2DPortrayal to determine if all objects should be drawn or only one. The Bags provided contain objects all sitting in the same cell location onscreen.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    objectToDraw(Bag fromHere, Bag addToHere)
    Specifies objects which should be drawn at a given location, and which objects should not.
  • Method Details

    • objectToDraw

      boolean objectToDraw(Bag fromHere, Bag addToHere)
      Specifies objects which should be drawn at a given location, and which objects should not. The fromHere Bag contains, for a given location, all the objects which can be found at the location. This function places into the bag addToHere a subset of those objects which you wish to actually have drawn. The order in which the objects appear in addToHere Bag is the order in which they will be drawn, so the later objects in the Bag will be drawn on TOP of the earlier objects in the Bag. Do not modify the fromHere Bag. The addToHere bag will be provided to this function in an empty state; no need to clear() it.

      This function should usually return true. However if you wish to use all the objects in the fromHere Bag, in exactly the order in which they appear, you can be quite a bit more efficient by not bothering to add the objects into the addToHere bag and instead simply returning false, in which case the fromHere bag will be used instead.