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

📄 ftlib.java

📁 Java遗传算法库
💻 JAVA
字号:
/*
 * FTLib.java
 *
 * Created on 18 May 2002, 16:45
 */

package jaga.pj.circuits.fpgaft;

import jaga.pj.circuits.SimulatorLogicElement;

import java.util.HashSet;
import java.util.ArrayList;
import java.util.Iterator;

/** Collection of constants and methods used by the fpgaft package.
 *
 * @author  Michael Garvie
 * @version 
 */
public abstract class FTLib extends Object {
    
    /** Fault Type: No Fault */
    public final static int NOFAULT = -1;
    /** Fault Type: Single Stuck At 0 */
    public final static int SSAV0 = 0;
    /** Fault Type: Single Stuck At 1 */
    public final static int SSAV1 = 1;
    
    public final static int DEFAULT_FAULT_TYPES = 2;

    public static SimulatorFaultyDelayLE[] getConnectedGatesInFeedForwardOrder( SimulatorLogicElement[][] inoutels )
    {
        SimulatorFaultyDelayLE[] rv;
        
        HashSet next = new HashSet();
        ArrayList order = new ArrayList();
        HashSet primaryInputs = new HashSet();
        
        //SimulatorLogicElement[][] inoutels = circuit.getInOutEls();
        
        for( int ql = 0; ql < inoutels[ 1 ].length; ql++ )
        {
            next.add( inoutels[ 1 ][ ql ] );
        }
        for( int il = 0; il < inoutels[ 0 ].length; il++ )
        {
            primaryInputs.add( inoutels[ 0 ][ il ] );
        }
        
        while( !next.isEmpty() )
        {
            HashSet nextNext = new HashSet();
            Iterator nextI = next.iterator();
            
            while( nextI.hasNext() )
            {
                SimulatorLogicElement currentNext = ( SimulatorLogicElement ) nextI.next();
                if( !primaryInputs.contains( currentNext ) )
                {
                    order.remove( currentNext );
                    order.add( currentNext );
                    SimulatorLogicElement[] inputs = currentNext.getInputs();
                    for( int il = 0; il < inputs.length; il++ )
                    {
                        nextNext.add( inputs[ il ] );
                    }
                }
            }
            next = nextNext;
        }
        
        rv = new SimulatorFaultyDelayLE[ order.size() ];
        for( int el = 0; el < rv.length; el++ )
        {
            rv[ el ] = ( SimulatorFaultyDelayLE )order.get( rv.length - el - 1 );
        }
        
        return rv;
    }
    
    
}

⌨️ 快捷键说明

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