artoflife pre0.1.0-dev

org.artoflife.gui.population
Class FreeVerticalFitnessPolicy

java.lang.Object
  |
  +--org.artoflife.gui.population.VerticalFitnessPolicy
        |
        +--org.artoflife.gui.population.FreeVerticalFitnessPolicy
All Implemented Interfaces:
RecordPositionPolicy

public class FreeVerticalFitnessPolicy
extends VerticalFitnessPolicy

A RecordPositionPolicy that positions individuals vertically by their Fitness (higher is fitter), but does not enforce a rigid horizontal position policy. A record remains at its X position throughout its life. On scaling, all X positions are scaled. New records are positioned in separate lanes if possible, else least overlap on an existing record. Record index is not taken into account.

Author:
Steve Meyfroidt
To do:
make this the superclass of VerticalFitnessPolicy, solve the Drop problem: this shouldn't add the individual back!

Field Summary
 
Fields inherited from class org.artoflife.gui.population.VerticalFitnessPolicy
individualWidth, numberOfIndividuals, spacer, view
 
Constructor Summary
FreeVerticalFitnessPolicy(float minFitness, float maxFitness)
           
 
Method Summary
 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 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.
 
Methods inherited from class org.artoflife.gui.population.VerticalFitnessPolicy
getFitnessForY, getMaxFitness, getMinFitness, getSpacer, getX, getY, positionAfterChange, positionNewAt, setMaxFitness, setMinFitness, setPopulationView, setSpacer, updateBounds, updatePopulation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeVerticalFitnessPolicy

public FreeVerticalFitnessPolicy(float minFitness,
                                 float maxFitness)
Parameters:
minFitness -
maxFitness -
Method Detail

positionNew

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

Specified by:
positionNew in interface RecordPositionPolicy
Overrides:
positionNew in class VerticalFitnessPolicy
See Also:
RecordPositionPolicy.positionNew(org.artoflife.gui.population.IndividualRecord, int)

repositionForViewBounds

public void repositionForViewBounds(org.artoflife.gui.population.IndividualRecord record,
                                    int index,
                                    int x,
                                    int y,
                                    int width,
                                    int height)
Description copied from interface: RecordPositionPolicy
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.

Specified by:
repositionForViewBounds in interface RecordPositionPolicy
Overrides:
repositionForViewBounds in class VerticalFitnessPolicy
See Also:
RecordPositionPolicy.repositionForViewBounds(org.artoflife.gui.population.IndividualRecord, int, int, int, int, int)

artoflife pre0.1.0-dev

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