Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.portrayal
Interface Fixed2D

    public interface Fixed2D

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.

Method Summary
`boolean` | `maySetLocation(java.lang.Object field, java.lang.Object newObjectLocation)` Returns true if the object permits you to change its location in the field.

Method Detail

### maySetLocation

    boolean maySetLocation(java.lang.Object field,
                           java.lang.Object newObjectLocation)

  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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD