singlestaticfaultmodel.java

来自「Java遗传算法库」· Java 代码 · 共 55 行

JAVA
55
字号
/*
 * SingleStaticFaultModel.java
 *
 * Created on 18 May 2002, 17:00
 */

package jaga.pj.circuits.fpgaft;

/** A fault model where a single fixed element can fail in various ways.  This
 * generates a fault sequence of length 1.
 *
 * @author  Michael Garvie
 * @version 
 */
public class SingleStaticFaultModel implements SingleFaultModel {

    protected int pos;
    protected int faultTypes = 2;
    protected int currFaultType = 0;
    
    /** Creates new SingleStaticFaultModel
     * @param ppos position of element that will fail.
    */
    public SingleStaticFaultModel(int ppos) {
        pos = ppos;
    }

    /** Creates new SingleStaticFaultModel
     * @param ppos position of element that will fail.
     * @param ftypes number of fault types to generate.  These are as defined in FTLib.
    */
    public SingleStaticFaultModel(int ppos,int ftypes) {
        pos = ppos;
        faultTypes = ftypes;
    }
    
    /** Resets the sequence of faults
     */
    public void reset() {
        currFaultType = 0;
    }
    public boolean hasMoreElements() {
        return currFaultType < faultTypes;
    }
    public java.lang.Object nextElement() {
        return new java.awt.Point( pos, currFaultType++ );
    }
    public String toString()
    {
        String rv = "Single Static Fault Model with:";
        rv += "\n  Fault Pos = " + pos;
        rv += "\n  Fault Types = " + faultTypes;
        return rv;
    }
}

⌨️ 快捷键说明

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