📄 selectcomplement.java
字号:
/*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*//** * SelectComplement Class * * location: net.openai.ai.ga.selection.common.SelectComplement * */package net.openai.ai.ga.selection.common;import net.openai.ai.ga.selection.*;import net.openai.ai.ga.population.*;import net.openai.ai.ga.cell.*;import java.util.Collection;/** * <code>SelectComplement</code> is a <code>SelectionAlgorithm</code> * that will return the complement of the results of two specified <code> * SelectionAlgorithm</code>s. * * @author Jared Grubb * @version %I%, %G% * @since JDK1.3 */public class SelectComplement implements SelectionAlgorithm { private SelectionAlgorithm arg1; /** * Creates a new <code>SelectComplement</code> object for taking the * complement of the <code>Population</code>s returned by the two * passed <code>SelectionAlgorithm</code>s. * * @param toComplement the first <code>SelectionAlgorithm</code> */ public SelectComplement(SelectionAlgorithm toComplement) { this.arg1 = toComplement; } /** * Returns a <code>Population</code> that represents the complement * (disjunction) of the <code>SelectionAlgorithm</code> specified in * the constructor. The return is a new <code>Population</code> clone of * the specified <code>Population</code> with all results of the selection * algorithm removed from it via the <code>Population.removeCells</code> * method. * * @param pop the <code>Population</code> to choose from * @return the complement <code>Population</code> of the selection * algorithm */ public Population selectFromPopulation(Population pop) { Population toReturn = new Population(pop); toReturn.removeCells(arg1.selectFromPopulation(pop)); return toReturn; }}/*--- formatting done in "Sun Java Convention" style on 12-28-2000 ---*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -