artoflife pre0.1.0-dev

org.artoflife.gp
Class PopulationEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.artoflife.gp.PopulationEvent
All Implemented Interfaces:
java.io.Serializable

public class PopulationEvent
extends java.util.EventObject

Received by PopulationListeners when a Population changes. The source of this event is always a Population.

This is intended to enable views on the population as it breeds new generations.

Author:
Steve Meyfroidt
See Also:
Serialized Form

Field Summary
static int ADDED
          Event type: added an individual.
static int CHANGED
          Event type: an individual changed internal state.
static int REMOVED
          Event type: culled an individual.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PopulationEvent(Population source, int type, Individual individual)
           
 
Method Summary
 Individual getIndividual()
           
 Population getSourcePopulation()
           
 int getType()
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REMOVED

public static final int REMOVED
Event type: culled an individual.

See Also:
Constant Field Values

ADDED

public static final int ADDED
Event type: added an individual.

See Also:
Constant Field Values

CHANGED

public static final int CHANGED
Event type: an individual changed internal state.

See Also:
Constant Field Values
Constructor Detail

PopulationEvent

public PopulationEvent(Population source,
                       int type,
                       Individual individual)
Parameters:
source - of this event
type - of this event. See ADDED, REMOVED, CHANGED
individual - that changed
Method Detail

getSourcePopulation

public Population getSourcePopulation()
Returns:
Population that was source of this event

getType

public int getType()
Returns:
the type of event that just happened.
See Also:
REMOVED, ADDED, CHANGED

getIndividual

public Individual getIndividual()
Returns:
the individual that was added or removed

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject

artoflife pre0.1.0-dev

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