Dtnsim. Java annotation abstract (learning nature, possible error/omission, red is ambiguous)

Source: Internet
Author: User

Public static final string batch_mode_flag = "-B ";

// Batch processing mode mark, final: final state, unchangeable

Public static final string range_delimeter = ":";

// Range separator, with a colon

Public static final string reset_method_name = "reset ";

// Reset method name

Private Static list <class <?> Resetlist = new arraylist <class <?> ();

// List of class names, reset during batch processing

System. Exit (-1 );

// Pause the Java VM

Java. util. locale. setdefault (Java. util. locale. US );

// Set the default language environment for the Java Virtual Machine instance: US (USA ).

// Method in Java. util whose parameter type is locale: Java. util. locale. setdefault

// The Field java. util. locale. Us in Java. util declared as locale (used to indicate useful constants of countries/regions)

If (ARGs. length> 0 ){

// And public static void main (string [] ARGs), so args. Length indicates the number of input parameters

If (ARGs [0]. Equals (batch_mode_flag )){
Batchmode = true;

// If the first input parameter is-B, the running mode is batch processing.

Int firstconfindex = 0;

// Related to the number of input parameters: the number is 1, and the value is 1; otherwise, the value is 2.

Int nrofruns [] = {0, 1 };

// Binary array

Nrofruns = parsenrofruns (ARGs [1]);

// Private Static int [] parsenrofruns (string Arg)

// The second parameter is a binary array.

Int guiindex = 0;

Guiindex = integer. parseint (ARGs [0]);

// The first parameter is in decimal format. The corresponding error is numberformatexception.

String conffiles [];

Conffiles = ARGs;

// Input all parameters into the record

Initsettings (conffiles, firstconfindex );

// Private Static void initsettings (string [] conffiles, int firstindex)

// Initialize the corresponding setting file

Long starttime = system. currenttimemillis ();

// The system generates a value for the current Millisecond Time to the variable.

Settings. setrunindex (I)/(guiindex );

// Set

Resetfornextrun ();

// Public static void registerforreset (string classname)

// Reset the next operation
New dtnsimtextui (). Start ();

// Start

String. Format ("%. 2f", duration)

// Convert the value of the variable duration to a value in the same format as "%. 2f"

System. Err. println ("caught at" + Er. getstacktrace () [0]);

// Output when debugging exception occurs

// Obtain the stack trace of the error point

Class <?> C = NULL;

// Class list

C = Class. forname (classname );

// Load the class in the brackets, similar to new, corresponding error: classnotfoundexception

C. getmethod (reset_method_name );

// Obtain the method in the brackets. The corresponding error is: nosuchmethodexception.

Resetlist. Add (C );

// Add a new class to the reset list

For (class <?> C: resetlist ){

// Retrieve the value in resetlist once and assign it to C

Method M = C. getmethod (reset_method_name );

M. Invoke (null );

// Method. invoke (owner, argS): execute this method. the parameters of the invoke method are the owner of the object that executes this method, and The args of the parameter array. It can be understood that the owner object contains the method with The args parameter. The returned value is an object and the return value of this method.

// If the value is null in the brackets, this method is ignored (but not omitted)

Catch (exception e ){

E. printstacktrace ();

// Print the error location and cause

Arg. Contains (range_delimeter)

// The input parameter contains the range separator.

Arg. substring (0, Arg. indexof (range_delimeter ))

// Intercept the part of the string between 0 and Arg. indexof

// Search for range_delimeter in a string (starting from 0)

Private Static void print (string txt ){

System. Out. println (txt );

// Print the text to the standard output


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.