All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.cilib.util.selection.weighting.FixedWeighting Maven / Gradle / Ivy

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

import com.google.common.collect.Lists;
import java.util.List;
import net.sourceforge.cilib.util.selection.WeightedObject;

/**
 *
 */
public class FixedWeighting implements Weighting {
    private final double weight;

    public FixedWeighting(double weight) {
        this.weight = weight;
    }

    @Override
    public  Iterable weigh(Iterable iterable) {
        List result = Lists.newArrayList();
        for (T t : iterable) {
            result.add(new WeightedObject(t, weight));
        }
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy