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

📄 navigator.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                        System.err.println( "Unrecognized option, "                                          + argv[ idx ] + ", at "                                          + indexOrderStr( idx+1 )                                          + " input argument" );                        System.err.flush();                        return null;                    }                }   // if ( argv[ idx ].indexOf( '=' ) != -1 )                else {   // if ( argv[ idx ].indexOf( '=' ) == -1 )                    if ( argv[ idx ].startsWith( "+" ) ) {                        double zoom_ctr = ( timeframe_old.getEarliestTime()                                          + timeframe_old.getLatestTime() )                                          / 2.0d;                        double ctr_span = timeframe_old.getDuration() / 2.0d                                        / zoom_ftr;                        timeframe.setEarliestTime( zoom_ctr - ctr_span );                        timeframe.setLatestTime( zoom_ctr + ctr_span );                        err_msg.append( "\n zoom_in_center = " + zoom_ctr );                        idx++;                    }                    else if ( argv[ idx ].startsWith( "-" ) ) {                        double zoom_ctr = ( timeframe_old.getEarliestTime()                                          + timeframe_old.getLatestTime() )                                          / 2.0d;                        double ctr_span = timeframe_old.getDuration() / 2.0d                                        * zoom_ftr;                        timeframe.setEarliestTime( zoom_ctr - ctr_span );                        timeframe.setLatestTime( zoom_ctr + ctr_span );                        err_msg.append( "\n zoom_out_center = " + zoom_ctr );                        idx++;                    }                    else if ( argv[ idx ].startsWith( ">" ) ) {                        double Nwins = 1.0d;                        double win_span = timeframe_old.getDuration();                        timeframe.setEarliestTime( Nwins * win_span                                 + timeframe_old.getEarliestTime() );                        timeframe.setLatestTime( win_span                                 + timeframe.getEarliestTime() );                        err_msg.append( "\n scroll_forward = " + Nwins                                      + " frames" );                        idx++;                    }                    else if ( argv[ idx ].startsWith( "<" ) ) {                        double Nwins = 1.0d;                        double win_span = timeframe_old.getDuration();                        timeframe.setEarliestTime( - Nwins * win_span                                 + timeframe_old.getEarliestTime() );                        timeframe.setLatestTime( win_span                                 + timeframe.getEarliestTime() );                        err_msg.append( "\n scroll_forward = " + Nwins                                      + " frames" );                        idx++;                    }                    else if ( argv[ idx ].startsWith( "s" ) ) {                        printAll = false;                        changedPrintAll = true;                        err_msg.append( "\n print_details = " + printAll );                        idx++;                    }                    else if ( argv[ idx ].startsWith( "a" ) ) {                        printAll = true;                        changedPrintAll = true;                        err_msg.append( "\n print_details = " + printAll );                        idx++;                    }                    else {                        System.err.println( "Unrecognized option, "                                          + argv[ idx ] + ", at "                                          + indexOrderStr( idx+1 )                                          + " input argument" );                        System.err.flush();                        return null;                    }                }            }        } catch ( NumberFormatException numerr ) {            if ( err_msg.length() > 0 )                System.err.println( err_msg.toString() );            String idx_order_str = indexOrderStr( idx );            System.err.println( "Error occurs after option "                              + argv[ idx-1 ] + ", " + indexOrderStr( idx )                              + " input argument.  It needs a number." );            // System.err.println( help_msg );            numerr.printStackTrace();            return null;        }        //  Checking if the input value is valid        if ( depth >= 0 && depth <= depth_max )            return timeframe;        else {            System.err.println( "Invalid TimeWindow!" );            return null;        }    }        private static TimeBoundingBox getTimeWindowFromStdin(                                   final TimeBoundingBox timeframe_old )    {        TimeBoundingBox  timeframe;        String[]         input_args;        StringTokenizer  tokens;        do {            System.out.print( "Enter TimeWindow: " + format_msg + " ?\n" );            String  input_str;            try {                input_str = sys_bufrdr.readLine();            } catch ( java.io.IOException ioerr ) {                ioerr.printStackTrace();                return null;            }            tokens      = new StringTokenizer( input_str );            input_args  = new String[ tokens.countTokens() ];            for ( int idx = 0; tokens.hasMoreTokens(); idx++ )                input_args[ idx ] = tokens.nextToken();            } while (    ( timeframe = getTimeWindow( timeframe_old, input_args ) )                  == null );        return timeframe;    }    private static String stub_msg  = "Format of the TreeNodeStub: \n  " +"{ TreeNodeID, TreeNodeEndtimes, BlockSize + FilePointer, NumOfDrawables .. }\n"                                    + "\t TreeNodeID : ID( d, i )           "                                    + " d is the depth of the TreeNode.\n"                                    + "\t                                   "                                    + " d = 0, for LeafNode; \n"                                    + "\t                                   "                                    + " d = d_max, for RootNode.\n"                                    + "\t                                   "                                    + " i is TreeNode's index(same depth).\n"                                    + "\t TreeNodeEndtimes                  "                                    + " TreeNode's Start and End times.\n";    private static String help_msg  = "Usage: java slog2.input.Navigator "                                    + "[options] slog2_filename.\n"                                    + "Options: \n"                                    + "\t [-h|-help|--help]                 "                                    + " Display this message.\n"                                    + "\t [-s|-stub]                        "                                    + " Print TreeNode's stub (Default).\n"                                    + "\t [-a|-all]                         "                                    + " Print TreeNode's drawable content.\n"                                    + "\t [-v|-verbose]                     "                                    + " Print detailed diagnostic message.\n"                                    + "\n" + input_msg                                    + "\n" + stub_msg;    private static void parseCmdLineArgs( String argv[] )    {        String        arg_str;        StringBuffer  err_msg = new StringBuffer();        int           idx = 0;            while ( idx < argv.length ) {                if ( argv[ idx ].startsWith( "-" ) ) {                    if (  argv[ idx ].equals( "-h" )                       || argv[ idx ].equals( "-help" )                       || argv[ idx ].equals( "--help" ) ) {                        System.out.println( help_msg );                        System.out.flush();                        System.exit( 0 );                    }                    else if (  argv[ idx ].equals( "-s" )                            || argv[ idx ].equals( "-stub" ) ) {                         printAll = false;                         idx++;                    }                    else if (  argv[ idx ].equals( "-a" )                            || argv[ idx ].equals( "-all" ) ) {                         printAll = true;                         idx++;                    }                    else if (  argv[ idx ].equals( "-v" )                            || argv[ idx ].equals( "-verbose" ) ) {                         isVerbose = true;                         idx++;                    }                    else {                        System.err.println( "Unrecognized option, "                                          + argv[ idx ] + ", at "                                          + indexOrderStr( idx+1 )                                          + " command line argument" );                        System.out.flush();                        System.exit( 1 );                    }                }                else {                    in_filename   = argv[ idx ];                    idx++;                }            }        if ( in_filename == null ) {            System.err.println( "The Program needs a SLOG-2 filename as "                              + "a command line argument." );            System.err.println( help_msg );            System.exit( 1 );        }    }    private static String indexOrderStr( int idx )    {        switch (idx) {            case 1  : return Integer.toString( idx ) + "st";            case 2  : return Integer.toString( idx ) + "nd";            case 3  : return Integer.toString( idx ) + "rd";            default : return Integer.toString( idx ) + "th";        }    }}

⌨️ 快捷键说明

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