slog_profile.java

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· Java 代码 · 共 75 行

JAVA
75
字号
import java.io.*;import java.util.*;public class SLOG_Profile implements Serializable{    private Vector    entries;  // Vector of SLOG_ProfileEntry    public SLOG_Profile()    {        entries  = new Vector( 0 );    }    public Enumeration GetEnumerationOfEntries()    {        return entries.elements();    }    public SLOG_Profile( RandomAccessFile file_stm )    throws IOException, NoSuchElementException    {        entries  = new Vector();        this.ReadFromRandomFile( file_stm );    }    public SLOG_Profile( RandomAccessFile file_stm, long fileloc )    throws IOException, NoSuchElementException    {        file_stm.seek( fileloc );        entries  = new Vector();        this.ReadFromRandomFile( file_stm );    }    public void ReadFromRandomFile( RandomAccessFile file_stm )    throws IOException, NoSuchElementException    {        int Nbytes_read = 0;        int Nentries    = file_stm.readInt(); // No. of entries in SLOG_Profile        for ( int ii = 0; ii < Nentries; ii++ ) {            String line = file_stm.readLine();            Nbytes_read += line.length() + 1;            if ( line.charAt( 0 ) != '#' ) {                SLOG_ProfileEntry entry = new SLOG_ProfileEntry( line );                entries.addElement( entry );                // System.out.println( entry );                entry = null;            }            line = null;        }    }    public String GetColor( final short in_intvltype )    {        SLOG_ProfileEntry entry;        Enumeration enum = entries.elements();        while ( enum.hasMoreElements() ) {            entry = ( SLOG_ProfileEntry ) enum.nextElement();            if ( entry.intvltype == in_intvltype )                return entry.color;        }        return null;    }    public String toString()    {        StringBuffer representation = new StringBuffer( "SLOG_Profile :\n" );        Enumeration enum = entries.elements();        while ( enum.hasMoreElements() )             representation.append( enum.nextElement() + "\n" );        return representation.toString();    }}

⌨️ 快捷键说明

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