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

📄 print_1pass.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* *  (C) 2001 by Argonne National Laboratory *      See COPYRIGHT in top-level directory. *//* *  @author  Anthony Chan */package logformat.clog2TOdrawable;import java.util.List;import java.util.ArrayList;import java.util.Map;import java.util.HashMap;import java.util.Iterator;import java.util.Date;import java.lang.reflect.*;import java.io.*;import base.drawable.Primitive;import logformat.clog2.*;// This program prints the CLOG file format.public class Print_1pass{    private static String                   filename;    private static logformat.clog2.InputLog clog_ins;    private static MixedDataInputStream     blk_ins;    private static int                      total_bytesize;    private static int                      bytes_read;    private static int                      rectype;    private static Map                      evtdefs;    private static List                     objdefs;    private static ObjDef                   objdef;    private static RecHeader                header    = new RecHeader();    private static RecDefState              staterec  = new RecDefState();    private static RecDefEvent              eventrec  = new RecDefEvent();    private static RecDefConst              constrec  = new RecDefConst();    private static RecBare                  bare      = new RecBare();    private static RecCargo                 cargo     = new RecCargo();    private static RecMsg                   msg       = new RecMsg();    private static RecColl                  coll      = new RecColl();    private static RecComm                  comm      = new RecComm();    private static RecSrc                   src       = new RecSrc();    private static RecTshift                tshift    = new RecTshift();    private static Topo_Arrow               arrowform;    private static Topo_State               stateform;    private static ObjMethod                obj_fn;    public static final void createDefs()    {        Class           arrow_class, state_class;        Method          start_fn = null, final_fn = null;        Class[]         typelist;        objdefs   = new ArrayList();        evtdefs   = new HashMap();        ColorNameMap.initMapFromRGBtxt( "jumpshot.colors" );        ObjDef.setFirstNextCategoryIndex( 0 );        int def_idx;        arrowform = new Topo_Arrow( );        def_idx = ObjDef.getNextCategoryIndex();        objdef = new ObjDef( def_idx, new RecDefMsg(), arrowform, 3 );        arrowform.setCategory( objdef );        objdefs.add( objdef.getIndex(), objdef );        arrow_class = arrowform.getClass();        typelist = new Class[] { RecHeader.class, RecMsg.class };        try {            start_fn = arrow_class.getMethod( "matchStartEvent", typelist );            final_fn = arrow_class.getMethod( "matchFinalEvent", typelist );        } catch ( NoSuchMethodException err ) {             err.printStackTrace();             System.exit( 1 );        }        obj_fn = new ObjMethod();        obj_fn.obj = arrowform;        obj_fn.method = start_fn;        evtdefs.put( objdef.start_evt, obj_fn );        obj_fn = new ObjMethod();        obj_fn.obj = arrowform;        obj_fn.method = final_fn;        evtdefs.put( objdef.final_evt, obj_fn );        typelist = new Class[] { RecHeader.class, RecBare.class };        List defs = clog_ins.getKnownUndefinedInitedStateDefs();        defs.addAll( clog_ins.getUserUndefinedInitedStateDefs() );        Iterator itr = defs.iterator();        while ( itr.hasNext() ) {            staterec = ( RecDefState ) itr.next();            stateform = new Topo_State();            def_idx = ObjDef.getNextCategoryIndex();            objdef = new ObjDef( def_idx, staterec, stateform, 1 );            stateform.setCategory( objdef );            objdefs.add( objdef.getIndex(), objdef );            state_class = stateform.getClass();            try {                start_fn = state_class.getMethod( "matchStartEvent",                                                  typelist );                final_fn = state_class.getMethod( "matchFinalEvent",                                                  typelist );            } catch ( NoSuchMethodException err ) {                err.printStackTrace();                System.exit( 1 );            }            obj_fn = new ObjMethod();            obj_fn.obj = stateform;            obj_fn.method = start_fn;            evtdefs.put( objdef.start_evt, obj_fn );            obj_fn = new ObjMethod();            obj_fn.obj = stateform;            obj_fn.method = final_fn;            evtdefs.put( objdef.final_evt, obj_fn );        }        /*        System.err.println( "\n\t objdefs : " );        Iterator objdefs_itr = objdefs.iterator();        while ( objdefs_itr.hasNext() ) {            objdef = (obj_def) objdefs_itr.next();            System.err.println( objdef.toString() );        }        System.err.println( "\n\t evtdefs : " );        Iterator evtdefs_itr = evtdefs.entrySet().iterator();        while ( evtdefs_itr.hasNext() )            System.err.println( evtdefs_itr.next() );        */    }    public static final void createPrimitives()    {        Class           state_class;        Method          start_fn = null, final_fn = null;        Class[]         typelist;        Object[]        arglist;        ObjMethod       evt_pairing, obj_meth1, obj_meth2;        Primitive       drawobj;        int             def_idx;        int             bare_etype, cargo_etype, msg_etype;        int             Nmatched = 0;        typelist  = new Class[] { RecHeader.class, RecBare.class };        arglist   = new Object[ 2 ];        System.out.println( "\n\t Completed Objects : " );        total_bytesize = 0;        blk_ins = clog_ins.getBlockStream();        while ( blk_ins != null ) {            rectype = logformat.clog2.Const.AllType.UNDEF;            while (  rectype != logformat.clog2.Const.RecType.ENDBLOCK                  && rectype != logformat.clog2.Const.RecType.ENDLOG ) {                bytes_read = header.readFromDataStream( blk_ins );                total_bytesize += bytes_read;                    rectype = header.getRecType();                switch ( rectype ) {                    case RecDefState.RECTYPE:                        bytes_read = staterec.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        obj_meth1 = (ObjMethod)                                    evtdefs.get( staterec.startetype );                        obj_meth2 = (ObjMethod)                                    evtdefs.get( staterec.finaletype );                        if ( obj_meth1 == null || obj_meth2 == null ) {                            stateform = new Topo_State();                            def_idx = ObjDef.getNextCategoryIndex();                            objdef = new ObjDef( def_idx, staterec,                                                 stateform, 1 );                            stateform.setCategory( objdef );                            objdefs.add( objdef.getIndex(), objdef );                            state_class = stateform.getClass();                            try {                                start_fn = state_class .getMethod(                                           "matchStartEvent", typelist );                                final_fn = state_class.getMethod(                                           "matchFinalEvent", typelist );                            } catch ( NoSuchMethodException err ) {                                err.printStackTrace();                                System.exit( 1 );                            }                            obj_fn = new ObjMethod();                            obj_fn.obj = stateform;                            obj_fn.method = start_fn;                            evtdefs.put( objdef.start_evt, obj_fn );                            obj_fn = new ObjMethod();                            obj_fn.obj = stateform;                            obj_fn.method = final_fn;                            evtdefs.put( objdef.final_evt, obj_fn );                        }                        else {  // i.e. obj_meth1 != null && obj_meth2 != null                             if ( obj_meth1.obj == obj_meth2.obj ) {                                stateform = ( Topo_State ) obj_meth1.obj;                                objdef = ( ObjDef ) stateform.getCategory();                                objdef.setName( staterec.name );                                objdef.setColor(                                 ColorNameMap.getColorAlpha( staterec.color ) );                            }

⌨️ 快捷键说明

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