?? orfunction.java~
字號:
package jaga.pj.circuits.experiment;
import jaga.BitSet;
import jaga.SampleData;
import jaga.experiment.ExperimentLib;
/**
*
* @author unknown
* @version
*/
public class OrFunction extends Object implements BooleanFunction {
/** Creates new OrFunction */
public OrFunction() {
}
/** 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 ] );
}
/** returns the amount of inputs needed to compute this function
*/
public int getNumOfInputs()
{
return 2;
}
/** returns a set of BitSets providing a good set of input samples
* to test this function. Test looks like: A B (DesQ)
* 1 0 (1)
* 0 0 (0)
* 0 1 (1)
* 0 0 (0)
* 1 1 (1)
*/
public SampleData[] getTestData()
{
int[] inputBitsA = { 0, 4 };
int[] inputBitsB = { 2, 4 };
int[][] bits = { inputBitsA, inputBitsB };
return ExperimentLib.bitsToSampleDatas( bits, 5 );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -