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

📄 singleusedfaultmodel.java~

📁 Java遗传算法库
💻 JAVA~
字号:
/* * SingleUsedFaultModel.java * * Created on 28 July 2003, 11:34 */package jaga.pj.circuits.fpgaft;import jaga.pj.circuits.SimulatorCircuit;import jaga.pj.circuits.CircuitsLib;import jaga.pj.circuits.SimulatorLogicElement;import java.util.Vector;/** Fault Model which iterates over the units used by this circuit. * * @author  mmg20 */public class SingleUsedFaultModel implements SingleFaultModel {        protected SimulatorCircuit circuit;    protected SingleFullFaultModel currentFaultModel;    protected int nrOutsToCheck = -1;    protected int reservedOutputs = 0;    protected int faultTypes = FTLib.DEFAULT_FAULT_TYPES;        public SingleUsedFaultModel( int faultTypes, SimulatorCircuit circuit, int nrOutsToCheck ) {        this( circuit, nrOutsToCheck );        this.faultTypes = faultTypes;    }        public SingleUsedFaultModel( SimulatorCircuit circuit, int nrOutsToCheck, int resQ ) {        this( circuit, nrOutsToCheck );        this.reservedOutputs = resQ;    }        /** Creates a new instance of SingleUsedFaultModel */    public SingleUsedFaultModel( SimulatorCircuit circuit, int nrOutsToCheck ) {        this.circuit = circuit;        this.nrOutsToCheck = nrOutsToCheck;    }    /** Creates a new instance of SingleUsedFaultModel */    public SingleUsedFaultModel( SimulatorCircuit circuit ) {        this.circuit = circuit;    }        public boolean hasMoreElements() {        return currentFaultModel.hasMoreElements();    }        public Object nextElement() {        return currentFaultModel.nextElement();    }        /** Resets the sequence of faults     */    public void reset() {        SimulatorLogicElement[] outs = circuit.getInOutEls()[ 1 ];        int outsToCheckNow;        if( nrOutsToCheck < 0 )        {            outsToCheckNow = outs.length;        }else        {            outsToCheckNow = nrOutsToCheck;        }        Vector used = CircuitsLib.addConnectedGates( outs, outsToCheckNow );        int nrUsed = used.size();        for( int rql = 0; rql < reservedOutputs; rql++ )        {            if( !used.contains( outs[ nrOutsToCheck + rql ] ) )            {                nrUsed++;            }        }        currentFaultModel = new SingleFullFaultModel( 0, nrUsed, faultTypes );    }        public String toString()    {       String rv = "Single Used Fault Model with:";       rv+="\n    Outputs to Check: " + this.nrOutsToCheck;       rv+="\n    Unchecked Outputs: " + this.reservedOutputs;       rv+="\n    Fault Types: " + this.faultTypes;       return rv;    }}

⌨️ 快捷键说明

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