Package sim.portrayal

Interface Fixed2D


public interface Fixed2D
Deprecated.

A Fixed2D object has control over how it is moved by a MovablePortrayal2D object. Objects may wish to implement this interface to:

  • Prevent MovablePortrayal2D from moving them
  • Restrict how or where the MovablePortrayal2D can move them.
  • Stay informed about being moved
  • Update multiple fields as a result of being moved.

Objects which do not implement this interface have no say: MovablePortrayal2D will go directly to their fields and ask the fields to move them about. Fixed2D is deprecated: use Constrained instead.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    maySetLocation(Object field, Object newObjectLocation)
    Deprecated. 
  • Method Details

    • maySetLocation

      boolean maySetLocation(Object field, Object newObjectLocation)
      Deprecated.
      Returns true if the object permits you to change its location in the field. Else returns false. This can be used for various purposes:

      • If you don't want to be moved by a MovablePortrayal2D, simply return false.
      • If you're fine being moved, simply return true.
      • If want to be informed of being moved -- for example, to update internal belief about your location -- when this method is called just make the internal updates, then return true.
      • If you want to control where you're being moved, for example to guarantee that you're moved in a straight line, or constrained to be within a certain region, based on the provided location, move the Object itself in the field to a revised location of your choosing, then return false.
      • If you are stored in multiple fields and need to make certain that all of them are updated properly when the user moves you in one field, when this method is called just make all the appropriate updates in the various fields, then return true.