net.sourceforge.cilib.util.functions.Particles Maven / Gradle / Ivy
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.util.functions;
import fj.F;
import fj.F2;
import net.sourceforge.cilib.pso.particle.Particle;
import net.sourceforge.cilib.pso.particle.ParticleBehavior;
import net.sourceforge.cilib.pso.positionprovider.PositionProvider;
import net.sourceforge.cilib.pso.velocityprovider.VelocityProvider;
import net.sourceforge.cilib.type.types.container.Vector;
public final class Particles {
public static F
getPosition() {
return new F
() {
@Override
public Vector f(P a) {
return (Vector) a.getPosition();
}
};
}
public static
F
getVelocity() {
return new F
() {
@Override
public Vector f(P a) {
return (Vector) a.getVelocity();
}
};
}
public static
F
getGlobalGuide() {
return new F
() {
@Override
public Vector f(P a) {
return (Vector) a.getGlobalGuide();
}
};
}
public static
F
getLocalGuide() {
return new F
() {
@Override
public Vector f(P a) {
return (Vector) a.getLocalGuide();
}
};
}
public static
F
getNeighbourhoodBest() {
return new F
() {
@Override
public Particle f(P a) {
return a.getNeighbourhoodBest();
}
};
}
public static
F2
setNeighbourhoodBest() {
return new F2
() {
@Override
public P f(P a, P b) {
b.setNeighbourhoodBest(a);
return b;
}
};
}
public static
F
updatePosition() {
return new F
() {
@Override
public P f(P a) {
a.updatePosition();
return a;
}
};
}
public static
F
updateVelocity() {
return new F
() {
@Override
public P f(P a) {
a.updatePosition();
return a;
}
};
}
public static
F
getVelocityProvider() {
return new F
() {
@Override
public VelocityProvider f(P a) {
return a.getVelocityProvider();
}
};
}
public static
F
getPositionProvider() {
return new F
() {
@Override
public PositionProvider f(P a) {
return a.getPositionProvider();
}
};
}
public static
F
getParticleBehavior() {
return new F
() {
@Override
public ParticleBehavior f(P a) {
return a.getParticleBehavior();
}
};
}
public static
F2 setParticleBehavior() {
return new F2() {
@Override
public P f(ParticleBehavior a, P b) {
b.setParticleBehavior(a);
return b;
}
};
}
}