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

📄 shadow.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                                          double dobj_time, long dobj_Nobjs )    {        return ( ( sobj_time * sobj_Nobjs + dobj_time * dobj_Nobjs )               / ( sobj_Nobjs + dobj_Nobjs ) );    }    public int getByteSize()    {        if ( twgt_ary != null )  // For SLOG-2 Input            return super.getByteSize() + BYTESIZE                 + CategoryWeight.BYTESIZE * twgt_ary.length;        else if ( map_type2twgt != null )  // For SLOG-2 Output            return super.getByteSize() + BYTESIZE                 + CategoryWeight.BYTESIZE * map_type2twgt.size();        else // if ( map_type2dobjs != null )  // For SLOG-2 Output            return super.getByteSize() + BYTESIZE                 + CategoryWeight.BYTESIZE * map_type2dobjs.size();    }    // For SLOG-2 Input API, used by BufForShadows.readObject()    public boolean resolveCategory( Map categorymap )    {        boolean  allOK = super.resolveCategory( categorymap );        if ( twgt_ary != null )            for ( int idx = twgt_ary.length-1; idx >= 0; idx-- )                allOK = allOK && twgt_ary[ idx ].resolveCategory( categorymap );        return allOK;    }    // For SLOG-2 Input API i.e. Jumpshot    public CategoryWeight[] arrayOfCategoryWeights()    {        return twgt_ary;    }    // For SLOG-2 Input API i.e. Jumpshot    public Category getSelectedSubCategory()    {        return selected_subtype;    }    // For SLOG-2 Input API i.e. Jumpshot    public void clearSelectedSubCategory()    {        selected_subtype = null;    }    // For SLOG-2 Input API i.e. Jumpshot    public void setTotalPixelHeight( int new_height )    {        total_pixel_height  = new_height;    }    // For SLOG-2 Input API i.e. Jumpshot    public int  getTotalPixelHeight()    {        return total_pixel_height;    }    public long getNumOfRealObjects()    {        return num_real_objs;    }    public void summarizeCategories( double buf4sobjs_duration )    {        CategoryWeight   this_twgt;        CategorySummary  type_smy;        Iterator         this_twgts_itr;        float            duration_ratio;        duration_ratio = (float) ( super.getDuration() / buf4sobjs_duration );        this_twgts_itr = this.map_type2twgt.values().iterator();        while ( this_twgts_itr.hasNext() ) {            this_twgt = (CategoryWeight) this_twgts_itr.next();             type_smy  = this_twgt.getCategory().getSummary();            type_smy.addDrawableCount( this_twgt.getDrawableCount() );            type_smy.addAllRatios( this_twgt, duration_ratio );        }    }    public void writeObject( MixedDataOutput outs )    throws java.io.IOException    {        super.writeObject( outs );        TimeBoundingBox.writeObject( this, outs );        outs.writeLong( num_real_objs );     // System.err.println( "\touts.size=" + ((DataOutputStream)outs).size() );        if ( this.map_type2twgt.size() > 0 ) {            Object[]  twgts;            twgts = this.map_type2twgt.values().toArray();            Arrays.sort( twgts, CategoryWeight.INCL_RATIO_ORDER );            int  twgts_length = twgts.length;            outs.writeInt( twgts_length );            for ( int idx = 0; idx < twgts_length; idx++ )                ((CategoryWeight) twgts[ idx ]).writeObject( outs );        }        else            outs.writeInt( 0 );    }    public Shadow( MixedDataInput ins )    throws java.io.IOException    {        super();        this.readObject( ins );    }    public void readObject( MixedDataInput ins )    throws java.io.IOException    {        super.readObject( ins );        TimeBoundingBox.readObject( this, ins );        num_real_objs = ins.readLong();        CategoryWeight  twgt;        int             Nentries, ientry;        Nentries   = ins.readInt();        if ( Nentries > 0 ) {            twgt_ary = new CategoryWeight[ Nentries ];            for ( ientry = 0; ientry < Nentries; ientry++ )                twgt_ary[ ientry ] = new CategoryWeight( ins );        }        else            twgt_ary = null;    }    public String toString()    {        StringBuffer rep = new StringBuffer( super.toString() );        rep.append( " Nrobjs=" + num_real_objs );        CategoryWeight[]  twgts = null;        if ( twgt_ary != null )            twgts = twgt_ary;        else            if ( map_type2twgt != null )                twgts = (CategoryWeight[]) map_type2twgt.values().toArray();        if ( twgts != null ) {            int  twgts_length = twgts.length;            for ( int idx = 0; idx < twgts_length; idx++ )                rep.append( "\n" + twgts[ idx ] );        }        return rep.toString();    }    private static Insets   Empty_Border   = new Insets( 0, 2, 0, 2 );    public static void setStateInsetsDimension( int width, int height )    {        Empty_Border = new Insets( height, width, height, width );    }    // Implementation of abstract methods.    /*         0.0f < nesting_ftr <= 1.0f    */    public  int  drawState( Graphics2D g, CoordPixelXform coord_xform,                            Map map_line2row, DrawnBoxSet drawn_boxes,                            ColorAlpha color )    {        // Coord  start_vtx, final_vtx;        // start_vtx = this.getStartVertex();        // final_vtx = this.getFinalVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        int    rowID;        float  nesting_ftr;        rowID       = super.getRowID();        nesting_ftr = super.getNestingFactor();        // System.out.println( "\t" + this + " nestftr=" + nesting_ftr );        float  rStart, rFinal;        rStart = (float) rowID - nesting_ftr / 2.0f;        rFinal = rStart + nesting_ftr;        return PreviewState.draw( g, color,                                  this, Empty_Border, coord_xform,                                  drawn_boxes.getLastStatePos( rowID ),                                  tStart, rStart, tFinal, rFinal );        // return State.draw( g, color, Empty_Border, coord_xform,        //                    drawn_boxes.getLastStatePos( rowID ),        //                    tStart, rStart, tFinal, rFinal );    }    private static long     Arrow_Log_Base = 10;    private static Stroke[] Line_Strokes;    static {         Line_Strokes = new Stroke[ 10 ];         for ( int idx = Line_Strokes.length-1; idx >=0 ; idx-- )             Line_Strokes[ idx ] = new BasicStroke( (float) (idx+1) );    }    public static void setBaseOfLogOfObjectNumToArrowWidth( int new_log_base )    {        Arrow_Log_Base = (long) new_log_base;    }    private static  Stroke  getArrowStroke( long  inum )    {        int  idx;        for ( idx = 0; idx < Line_Strokes.length; idx++ ) {             inum /= Arrow_Log_Base;             if ( inum == 0 )                 break;        }        if ( idx < Line_Strokes.length )            return Line_Strokes[ idx ];        else            return Line_Strokes[ Line_Strokes.length-1 ];    }    public  int  drawArrow( Graphics2D g, CoordPixelXform coord_xform,                            Map map_line2row, DrawnBoxSet drawn_boxes,                            ColorAlpha color )    {        Coord  start_vtx, final_vtx;        start_vtx = this.getStartVertex();        final_vtx = this.getFinalVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        int    iStart, iFinal;        iStart = ( (Integer)                   map_line2row.get( new Integer(start_vtx.lineID) )                 ).intValue();        iFinal = ( (Integer)                   map_line2row.get( new Integer(final_vtx.lineID) )                 ).intValue();        Stroke  arrow_stroke = getArrowStroke( num_real_objs );        return Line.draw( g, color, arrow_stroke, coord_xform,                          drawn_boxes.getLastArrowPos( iStart, iFinal ),                          tStart, (float) iStart, tFinal, (float) iFinal );    }    public  int  drawEvent( Graphics2D g, CoordPixelXform coord_xform,                            Map map_line2row, DrawnBoxSet drawn_boxes,                            ColorAlpha color )    {        Coord  vtx;        vtx = this.getStartVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        double tPoint;        tPoint = vtx.time;        int    rowID;        float  rPeak, rStart, rFinal;        rowID  = ( (Integer)                   map_line2row.get( new Integer(vtx.lineID) )                 ).intValue();        // rPeak  = (float) rowID + NestingStacks.getHalfInitialNestingHeight();        rPeak  = (float) rowID - 0.25f;        rStart = (float) rowID - 0.5f;        rFinal = rStart + 1.0f;        return PreviewEvent.draw( g, color, null, coord_xform,                                 drawn_boxes.getLastEventPos( rowID ),                                 tStart, rStart, tFinal, rFinal,                                 tPoint, rPeak );    }    /*         0.0f < nesting_ftr <= 1.0f    */    public  boolean isPixelInState( CoordPixelXform coord_xform,                                    Map map_line2row, Point pix_pt )    {        Coord  start_vtx, final_vtx;        start_vtx = this.getStartVertex();        final_vtx = this.getFinalVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        int    rowID;        float  nesting_ftr;        /*        rowID  = ( (Integer)                   map_line2row.get( new Integer(start_vtx.lineID) )                 ).intValue();        */        rowID       = super.getRowID();        /* assume NestingFactor has been calculated */        nesting_ftr = super.getNestingFactor();        // System.out.println( "\t" + this + " nestftr=" + nesting_ftr );        float  rStart, rFinal;        rStart = (float) rowID - nesting_ftr / 2.0f;        rFinal = rStart + nesting_ftr;        selected_subtype = PreviewState.containsPixel( this, Empty_Border,                                                       coord_xform, pix_pt,                                                       tStart, rStart,                                                       tFinal, rFinal );        return selected_subtype != null;    }    //  assume this Shadow overlaps with coord_xform.TimeBoundingBox    public  boolean isPixelOnArrow( CoordPixelXform coord_xform,                                    Map map_line2row, Point pix_pt )    {        Coord  start_vtx, final_vtx;        start_vtx = this.getStartVertex();        final_vtx = this.getFinalVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        float  rStart, rFinal;        rStart = ( (Integer)                   map_line2row.get( new Integer(start_vtx.lineID) )                 ).floatValue();        rFinal = ( (Integer)                   map_line2row.get( new Integer(final_vtx.lineID) )                 ).floatValue();        return Line.containsPixel( coord_xform, pix_pt,                                   tStart, rStart, tFinal, rFinal );    }    public  boolean isPixelAtEvent( CoordPixelXform coord_xform,                                    Map map_line2row, Point pix_pt )    {        Coord  vtx;        vtx = this.getStartVertex();        double tStart, tFinal;        tStart = super.getEarliestTime();    /* different from Primitive */        tFinal = super.getLatestTime();      /* different from Primitive */        double tPoint;        tPoint = vtx.time;        int    rowID;        float  rPeak, rStart, rFinal;        rowID  = ( (Integer)                   map_line2row.get( new Integer(vtx.lineID) )                 ).intValue();        // rPeak  = (float) rowID + NestingStacks.getHalfInitialNestingHeight();        rPeak  = (float) rowID - 0.25f;        rStart = (float) rowID - 0.5f;        rFinal = rStart + 1.0f;        return PreviewEvent.containsPixel( coord_xform, pix_pt,                                           tStart, rStart, tFinal, rFinal,                                           tPoint, rPeak );    }    public boolean containSearchable()    {        CategoryWeight  twgt;        int             idx;        for ( idx = twgt_ary.length-1; idx >= 0; idx-- ) {             twgt = twgt_ary[ idx ];             if ( twgt.getCategory().isVisiblySearchable() )                 return true;        }        return false;    }}

⌨️ 快捷键说明

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