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

📄 add1bitqfun.java

📁 Java遗传算法库
💻 JAVA
字号:
/*
 * Add1bitQFun.java
 *
 * Created on May 22, 2002, 5:32 PM
 */

package jaga.pj.circuits.experiment;

import jaga.SampleData;

/**
 *
 * @author  Michael Garvie
 * @version 
 */
public class Add1bitQFun implements BooleanFunction {

    protected final int nrInputs = 3;
    
    /** 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 ] ) ^ inputs[ 2 ];
    }
    /** returns the amount of inputs needed to compute this function
     */
    public int getNumOfInputs() {
        return nrInputs;
    }
    /** returns a set of SampleDatas providing a good set of input samples
     * to test this function
     */
    public SampleData[] getTestData() {
        SampleData[] rv = jaga.experiment.ExperimentLib.generateCompleteShuffledTest( nrInputs );
        //SampleData[] rv = jaga.experiment.ExperimentLib.generateCompleteTest( nrInputs );
        return rv;
    }
    public String toString()
    {
        return "One bit Adder Output Q Function";
    }
    public void setRandomSeed(long seed) {
        jaga.experiment.ExperimentLib.setRandomSeed( seed );
    }    
    
}

⌨️ 快捷键说明

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