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

📄 inputlog.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        /*        System.err.println( "\n\t evtdefs : " );        Iterator evtdefs_itr = evtdefs.entrySet().iterator();        while ( evtdefs_itr.hasNext() )            System.err.println( evtdefs_itr.next() );        */        // Create various CLOG records as place holders for CLOG parser.        header    = new RecHeader();        staterec  = new RecDefState();        eventrec  = new RecDefEvent();        constrec  = new RecDefConst();        bare      = new RecBare();        cargo     = new RecCargo();        msg       = new RecMsg();        coll      = new RecColl();        comm      = new RecComm();        src       = new RecSrc();        tshift    = new RecTshift();        // Initialize argument list variable        arglist   = new Object[ 2 ];        // Initialize the total_bytesize read from the CLOG stream        total_bytesize = 0;        // Initialize the CLOG block-input-stream for peekNextKind()        blk_ins = InputLog.super.getBlockStream();    }    public boolean hasNext()    {        ObjMethod       evt_pairing, obj_meth1, obj_meth2;        CommProcThdID   commlineID;        int             bytes_read;        int             bare_etype, cargo_etype, msg_etype;        int             rectype;        int             idx;        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();                            idx  = ObjDef.getNextCategoryIndex();                            statedef = new ObjDef( idx, staterec,                                                   stateform, 1 );                            stateform.setCategory( statedef );                            evtdefs.put( statedef.start_evt,                                         stateform.getStartEventObjMethod() );                            evtdefs.put( statedef.final_evt,                                         stateform.getFinalEventObjMethod() );                        }                        else {  // i.e. obj_meth1 != null && obj_meth2 != null                            if ( obj_meth1.obj == obj_meth2.obj ) {                                stateform = ( Topo_State ) obj_meth1.obj;                                statedef = ( ObjDef ) stateform.getCategory();                                statedef.setName( staterec.name );                                statedef.setColor(                                 ColorNameMap.getColorAlpha( staterec.color ) );                                statedef.setInfoKeys( staterec.format );                            }                            else {                                System.err.println( "**** Error! "                                                  + obj_meth1.obj + "!="                                                  + obj_meth2.obj );                            }                        }                        dobjdef  = statedef;                        InputLog.this.next_avail_kindID = Kind.CATEGORY_ID;                        return true;                    case RecDefEvent.RECTYPE:                        bytes_read = eventrec.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        obj_meth1 = ( ObjMethod ) evtdefs.get( eventrec.etype );                        if ( obj_meth1 == null ) {                            eventform = new Topo_Event();                            idx  = ObjDef.getNextCategoryIndex();                            eventdef = new ObjDef( idx, eventrec,                                                   eventform, 1 );                            eventform.setCategory( eventdef );                            evtdefs.put( eventdef.start_evt,                                         eventform.getEventObjMethod() );                        }                        else { // i.e. obj_meth1 != null                            eventform = ( Topo_Event ) obj_meth1.obj;                            eventdef = ( ObjDef ) eventform.getCategory();                            eventdef.setName( eventrec.name );                            eventdef.setColor(                              ColorNameMap.getColorAlpha( eventrec.color ) );                            eventdef.setInfoKeys( eventrec.format );                        }                        dobjdef  = eventdef;                        InputLog.this.next_avail_kindID = Kind.CATEGORY_ID;                        return true;                    case RecDefConst.RECTYPE:                        bytes_read                        = constrec.skipBytesFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        break;                    case RecBare.RECTYPE:                        bytes_read = bare.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        bare_etype = bare.etype.intValue();                        if ( bare_etype != Const.AllType.UNDEF ) {                            evt_pairing = (ObjMethod) evtdefs.get( bare.etype );                            // arglist = new Object[] { header, bare=null };                            arglist[ 0 ] = header;                            arglist[ 1 ] = null;                            drawobj = null;                            try {                                drawobj = (Primitive) evt_pairing.method                                                     .invoke( evt_pairing.obj,                                                              arglist );                            } catch ( IllegalAccessException err ) {                                err.printStackTrace();                                System.err.println( "Offending RecBare = "                                                  + bare );                            // catching NoMatchingEventException                            } catch ( InvocationTargetException err ) {                                err.printStackTrace();                            } catch ( NullPointerException nullerr ) {                                nullerr.printStackTrace();                                System.err.println( "Offending RecHeader = "                                                  + header );                                System.err.println( "Offending RecBare = "                                                  + bare );                                System.exit(1);                            }                            if ( drawobj != null ) {                                cptIDmap.setCommProcThdIDUsed( drawobj );                                InputLog.this.next_avail_kindID                                = Kind.PRIMITIVE_ID;                                return true;                            }                        }                        break;                    case RecCargo.RECTYPE:                        bytes_read = cargo.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        cargo_etype = cargo.etype.intValue();                        if ( cargo_etype != Const.AllType.UNDEF ) {                            evt_pairing = (ObjMethod)                                          evtdefs.get( cargo.etype );                            // arglist = new Object[] { header, cargo };                            arglist[ 0 ] = header;                            arglist[ 1 ] = cargo;                            drawobj = null;                            try {                                drawobj = (Primitive) evt_pairing.method                                                     .invoke( evt_pairing.obj,                                                              arglist );                            } catch ( IllegalAccessException err ) {                                err.printStackTrace();                                System.err.println( "Offending RecCargo = "                                                  + cargo );                            // catching NoMatchingEventException                            } catch ( InvocationTargetException err ) {                                err.printStackTrace();                            } catch ( NullPointerException nullerr ) {                                nullerr.printStackTrace();                                System.err.println( "Offending RecHeader = "                                                  + header );                                System.err.println( "Offending RecCargo = "                                                  + cargo );                                System.exit(1);                            }                            if ( drawobj != null ) {                                cptIDmap.setCommProcThdIDUsed( drawobj );                                InputLog.this.next_avail_kindID                                = Kind.PRIMITIVE_ID;                                return true;                            }                        }                        break;                    case RecMsg.RECTYPE:                        bytes_read = msg.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        msg_etype = msg.etype.intValue();                        if ( msg_etype != Const.AllType.UNDEF ) {                            evt_pairing = (ObjMethod) evtdefs.get( msg.etype );                            // arglist = new Object[] { header, msg };                            arglist[ 0 ] = header;                            arglist[ 1 ] = msg;                            drawobj = null;                            try {                                drawobj = (Primitive) evt_pairing.method                                                     .invoke( evt_pairing.obj,                                                              arglist );                            } catch ( IllegalAccessException err ) {                                err.printStackTrace();                                System.err.println( "Offending RecMsg = "                                                  + msg );                            // catching NoMatchingEventException                            } catch ( InvocationTargetException err ) {                                err.printStackTrace();                            } catch ( NullPointerException nullerr ) {                                nullerr.printStackTrace();                                System.err.println( "Offending RecHeader = "                                                  + header );                                System.err.println( "Offending RecMsg = "                                                  + msg );                                System.exit(1);                            }                            if ( drawobj != null ) {                                cptIDmap.setCommProcThdIDUsed( drawobj );                                InputLog.this.next_avail_kindID                                = Kind.PRIMITIVE_ID;                                return true;                            }                        }                        break;                    case RecColl.RECTYPE:                        bytes_read = coll.skipBytesFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        break;                    case RecComm.RECTYPE:                        bytes_read = comm.readFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        cptIDmap.addComm( comm );                        break;                    case RecSrc.RECTYPE:                        bytes_read = src.skipBytesFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        break;                    case RecTshift.RECTYPE:                        bytes_read = tshift.skipBytesFromDataStream( blk_ins );                        total_bytesize += bytes_read;                        break;                    case logformat.clog2.Const.RecType.ENDBLOCK:                        blk_ins = InputLog.super.getBlockStream();                        // System.out.println( "End Of Block" );                        break;                    case logformat.clog2.Const.RecType.ENDLOG:                        blk_ins = null;                        // System.out.println( "End Of File" );                        break;                    default:                        System.err.println( "Unknown Record type = "                                          + rectype );                }   // endof switch ( rectype )            }   //  endof while ( rectype != (ENDBLOCK/ENDLOG) )        }   //  endof while ( getBlockStream() )        return false;    }    public Object next()    {        switch (InputLog.this.next_avail_kindID) {            case Kind.CATEGORY_ID:                topos.add( dobjdef.getTopology() );                return dobjdef;            case Kind.PRIMITIVE_ID:                return drawobj;            default:                return null;        }    }    public void remove() {}    public Category getArrowCategory()    {        topos.add( arrowdef.getTopology() );        return arrowdef;    }    public List getYCoordMapList()    {        cptIDmap.finish();        return cptIDmap.createYCoordMapList();    }    public long getTotalBytesRead()    {        return total_bytesize;    }    public long getNumberOfUnMatchedEvents()    {        Topology  topo;        int num_matched = 0;        Iterator topos_itr = topos.iterator();        while ( topos_itr.hasNext() ) {            topo = ( Topology ) topos_itr.next();            if ( topo instanceof TwoEventsMatching ) {                num_matched += ( (TwoEventsMatching) topo )                               .getPartialObjects().size();            }        }        return num_matched;    }}}   // End of InputLog class

⌨️ 快捷键说明

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