📄 singlefullfaultmodel.java~
字号:
/*
* SingleStaticFaultModel.java
*
* Created on 18 May 2002, 17:00
*/
package jaga.pj.circuits.fpgaft;
/** A fault model where a sequence of all elements within a range are failed in
* several ways.
* <p> The default values for: <ul>
* <li> Length of sequence: one. </li>
* <li> Number of fault types: two </li>
* <li> Bottom element index to pick from: zero </li>
* </ul>
*
* @author Michael Garvie
* @version
*/
public class SingleFullFaultModel implements SingleFaultModel {
protected int floorPos = 0;
protected int roofPos;
protected int faultTypes = 2;
protected int currFaultType = 0;
protected int currPos = 0;
/** Creates new SingleFullFaultModel.
* @param proofPos position of (EXCLUSIVE) highest element number of sequence.
*/
public SingleFullFaultModel( int proofPos ) {
roofPos = proofPos;
}
/** Creates new SingleFullFaultModel.
* @param pfloorPos position of (INCLUSIVE) lowest element number of sequence.
* @param proofPos position of (EXCLUSIVE) highest element number of sequence.
* @param ftypes number of fault types to generate. These are as defined in FTLib.
*/
public SingleFullFaultModel( int pfloorPos, int proofPos ) {
roofPos = proofPos;
currPos = floorPos = pfloorPos;
}
/** Creates new SingleFullFaultModel.
* @param pfloorPos position of (INCLUSIVE) lowest element number of sequence.
* @param proofPos position of (EXCLUSIVE) highest element number of sequence.
* @param ftypes number of fault types to generate. These are as defined in FTLib.
*/
public SingleFullFaultModel( int pfloorPos, int proofPos, int ftypes ) {
roofPos = proofPos;
faultTypes = ftypes;
currPos = floorPos = pfloorPos;
}
/** Resets the sequence of faults
*/
public void reset() {
currFaultType = 0;
currPos = floorPos;
}
public boolean hasMoreElements() {
return ( currPos < roofPos );
}
public java.lang.Object nextElement() {
java.awt.Point rv = new java.awt.Point( currPos, currFaultType++ );
if( currFaultType == faultTypes )
{
currFaultType = 0;
currPos++;
}
return rv;
}
public String toString()
{
String rv = "Single Full Fault Model with:";
rv += "\n Floor Pos = " + floorPos;
rv += "\n Roof Pos = " + roofPos;
rv += "\n Fault Types = " + faultTypes;
return rv;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -