artoflife pre0.1.0-dev

org.artoflife.gui.population
Interface RecordPositionPolicy

All Known Implementing Classes:
VerticalFitnessPolicy

public interface RecordPositionPolicy

Used by PopulationView to implement a policy for positioning IndividualRecords horizontally and vertically within the view.

Author:
Steve Meyfroidt

Method Summary
 void positionAfterChange(org.artoflife.gui.population.IndividualRecord record, int index)
          Reposition a record (at a given index within the view) whose Individual changed in some way.
 void positionNew(org.artoflife.gui.population.IndividualRecord record, int index)
          Find a position for an Individual newly added to the view at a specified index and set the IndividualRecord's state appropriately.
 void positionNewAt(org.artoflife.gui.population.IndividualRecord record, int index, java.awt.Point location)
          Position a record at a certain location (if possible), altering the Individual within the passed IndividualRecord if necessary to make it fit at that location.
 void repositionForViewBounds(org.artoflife.gui.population.IndividualRecord record, int index, int x, int y, int width, int height)
          Reposition an IndividualRecord (at a given index within the view) so it fits in the parent view's new bounds passed in as parameters.
 void setPopulationView(PopulationView view)
           
 void updateBounds()
          The bounds of the owning view have changed so can update cached dimensions here.
 void updatePopulation()
          Population being viewed has changed in some way so might update some cached dimensions here if the population size has changed for example.
 

Method Detail

setPopulationView

public void setPopulationView(PopulationView view)
Parameters:
view - the parent PopulationView using this policy.

updateBounds

public void updateBounds()
The bounds of the owning view have changed so can update cached dimensions here. Don't rearrange record positions here though: do that in repositionForViewBounds(org.artoflife.gui.population.IndividualRecord, int, int, int, int, int).


updatePopulation

public void updatePopulation()
Population being viewed has changed in some way so might update some cached dimensions here if the population size has changed for example.


positionNew

public void positionNew(org.artoflife.gui.population.IndividualRecord record,
                        int index)
Find a position for an Individual newly added to the view at a specified index and set the IndividualRecord's state appropriately.


positionNewAt

public void positionNewAt(org.artoflife.gui.population.IndividualRecord record,
                          int index,
                          java.awt.Point location)
Position a record at a certain location (if possible), altering the Individual within the passed IndividualRecord if necessary to make it fit at that location. For example, VerticalFitnessPolicy sets the Individual's Fitness to fit the Y location but ignores the X location.


repositionForViewBounds

public void repositionForViewBounds(org.artoflife.gui.population.IndividualRecord record,
                                    int index,
                                    int x,
                                    int y,
                                    int width,
                                    int height)
Reposition an IndividualRecord (at a given index within the view) so it fits in the parent view's new bounds passed in as parameters. Note that the view is still at its old size when this gets called.


positionAfterChange

public void positionAfterChange(org.artoflife.gui.population.IndividualRecord record,
                                int index)
Reposition a record (at a given index within the view) whose Individual changed in some way.


artoflife pre0.1.0-dev

Copyright © 2002 the Art Of Life team. All Rights Reserved.