📄 burst.java
字号:
if(args[i].equals("-carrier") && i < argc - 1)
{
i++;
CARRIER = Integer.parseInt(args[i]);
}
if(args[i].equals("-plength") && i < argc - 1)
{
i++;
MIN_PLENGTH = Integer.parseInt(args[i]);
}
if(args[i].equals("-mwthresh") && i < argc - 1)
{
i++;
MSG_WTTHRESH = Double.parseDouble(args[i]);
}
if(args[i].equals("-top") && i < argc - 1)
{
i++;
TOP = Integer.parseInt(args[i]);
}
if(args[i].equals("-summ") && i < argc - 1)
{
i++;
MAX_SUMM = Integer.parseInt(args[i]);
if(MAX_SUMM > 50)
MAX_SUMM = 50;
if(MAX_DSUMM > MAX_SUMM)
MAX_DSUMM = MAX_SUMM;
}
if(args[i].equals("-dsumm") && i < argc - 1)
{
i++;
MAX_DSUMM = Integer.parseInt(args[i]);
if(MAX_DSUMM > MAX_SUMM)
MAX_DSUMM = MAX_SUMM;
}
if(args[i].equals("-wselect") && i < argc - 1)
{
i++;
char c = args[i].toCharArray()[0];
if(c == 'l')
WEIGHT_SELECT = 0;
else
if(c == 'g')
WEIGHT_SELECT = 2;
else
if(c == 'w')
WEIGHT_SELECT = 2;
else
WEIGHT_SELECT = 1;
}
}
block_count = 0;
block = new blk_type[500];
for(int k = 0; k < block.length; k++)
block[k] = new blk_type();
try
{
File f = new File(input_file_ptr);
BufferedReader br = new BufferedReader(new FileReader(f));
String s1;
while((s1 = br.readLine()) != null)
{
if(HEADER_STATE == 0)
if(!s1.startsWith("#"))
{
HEADER_STATE = 1;
} else
{
String columns[] = s1.split("\\s+");
String ss = columns[0];
String bin = columns[1];
x = Integer.parseInt(columns[2]);
block[block_count].name = String.valueOf(bin);
block[block_count].denom = x;
block_count++;
}
if(HEADER_STATE == 1)
{
String columns[] = s1.split("\\s+");
x = Integer.parseInt(columns[0]);
String bin = columns[1];
y = Integer.parseInt(columns[2]);
if(!bin.equals(curr_word))
{
if(word_num >= 0)
word.end = count - 1;
word.total_power = 0.0D;
for(int j = 0; j < block_count; j++)
{
entry[j] = word.bin[j];
bin_base[j] = block[j].denom;
}
compute_states(block_count);
for(int j = 0; j < block_count - 1; j++)
{
for(int k = f_levels - 2; k >= 0; k--)
if(cell[j].candidate[k] == 1 && (cell[j].breakpt[k] - j) + 1 >= MIN_SLENGTH && cell[j].total_power[k] >= POWER_THRESH && (SHARP_OPT != 1 || k != cell[j].min_rate_class))
{
epsd.word_index = word_num;
epsd.start = j;
if(cell[j].breakpt[k] < block_count - 1)
epsd.end = cell[j].breakpt[k] - 1;
else
epsd.end = cell[j].breakpt[k] + 1;
epsd.power = cell[j].total_power[k];
epsd.length = (epsd.end - epsd.start) + 1;
epsd.rate_class = k;
epsd.min_rate_class = cell[j].min_rate_class;
epsd.index_appearances = 0;
epsd.instig = 0;
epsd.subordinate = cell[j].subordinate[k];
epsd.rate_value = o_rate[k];
epsd.min_rate_value = o_rate[cell[j].min_rate_class];
if(epsd.subordinate != 1)
word.total_power += epsd.power;
if(epsd.subordinate == 1)
epsd.weight = 0.0D;
else
if(WEIGHT_SELECT == 0)
epsd.weight = epsd.length;
else
if(WEIGHT_SELECT == 2)
epsd.weight = word.total_power;
else
epsd.weight = epsd.power;
if(epsd.rate_class != epsd.min_rate_class)
somevar = epsd.rate_value + "/" + epsd.min_rate_value;
somevar = String.valueOf(epsd.rate_value);
DecimalFormat formatter = new DecimalFormat("##.####");
String bx = String.valueOf(block[epsd.start].name);
String bx2 = new String(block[epsd.end].name);
String s = new String("^ " + word.value + " : " + epsd.length + " " + formatter.format(epsd.power) + " " + somevar + " " + formatter.format(word.total_power) + " (" + bx + " - " + bx2 + ")");
map.put(word.value, s);
}
}
word_num++;
curr_word = bin;
word.value = String.valueOf(bin);
word.start = count;
for(int i = 0; i < block_count; i++)
word.bin[i] = 0;
}
word.bin[x] = y;
}
}
block = null;
cell = null;
tmp = null;
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
}
public void export(String output_file_ptr)
throws IOException
{
if(map != null && map.size() > 0 && output_file_ptr != null)
{
FileWriter fw = new FileWriter(output_file_ptr);
bw = new BufferedWriter(fw);
for(Iterator it = map.keySet().iterator(); it.hasNext(); bw.write("\n"))
bw.write((String)map.get((String)it.next()));
bw.flush();
fw.flush();
fw.close();
bw.close();
}
}
public String export()
{
StringBuffer buf = new StringBuffer("");
if(map != null && map.size() > 0)
{
for(Iterator it = map.keySet().iterator(); it.hasNext(); buf.append("\n"))
buf.append((String)map.get((String)it.next()));
}
return buf.toString();
}
public int getCount()
{
return map.size();
}
public static void main(String args[])
{
String parameters[] = {
"-in", "burst.in", "-out", "burst.out", "-bin", "-eps", "-rel", "2", "2", "1",
"-trans", "1"
};
Burst b = new Burst(parameters);
try
{
b.export(b.output_file_ptr);
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
System.err.println(b.export());
}
BufferedWriter bw;
BufferedReader br;
Map map;
final int MAX_MSGS = 0x186a0;
final int MAX_WLENGTH = 50;
final int MAX_INDEX = 0x989680;
final int MAX_EPS = 0x7a120;
final int MAX_F_LEVELS = 20;
final int REAL_MAX_SUMM = 50;
final double HUGEN = 1000000D;
final int MAX_BINS = 1000;
final int MIN_BLOCK_SIZE = 500;
final int WS_L = 0;
final int WS_P = 1;
final int WS_G = 2;
final int WS_W = 2;
int HEADER_STATE;
blk_type block[];
int block_count;
int word_num;
int first_time;
int last_time;
int time_span;
int entry[];
int first_msg;
int last_msg;
int STARTYEAR;
char fdate[];
int TRACE;
int first_of_month[];
int leap_first_of_month[];
char month_name[][];
char day_name[][];
int START_OPT;
int START_Y;
int START_M;
int START_TIME;
int END_OPT;
int END_Y;
int END_M;
int END_TIME;
int SLICE_OPT;
int SLICE_Y;
int SLICE_M;
int SLICE_D;
int SLICE_TIME;
int A_ONLY;
int S_ONLY;
int FIRST_T;
int LAST_T;
int SINGLE;
int EXTRA_OPT;
char spike_start_date[];
char spike_end_date[];
int spike_start;
int spike_end;
double THRESHOLD;
double ROBUST;
int MIN_WLENGTH;
int MIN_SLENGTH;
int MIN_GAP;
int NO_MONTHS;
int NO_DAYS;
int PRINT_EPISODES;
double MIN_PRE_GAP;
int FREE;
double POWER_THRESH;
int delta;
int in_spike;
int max_gap;
int pre_space;
double pre_gap;
int fast;
double expected;
double rate;
double power;
double FAST;
double specific_fast;
double FAST_INC;
double f_rate[];
double o_rate[];
int FAST_LEVELS;
int f_levels;
int left_barrier[];
int SHARP_OPT;
int REL_OPT;
int REL_LEVELS;
double REL_BASE;
double REL_INC;
char FOCUS_WORD[];
int FOCUS_WORD_OPT;
int BINS;
int bin_base[];
double alpha;
double beta;
double out[];
double dist[];
int breakpt[];
double chain_max;
int chain_ind;
int chain_mark[];
double TRANS;
double DTRANS;
double trans_cost;
cell_type cell[];
int KEY;
double MSG_WTTHRESH;
int MAX_SUMM;
int MAX_DSUMM;
int WEIGHT_SELECT;
int TOP;
int PASS;
int PRINT_INDEX;
int INSTIGATORS;
int INSTIG_DEPTH;
int ABSORBERS;
int ABSORB_DEPTH;
int PRINT_POSET;
int PRINT_ALL;
int SUB_FULL;
double ep_weight_total;
int CONTEXT;
int MSG;
int focus;
int left_gap;
int right_gap;
int local_gap;
double STRETCH;
double normal_gap;
int MERGE;
int SMERGE;
int COMMON;
int MIN_WEIGHT;
int CARRIER;
int MIN_PLENGTH;
public String input_file_ptr;
public String output_file_ptr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -