add1bitqfun.java~

来自「Java遗传算法库」· JAVA~ 代码 · 共 50 行

JAVA~
50
字号
/*
 * Add1bitQFun.java
 *
 * Created on May 22, 2002, 5:32 PM
 */

package es.pj.circuits.experiment;

import es.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 = es.experiment.ExperimentLib.generateCompleteShuffledTest( nrInputs );
        //SampleData[] rv = es.experiment.ExperimentLib.generateCompleteTest( nrInputs );
        return rv;
    }
    public String toString()
    {
        return "One bit Adder Output Q Function";
    }
    public void setRandomSeed(long seed) {
        es.experiment.ExperimentLib.setRandomSeed( seed );
    }    
    
    public void setRandomSeed(long seed) {
    }
    
}

⌨️ 快捷键说明

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