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

📄 treefloorlist.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                              + "Inconsistent Start/Final TimeOrder!\n"                              + "TreeFloor is created with " + dobj_order +"\n"                              + "but iteratorOfLowestFloorShadows() is "                              + "invoked with " + itrOrder + ".");            return null;        }    }    public String toStubString()    {        StringBuffer rep = new StringBuffer();        for ( int idx = floors.length-1; idx >= 0; idx-- )             rep.append( floors[ idx ].toStubString() + "\n" );        return rep.toString();    }    public String toString()    {        StringBuffer rep = new StringBuffer();        for ( int idx = floors.length-1; idx >= 0; idx-- ) {             rep.append( "\n" + floors[ idx ].toStubString() + "\n" );             rep.append( floors[ idx ].toString() + "\n" );        }        return rep.toString();    }    public String toString( final TimeBoundingBox tframe )    {        Drawable.Order  dobj_order  = Drawable.INCRE_STARTTIME_ORDER;        boolean         isComposite = true;        boolean         isNestable  = true;        StringBuffer rep = new StringBuffer();        Iterator dobjs, sobjs;        int idx;        dobjs = this.iteratorOfRealDrawables( tframe, dobj_order,                                              isComposite, true );        for ( idx = 1; dobjs.hasNext(); idx++ )            rep.append( idx + ", " + dobjs.next() + "\n" );        dobjs = this.iteratorOfRealDrawables( tframe, dobj_order,                                              isComposite, false );        for ( ; dobjs.hasNext(); idx++ )            rep.append( idx + ", " + dobjs.next() + "\n" );        sobjs = this.iteratorOfLowestFloorShadows( tframe, dobj_order, true );        for ( idx = 1; sobjs.hasNext(); idx++ )            rep.append( idx + ", " + sobjs.next() + "\n" );        sobjs = this.iteratorOfLowestFloorShadows( tframe, dobj_order, false );        for ( ; sobjs.hasNext(); idx++ )            rep.append( idx + ", " + sobjs.next() + "\n" );        return rep.toString();    }    public String toFloorString( final TimeBoundingBox timeframe )    {        Drawable.Order  dobj_order  = Drawable.INCRE_STARTTIME_ORDER;        boolean         isComposite = true;        boolean         isNestable  = true;        StringBuffer rep = new StringBuffer();        Iterator dobjs;        for ( int flr = floors.length-1; flr >= 0; flr-- ) {            rep.append( "\n" + floors[ flr ].toStubString() + "\n" );            dobjs = floors[ flr ].iteratorOfDrawables( timeframe, dobj_order,                                                       isComposite,                                                       isNestable );            for ( int idx = 1; dobjs.hasNext(); idx++ )                 rep.append( "    " + idx + ", " + dobjs.next() + "\n" );        }        return rep.toString();    }    /*        ItrOfDrawables returns Drawables in specific Drawable.Order     */    private class ItrOfDrawables implements Iterator    {        /*           map_obj2itr is a backstore for Iterator of each floor.           The key of map_obj2itr is the current leading drawable            to be pulled from the Iterator.         */        private TreeMap      map_obj2itr;        private Drawable     this_floor_obj;        private Iterator     this_floor_itr;        private Drawable     next_floor_obj;        private double       next_floor_bordertime;        private boolean      isIncreTimeOrdered;        private boolean      isStartTimeOrdered;        public ItrOfDrawables( final TimeBoundingBox  tframe,                               final Drawable.Order   dobj_order,                                     boolean          isComposite,                                     boolean          isNestable,                                     boolean          withShadows )        {            isIncreTimeOrdered  = dobj_order.isIncreasingTimeOrdered();            isStartTimeOrdered  = dobj_order.isStartTimeOrdered();            // map_obj2itr has Drawables arranged in the given Drawable.Order.            map_obj2itr = new TreeMap( dobj_order );            for ( int idx = floors.length-1; idx >= lowest_depth; idx-- ) {                this_floor_itr = floors[ idx ].iteratorOfDrawables(                                               tframe, dobj_order,                                               isComposite, isNestable );                if ( this_floor_itr.hasNext() ) {                    this_floor_obj = (Drawable) this_floor_itr.next();                    map_obj2itr.put( this_floor_obj, this_floor_itr );                }            }            if ( withShadows ) {                this_floor_itr = floors[ lowest_depth ].iteratorOfShadows(                                                        tframe, dobj_order,                                                        isNestable );                if ( this_floor_itr.hasNext() ) {                    this_floor_obj = (Shadow) this_floor_itr.next();                    map_obj2itr.put( this_floor_obj, this_floor_itr );                }            }            try {                this_floor_obj  = (Drawable) map_obj2itr.firstKey();                this_floor_itr  = (Iterator)                                  map_obj2itr.remove( this_floor_obj );            } catch ( NoSuchElementException err ) {                // when map_obj2itr is empty, next_floor_obj is null                this_floor_obj  = null;                this_floor_itr  = null;                next_floor_obj  = null;                next_floor_bordertime = isIncreTimeOrdered ?                                        Double.POSITIVE_INFINITY :                                        Double.NEGATIVE_INFINITY;            }            // Initialize next_floor_starttime            try {                next_floor_obj  = (Drawable) map_obj2itr.firstKey();                next_floor_bordertime                = next_floor_obj.getBorderTime( isStartTimeOrdered );            } catch ( NoSuchElementException err ) {                // when map_obj2itr is empty, next_floor_obj is null                next_floor_obj  = null;                next_floor_bordertime = isIncreTimeOrdered ?                                        Double.POSITIVE_INFINITY :                                        Double.NEGATIVE_INFINITY;            }        }        public boolean hasNext()        {            return this_floor_obj != null;        }        public Object next()        {            Drawable     next_drawable;            Iterator     next_floor_itr;            boolean      isFore, isOK;            next_drawable  = this_floor_obj;            this_floor_obj = null;            try {                if ( this_floor_itr.hasNext() ) {                    this_floor_obj = (Drawable) this_floor_itr.next();                    isFore = next_floor_bordertime                           < this_floor_obj.getBorderTime( isStartTimeOrdered );                    isOK = isIncreTimeOrdered ? isFore : !isFore ;                    if ( isOK ) {                        /*                          pull next_floor_itr out from map_obj2itr                          deposit this_floor_itr back to map_obj2itr                          update next_floor_bordertime from map_obj2itr                        */                        next_floor_itr = (Iterator)                                         map_obj2itr.remove( next_floor_obj );                        map_obj2itr.put( this_floor_obj, this_floor_itr );                        this_floor_obj = next_floor_obj;                        this_floor_itr = next_floor_itr;                        next_floor_obj = (Drawable) map_obj2itr.firstKey();                        next_floor_bordertime                        = next_floor_obj.getBorderTime( isStartTimeOrdered );                    }                }                else {                    /*                      update this_floor_obj from next_floor_obj                      update next_floor_bordertime from map_obj2itr                    */                    this_floor_obj = next_floor_obj;                    if ( this_floor_obj != null ) {                        this_floor_itr = (Iterator)                                         map_obj2itr.remove( this_floor_obj );                        next_floor_obj = (Drawable) map_obj2itr.firstKey();                        next_floor_bordertime                        = next_floor_obj.getBorderTime( isStartTimeOrdered );                    }                }            } catch ( NoSuchElementException err ) {                // when map_obj2itr is empty, next_floor_obj is null                next_floor_obj     = null;                next_floor_bordertime = isIncreTimeOrdered ?                                        Double.POSITIVE_INFINITY :                                        Double.NEGATIVE_INFINITY;            }            return next_drawable;        }        public void remove() {}    }   // private class ItrOfDrawables}

⌨️ 快捷键说明

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