⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 andfunction.java

📁 Java遗传算法库
💻 JAVA
字号:
package jaga.pj.circuits.experiment;

import jaga.BitSet;
import jaga.SampleData;
import jaga.experiment.ExperimentLib;


/**
 *
 * @author  unknown
 * @version 
 */
public class AndFunction implements BooleanFunction {

    /** Creates new AndFunction */
    public AndFunction() {
    }

    /** returns the result of this function given the inputs in the array
     * @param inputs what values the inputs to the function have
     */
    public boolean getResult(boolean[] inputs)
    {
        return ( inputs[ 0 ] && inputs[ 1 ] );
    }
    
    public int getNumOfInputs() {
        return 2;
    }
    
    /** returns a set of BitSets providing a good set of input samples
     * to test this function.  This test looks like: (A B (DesQ))
     * 0 1 (0)
     * 1 1 (1)
     * 1 0 (0)
     * 0 0 (0)
     * 1 1 (1)
     */
    public SampleData[] getTestData()
    {
        int[] inputBitsA = { 1, 2, 4 };
        int[] inputBitsB = { 0, 1, 4 };
        int[][] bits = { inputBitsA, inputBitsB };
        return ExperimentLib.bitsToSampleDatas( bits, 5 );
    }
    public void setRandomSeed(long seed) {
        jaga.experiment.ExperimentLib.setRandomSeed( seed );
    }        
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -