singleusedfaultmodel.java~

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

JAVA~
89
字号
/* * 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 + =
减小字号Ctrl + -
显示快捷键?