All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sim.portrayal.grid.DrawPolicy Maven / Gradle / Ivy

Go to download

MASON is a fast discrete-event multiagent simulation library core in Java, designed to be the foundation for large custom-purpose Java simulations, and also to provide more than enough functionality for many lightweight simulation needs. MASON contains both a model library and an optional suite of visualization tools in 2D and 3D.

The newest version!
/*
  Copyright 2006 by Sean Luke and George Mason University
  Licensed under the Academic Free License version 3.0
  See the file "LICENSE" for more information
*/

package sim.portrayal.grid;
import sim.util.*;

/** 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. */

public interface DrawPolicy
    {
    /** 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. */ public boolean objectToDraw(Bag fromHere, Bag addToHere); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy