/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.pso.guideprovider;

import net.sourceforge.cilib.algorithm.AbstractAlgorithm;
import net.sourceforge.cilib.entity.Topology;
import net.sourceforge.cilib.pso.PSO;
import net.sourceforge.cilib.pso.particle.Particle;
import net.sourceforge.cilib.type.types.container.StructuredType;
import net.sourceforge.cilib.type.types.container.Vector;
import net.sourceforge.cilib.util.selection.recipes.Selector;
import net.sourceforge.cilib.util.selection.recipes.TournamentSelector;

public class SelectionGuideProvider implements GuideProvider {
    
    private Selector<? extends Particle> selector;
    private boolean perDimension;
    private GuideProvider component;
    
    public SelectionGuideProvider() {
        this.selector = new TournamentSelector();
        this.perDimension = true;
        this.component = new CurrentPositionGuideProvider();
    }

    private SelectionGuideProvider(SelectionGuideProvider other) {
        this.selector = other.selector;
        this.perDimension = other.perDimension;
        this.component = other.component.getClone();
    }

    public SelectionGuideProvider getClone() {
        return new SelectionGuideProvider(this);
    }

    public StructuredType get(Particle particle) {
        Topology topology = ((PSO) AbstractAlgorithm.get()).getTopology();
        
        if (perDimension) {
            Vector.Builder builder = Vector.newBuilder();
            for (int i = 0; i < particle.getDimension(); i++) {
                Vector v = (Vector) component.get(selector.on(topology).select());
                builder.add(v.get(i));
            }
            return builder.build();
        }
        
        return component.get(selector.on(topology).select());
    }

    public void setSelector(Selector<? extends Particle> selector) {
        this.selector = selector;
    }

    public void setPerDimension(boolean perDimension) {
        this.perDimension = perDimension;
    }

    public void setComponent(GuideProvider component) {
        this.component = component;
    }

}

@@ -301,54 +301,8 @@
 hm;%0A
-import net.sourceforge.cilib.entity.Topology;%0A
 impo
@@ -335,16 +335,16 @@
 so.PSO;%0A
+
 import n
@@ -731,34 +731,24 @@
 te Selector%3C
-? extends 
 Particle%3E se
@@ -1228,32 +1228,46 @@
 Clone();%0A    %7D%0A%0A
+    @Override%0A
     public Selec
@@ -1345,32 +1345,46 @@
 r(this);%0A    %7D%0A%0A
+    @Override%0A
     public Struc
@@ -1426,24 +1426,38 @@
         
-Topology
+fj.data.List%3CParticle%3E
  topolog
@@ -1918,32 +1918,32 @@
 lect());%0A    %7D%0A%0A
+
     public void 
@@ -1967,18 +1967,8 @@
 tor%3C
-? extends 
 Part

Rebase fixes.