📄 burst.java
字号:
}
}
}
}
void printHelp()
{
System.out.println("Usage:\n");
System.out.println("dynamicburst -in <inputfile> -out <outputfile> -bin -eps -trans <gamma> -rel a b c [-help]\n");
System.out.println("<inputfile> : Input file formatted as required by this program.\n");
System.out.println("<outputfile>: File to which burst output will be written.\n");
System.out.println("gamma : State transition parameter gamma as used in paper.\n");
System.out.println("a : Ratio of rate of second state to rate of base state.\n");
System.out.println("b : Ratio of rate of each subsequent state to rate of previous state.\n");
System.out.println("c : Number of states in automaton minus 1.\n");
System.out.println("-help : Prints this help.\n");
}
public Burst(String args[])
{
entry = new int[1000];
fdate = new char[300];
first_of_month = new int[15];
leap_first_of_month = new int[15];
month_name = new char[15][10];
day_name = new char[15][10];
spike_start_date = new char[300];
spike_end_date = new char[300];
f_rate = new double[20];
o_rate = new double[20];
left_barrier = new int[20];
FOCUS_WORD = new char[50];
bin_base = new int[0x186a0];
out = new double[0x186a0];
dist = new double[0x186a0];
breakpt = new int[0x186a0];
chain_mark = new int[0x186a0];
int argc = args.length;
map = new TreeMap();
String somevar = "";
ep_type epsd = new ep_type();
wd_type word = new wd_type();
blk_type tmp = new blk_type();
TRACE = 0;
STARTYEAR = 1997;
START_OPT = 0;
END_OPT = 0;
FIRST_T = -1;
LAST_T = -1;
A_ONLY = 0;
S_ONLY = 0;
FAST = 1440D;
FAST_INC = 2D;
FAST_LEVELS = 3;
REL_OPT = 0;
REL_BASE = 2D;
REL_INC = 2D;
REL_LEVELS = 4;
TRANS = 1.0D;
DTRANS = 1.0D;
THRESHOLD = 0.5D;
ROBUST = 0.0D;
MIN_SLENGTH = 0;
MIN_WLENGTH = 10;
MIN_GAP = 0;
NO_MONTHS = 1;
NO_DAYS = 0;
MIN_PRE_GAP = 0.0D;
FREE = 0;
POWER_THRESH = 0.0D;
PRINT_EPISODES = 0;
FOCUS_WORD_OPT = 0;
SINGLE = 0;
COMMON = 7;
MIN_WEIGHT = 1;
MERGE = 0;
SMERGE = 0;
CARRIER = MIN_SLENGTH;
MIN_PLENGTH = MIN_SLENGTH;
KEY = 0;
MSG_WTTHRESH = 10D;
MAX_SUMM = 5;
MAX_DSUMM = 5;
WEIGHT_SELECT = 1;
TOP = 20;
PRINT_INDEX = 0;
INSTIGATORS = 0;
INSTIG_DEPTH = 1;
ABSORBERS = 0;
ABSORB_DEPTH = 1;
PRINT_POSET = 0;
PRINT_ALL = 0;
SUB_FULL = 0;
SHARP_OPT = 0;
EXTRA_OPT = 0;
MSG = 0;
CONTEXT = 0;
STRETCH = 0.0D;
HEADER_STATE = 0;
int x = 0;
int y = 0;
String curr_word = "zzz";
word_num = -1;
int count = 0;
first_of_month[1] = 0;
first_of_month[2] = 31;
first_of_month[3] = 59;
first_of_month[4] = 90;
first_of_month[5] = 120;
first_of_month[6] = 151;
first_of_month[7] = 181;
first_of_month[8] = 212;
first_of_month[9] = 243;
first_of_month[10] = 273;
first_of_month[11] = 304;
first_of_month[12] = 334;
first_of_month[13] = 365;
leap_first_of_month[1] = 0;
leap_first_of_month[2] = 31;
for(int i = 3; i <= 13; i++)
leap_first_of_month[i] = first_of_month[i] + 1;
month_name[1] = "Jan".toCharArray();
month_name[2] = "Feb".toCharArray();
month_name[3] = "Mar".toCharArray();
month_name[4] = "Apr".toCharArray();
month_name[5] = "May".toCharArray();
month_name[6] = "Jun".toCharArray();
month_name[7] = "Jul".toCharArray();
month_name[8] = "Aug".toCharArray();
month_name[9] = "Sep".toCharArray();
month_name[10] = "Oct".toCharArray();
month_name[11] = "Nov".toCharArray();
month_name[12] = "Dec".toCharArray();
day_name[1] = "Sun".toCharArray();
day_name[2] = "Mon".toCharArray();
day_name[3] = "Tue".toCharArray();
day_name[4] = "Wed".toCharArray();
day_name[5] = "Thu".toCharArray();
day_name[6] = "Fri".toCharArray();
day_name[7] = "Sat".toCharArray();
if(args.length < 12)
{
printHelp();
System.exit(0);
}
for(int i = 0; i < argc; i++)
{
if(args[i].equals("-help") || args[i].equals("?"))
{
printHelp();
System.exit(0);
}
if(args[i].equals("-in"))
{
i++;
input_file_ptr = args[i];
}
if(args[i].equals("-out"))
{
i++;
output_file_ptr = args[i];
}
if(args[i].equals("-trace"))
TRACE = 1;
if(args[i].equals("-months"))
NO_MONTHS = 1;
if(args[i].equals("-days"))
NO_DAYS = 1;
if(args[i].equals("-merge"))
MERGE = 1;
if(args[i].equals("-smerge"))
SMERGE = 1;
if(args[i].equals("-key"))
KEY = 1;
if(args[i].equals("-index"))
PRINT_INDEX = 1;
if(args[i].equals("-poset"))
PRINT_POSET = 1;
if(args[i].equals("-a-only"))
A_ONLY = 1;
if(args[i].equals("-a-omit"))
A_ONLY = 2;
if(args[i].equals("-s-only"))
S_ONLY = 1;
if(args[i].equals("-s-omit"))
S_ONLY = 2;
if(args[i].equals("-print-full"))
SUB_FULL = 1;
if(args[i].equals("-sub-full"))
SUB_FULL = 2;
if(args[i].equals("-sharp"))
SHARP_OPT = 1;
if(args[i].equals("-eps"))
PRINT_EPISODES = 1;
if(args[i].equals("-extra"))
EXTRA_OPT = 1;
if(args[i].equals("-print-all"))
{
PRINT_ALL = 1;
TOP = 0;
}
if(args[i].equals("-bin"))
BINS = 1;
if(args[i].equals("-single"))
SINGLE = 1;
if(args[i].equals("-start") && i < argc - 2)
{
START_OPT = 1;
i++;
START_M = Integer.parseInt(args[i]);
i++;
START_Y = Integer.parseInt(args[i]);
}
if(args[i].equals("-end") && i < argc - 2)
{
END_OPT = 1;
i++;
END_M = Integer.parseInt(args[i]);
i++;
END_Y = Integer.parseInt(args[i]);
}
if(args[i].equals("-slice") && i < argc - 3)
{
SLICE_OPT = 1;
i++;
SLICE_M = Integer.parseInt(args[i]);
i++;
SLICE_D = Integer.parseInt(args[i]);
i++;
SLICE_Y = Integer.parseInt(args[i]);
}
if(args[i].equals("-m") && i < argc - 1)
{
i++;
MSG = Integer.parseInt(args[i]);
CONTEXT = 1;
}
if(args[i].equals("-w") && i < argc - 1)
{
i++;
FOCUS_WORD = args[i].toCharArray();
FOCUS_WORD_OPT = 1;
}
if(args[i].equals("-first") && i < argc - 1)
{
i++;
FIRST_T = Integer.parseInt(args[i]);
}
if(args[i].equals("-last") && i < argc - 1)
{
i++;
LAST_T = Integer.parseInt(args[i]);
}
if(args[i].equals("-stretch") && i < argc - 1)
{
i++;
STRETCH = Integer.parseInt(args[i]);
}
if(args[i].equals("-mingap") && i < argc - 1)
{
i++;
MIN_GAP = Integer.parseInt(args[i]);
}
if(args[i].equals("-pregap") && i < argc - 1)
{
i++;
MIN_PRE_GAP = Double.parseDouble(args[i]);
}
if(args[i].equals("-instig") && i < argc - 1)
{
INSTIGATORS = 1;
i++;
INSTIG_DEPTH = Integer.parseInt(args[i]);
}
if(args[i].equals("-absorb") && i < argc - 1)
{
ABSORBERS = 1;
i++;
ABSORB_DEPTH = Integer.parseInt(args[i]);
}
if(args[i].equals("-y") && i < argc - 1)
{
i++;
STARTYEAR = Integer.parseInt(args[i]);
}
if(args[i].equals("-thresh") && i < argc - 1)
{
i++;
THRESHOLD = Double.parseDouble(args[i]);
}
if(args[i].equals("-fast") && i < argc - 1)
{
i++;
FAST = Double.parseDouble(args[i]);
FAST = FAST * 60D;
i++;
FAST_INC = Double.parseDouble(args[i]);
i++;
FAST_LEVELS = Integer.parseInt(args[i]);
}
if(args[i].equals("-rel") && i < argc - 1)
{
REL_OPT = 1;
i++;
REL_BASE = Double.parseDouble(args[i]);
i++;
REL_INC = Double.parseDouble(args[i]);
i++;
REL_LEVELS = Integer.parseInt(args[i]);
}
if(args[i].equals("-trans") && i < argc - 1)
{
i++;
TRANS = Double.parseDouble(args[i]);
}
if(args[i].equals("-dtrans") && i < argc - 1)
{
i++;
DTRANS = Double.parseDouble(args[i]);
}
if(args[i].equals("-expect") && i < argc - 1)
{
i++;
FAST = Double.parseDouble(args[i]);
FAST = FAST * 60D;
}
if(args[i].equals("-wlength") && i < argc - 1)
{
i++;
MIN_WLENGTH = Integer.parseInt(args[i]);
}
if((args[i].equals("-slength") || args[i].equals("-length")) && i < argc - 1)
{
i++;
MIN_SLENGTH = Integer.parseInt(args[i]);
}
if(args[i].equals("-power") && i < argc - 1)
{
i++;
FREE = 1;
POWER_THRESH = Double.parseDouble(args[i]);
}
if(args[i].equals("-common") && i < argc - 1)
{
i++;
COMMON = Integer.parseInt(args[i]);
}
if(args[i].equals("-weight") && i < argc - 1)
{
i++;
MIN_WEIGHT = Integer.parseInt(args[i]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -