net.sourceforge.cilib.entity
Class AbstractTopology<E extends Entity>

java.lang.Object
  extended by net.sourceforge.cilib.entity.AbstractTopology<E>
Type Parameters:
E - The Entity type.
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>, Topology<E>, Cloneable
Direct Known Subclasses:
GBestTopology, VonNeumannTopology

public abstract class AbstractTopology<E extends Entity>
extends Object
implements Topology<E>

This an abstract class which extends from the abstract Topology class. All PopulationBasedAlgorithm Topologies must inherit from this class.

Author:
Gary Pampara, otter
See Also:
Serialized Form

Constructor Summary
AbstractTopology()
           
 
Method Summary
 void accept(TopologyVisitor visitor)
          Accept a TopologyVisitor into the Topology to perform the actions defined within the TopologyVisitor.
 void accept(Visitor<E> visitor)
          Accept a vistitor and perform the visitor actions on this Topology.
 void clearBestEntity()
          Clear the current best entity from the topology, thereby forcing a re-calculation of the best Entity within the topology.
 E getBestEntity()
          Obtain the most fit Entity within the Topology.
 E getBestEntity(Comparator<? super E> comparator)
          Obtain the Entity within the current Topology, based on the provided Comparator instance.
abstract  Topology<E> getClone()
          Create a cloned copy of the current object and return it.
 void update()
          Perform any required updates to the Topology instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.cilib.entity.Topology
add, asList, clear, contains, containsAll, equals, get, getId, hashCode, isEmpty, iterator, neighbourhood, remove, remove, removeAll, retainAll, set, setId, size, toArray, toArray
 
Methods inherited from interface java.util.List
add, addAll, addAll, indexOf, lastIndexOf, listIterator, listIterator, remove, subList
 

Constructor Detail

AbstractTopology

public AbstractTopology()
Method Detail

getClone

public abstract Topology<E> getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Topology<E extends Entity>
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

accept

public void accept(Visitor<E> visitor)
Accept a vistitor and perform the visitor actions on this Topology.

Specified by:
accept in interface Topology<E extends Entity>
Parameters:
visitor - The Visitor to accept

accept

public void accept(TopologyVisitor visitor)
Accept a TopologyVisitor into the Topology to perform the actions defined within the TopologyVisitor.

Specified by:
accept in interface Topology<E extends Entity>
Parameters:
visitor - The instance to accept into the Topology.

getBestEntity

public E getBestEntity()
Obtain the most fit Entity within the Topology. This is the same as getBestEntity(Comparator) with a AscendingFitnessComparator as the provided comparator.

Specified by:
getBestEntity in interface Topology<E extends Entity>
Returns:
The current best Entity.
See Also:
getBestEntity(java.util.Comparator)

getBestEntity

public E getBestEntity(Comparator<? super E> comparator)
Obtain the Entity within the current Topology, based on the provided Comparator instance.

Specified by:
getBestEntity in interface Topology<E extends Entity>
Parameters:
comparator - The Comparator to base the selection on.
Returns:
The best entity within the current topology.

clearBestEntity

public void clearBestEntity()
Clear the current best entity from the topology, thereby forcing a re-calculation of the best Entity within the topology.

Specified by:
clearBestEntity in interface Topology<E extends Entity>

update

public void update()
Perform any required updates to the Topology instance. The method in has an empty implementation and needs to be overridden within the required subclass.

Specified by:
update in interface Topology<E extends Entity>


Copyright © 2009 CIRG. All Rights Reserved.