bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
final private boolean jj_3R_66() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_66() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,878
|
final private boolean jj_3R_67() { if (jj_scan_token(RBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_67() { Token xsp; xsp = jj_scanpos; if (jj_3R_74()) { jj_scanpos = xsp; if (jj_3R_75()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,879
|
final private boolean jj_3R_68() { if (jj_scan_token(POUND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_68() { if (jj_scan_token(LBRACKET)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,881
|
final private boolean jj_3R_69() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_69() { if (jj_scan_token(STUFF)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,882
|
final private boolean jj_3R_70() { Token xsp; xsp = jj_scanpos; if (jj_3R_77()) { jj_scanpos = xsp; if (jj_3R_78()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_70() { Token xsp; xsp = jj_scanpos; if (jj_3R_77()) { jj_scanpos = xsp; if (jj_3R_78()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,883
|
final private boolean jj_3R_70() { Token xsp; xsp = jj_scanpos; if (jj_3R_77()) { jj_scanpos = xsp; if (jj_3R_78()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_70() { Token xsp; xsp = jj_scanpos; if (jj_3R_77()) { jj_scanpos = xsp; if (jj_3R_78()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,884
|
final private boolean jj_3R_71() { if (jj_scan_token(LBRACKET)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_71() { if (jj_scan_token(SLASH)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,885
|
final private boolean jj_3R_72() { if (jj_scan_token(STUFF)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_72() { if (jj_3R_76()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,886
|
final private boolean jj_3R_73() { if (jj_scan_token(QCHAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_73() { if (jj_3R_77()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,887
|
final private boolean jj_3R_74() { if (jj_scan_token(SLASH)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_74() { if (jj_scan_token(QUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,888
|
final private boolean jj_3R_75() { if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_75() { if (jj_scan_token(SQUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,889
|
final private boolean jj_3R_76() { if (jj_3R_80()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_76() { if (jj_scan_token(POUNDPOUND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,890
|
final private boolean jj_3R_77() { if (jj_scan_token(QUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_77() { Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,891
|
final private boolean jj_3R_78() { if (jj_scan_token(SQUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_78() { if (jj_3R_66()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,893
|
final private boolean jj_3R_79() { if (jj_scan_token(POUNDPOUND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3R_79() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,894
|
final private boolean jj_3_10() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_10() { Token xsp; xsp = jj_scanpos; if (jj_3R_19()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_20()) { jj_scanpos = xsp; if (jj_3R_21()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_22()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_23()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,895
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_24()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,896
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_25()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,897
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_26()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,898
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_27()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,899
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_11() { Token xsp; xsp = jj_scanpos; if (jj_3R_20()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_23()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_28()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,900
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_25()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_29()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_29()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_29()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,901
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_25()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_29()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_25()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_29()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,902
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_25()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_29()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_12() { Token xsp; xsp = jj_scanpos; if (jj_3R_25()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_28()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_32()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,903
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_33()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,904
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,905
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,906
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_13() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_32()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_35()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,907
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_36()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,908
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,909
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_37()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,910
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_14() { Token xsp; xsp = jj_scanpos; if (jj_3R_34()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_35()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,911
|
final private boolean jj_3_15() { Token xsp; xsp = jj_scanpos; if (jj_3R_37()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_38()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_15() { Token xsp; xsp = jj_scanpos; if (jj_3R_37()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(OP_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_38()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,912
|
final private boolean jj_3_17() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_40()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_41()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_17() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_40()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; xsp = jj_scanpos; if (jj_3R_41()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,914
|
final private boolean jj_3_19() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_19() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,915
|
final private boolean jj_3_20() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_20() { Token xsp; xsp = jj_scanpos; if (jj_3R_41()) { jj_scanpos = xsp; if (jj_3R_42()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,916
|
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,918
|
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,919
|
final private boolean jj_3_22() { if (jj_scan_token(POUND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_22() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,920
|
final private boolean jj_3_6() { Token xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; }
|
final private boolean jj_3_6() { Token xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; }
| 3,232,921
|
final private boolean jj_3_6() { Token xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; }
|
final private boolean jj_3_6() { Token xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; }
| 3,232,922
|
final private boolean jj_3_7() { if (jj_scan_token(DOT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_7() { if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,923
|
final private boolean jj_3_7() { if (jj_scan_token(DOT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_7() { if (jj_scan_token(DOT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(SEMI)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,924
|
final private boolean jj_3_8() { if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(SEMI)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
|
final private boolean jj_3_8() { if (jj_scan_token(WORD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(SEMI)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
| 3,232,925
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (!isTrue(l)) return FALSE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (!isTrue(r)) return FALSE; return TRUE; }
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (!isTrue(l)) return FALSE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (!isTrue(r)) return FALSE; return TRUE; }
| 3,232,926
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (!isTrue(l)) return FALSE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (!isTrue(r)) return FALSE; return TRUE; }
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (!isTrue(l)) return FALSE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (!isTrue(r)) return FALSE; return TRUE; }
| 3,232,927
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } return operate(l, r); }
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } return operate(l, r); }
| 3,232,928
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (isTrue(l)) return TRUE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (isTrue(r)) return TRUE; return FALSE; }
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (isTrue(l)) return TRUE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (isTrue(r)) return TRUE; return FALSE; }
| 3,232,929
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (isTrue(l)) return TRUE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (isTrue(r)) return TRUE; return FALSE; }
|
public Object evaluate(Context context) throws PropertyException { Object l, r; try { l = (_l instanceof Macro) ? ((Macro) _l).evaluate(context) : _l; } catch (Exception e) { l = null; } if (isTrue(l)) return TRUE; try { r = (_r instanceof Macro) ? ((Macro) _r).evaluate(context) : _r; } catch (Exception e) { r = null; } if (isTrue(r)) return TRUE; return FALSE; }
| 3,232,930
|
public FastWriter(OutputStream out, String encoding) throws java.io.UnsupportedEncodingException { _encoding = encoding; _bstream = new ByteBufferOutputStream(4096); _bwriter = new BufferedWriter(new OutputStreamWriter(_bstream, encoding)); _cache = EncodingCache.getInstance(encoding); _encodeProperly = true; _buffered = false; _out = out; }
|
public FastWriter(OutputStream out, String encoding) throws java.io.UnsupportedEncodingException { _encoding = encoding; _bstream = new ByteBufferOutputStream(4096); _bwriter = new OutputStreamWriter(_bstream, encoding); _cache = EncodingCache.getInstance(encoding); _encodeProperly = true; _buffered = false; _out = out; }
| 3,232,931
|
public byte[] toByteArray() { bflush(); return _bstream.toByteArray(); }
|
public byte[] toByteArray() { bflush(); return _bstream.getBytes(); }
| 3,232,932
|
public void writeStatic(String s) { try { if (_encodeProperly) { bflush(); _bstream.write(_cache.getEncoding(s)); } else { write(s,0,s.length()); } } catch (IOException e) { e.printStackTrace(); // never happens } }
|
public void writeStatic(String s) { try { if (_encodeProperly) { bflush(); _bstream.write(_cache.getEncoding(s)); } else { write(s,0,s.length()); } } catch (IOException e) { e.printStackTrace(); // never happens } }
| 3,232,933
|
main(String[] args) { int status = 0; Ice.Communicator ic = null; try { // Server implementation here... ic = Ice.Util.initialize(args); Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints( "TAdapter", "default -p 10000"); Ice.Object object = new test.TI(); adapter.add( object, Ice.Util.stringToIdentity("T")); adapter.activate(); ic.waitForShutdown(); } catch (Ice.LocalException e) { e.printStackTrace(); status = 1; } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } if (ic != null) { // Clean up // try { ic.destroy(); } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } } System.exit(status); }
|
main(String[] args) { int status = 0; Ice.Communicator ic = null; try { // Server implementation here... ic = Ice.Util.initialize(args); Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints( "TAdapter", "default -p 10000"); Ice.Object object = new test.TI(); adapter.add( object, Ice.Util.stringToIdentity("T")); adapter.activate(); ic.waitForShutdown(); } catch (Ice.LocalException e) { e.printStackTrace(); status = 1; } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } if (ic != null) { // Clean up // try { ic.destroy(); } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } } System.exit(status); }
| 3,232,934
|
private DatasetsTableModel() { for (int i = 0; i < datasets.length; i++) { data[i][0] = (DatasetData) datasets[i]; data[i][1] = new Boolean(false); } }
|
private DatasetsTableModel() { for (int i = 0; i < datasets.length; i++) { data[i][0] = (DatasetData) datasets[i]; data[i][1] = new Boolean(false); } }
| 3,232,936
|
private RenderingDef createDefaultRenderingDef(PixelsDimensions dims, PixelsStats stats, int pixelType) { QuantumDef qDef = new QuantumDef(QuantumFactory.LINEAR, pixelType, 1, 0, QuantumFactory.DEPTH_8BIT, QuantumFactory.DEPTH_8BIT); ChannelBindings[] waves = new ChannelBindings[dims.sizeW]; PixelsGlobalStatsEntry wGlobal; for (int w = 0; w < dims.sizeW; ++w) { wGlobal = stats.getGlobalEntry(w); //TODO: calcultate default interval using sigma, etc. waves[w] = new ChannelBindings(w, wGlobal.getGlobalMin(), wGlobal.getGlobalMax(), 0, 0, 0, 255, false); } waves[0].setActive(true); //NOTE: ImageDimensions enforces 1 < sizeW. return new RenderingDef(dims.sizeZ/2+dims.sizeZ%2-1, 0, RenderingDef.GS, qDef, waves); //NOTE: middle of stack is z=1 if szZ==3, z=1 if szZ==4, etc. }
|
private RenderingDef createDefaultRenderingDef(PixelsDimensions dims, PixelsStats stats, int pixelType) { QuantumDef qDef = new QuantumDef(QuantumFactory.LINEAR, pixelType, 1, 0, QuantumFactory.DEPTH_8BIT, QuantumFactory.DEPTH_8BIT); ChannelBindings[] waves = new ChannelBindings[dims.sizeW]; PixelsGlobalStatsEntry wGlobal; for (int w = 0; w < dims.sizeW; ++w) { wGlobal = stats.getGlobalEntry(w); //TODO: calcultate default interval using sigma, etc. waves[w] = new ChannelBindings(w, wGlobal.getGlobalMin(), wGlobal.getGlobalMax(), 0, 0, 0, 255, false); } waves[0].setActive(true); //NOTE: ImageDimensions enforces 1 < sizeW. return new RenderingDef(dims.sizeZ/2+dims.sizeZ%2-1, 0, RenderingDef.GS, qDef, waves); //NOTE: middle of stack is z=1 if szZ==3, z=1 if szZ==4, etc. }
| 3,232,937
|
public Set<SemanticType> process(){ for (String id : types.keySet()) { // "ome...Pixels" SemanticType t = types.get(id); // Pixels for (Property p : t.getProperties()) { // thumbnails String rev = p.getType(); // "ome...Thumbnail" String inv = p.getInverse(); // "pixels" if ( inv != null ) { if (types.containsKey(rev)) { SemanticType reverse = types.get(rev); // Thumbail for (Property inverse : reverse.getProperties()) { if ( inverse.getType().equals(id)) { // "ome...Pixels" inverse.setInverse(p.getName()); } } } } } } System.err.println("xxx"); for (String id : types.keySet()) { System.err.println(id); } return new HashSet<SemanticType>(types.values()); }
|
public Set<SemanticType> process(){ for (String id : types.keySet()) { // "ome...Pixels" SemanticType t = types.get(id); // Pixels for (Property p : t.getProperties()) { // thumbnails String rev = p.getType(); // "ome...Thumbnail" String inv = p.getInverse(); // "pixels" if ( inv != null ) { if (types.containsKey(rev)) { SemanticType reverse = types.get(rev); // Thumbail for (Property inverse : reverse.getProperties()) { if ( inverse.getType().equals(id)) { // "ome...Pixels" inverse.setInverse(p.getName()); } } } } } } System.err.println("xxx"); for (String id : types.keySet()) { System.err.println(id); } return new HashSet<SemanticType>(types.values()); }
| 3,232,938
|
private void checkPopup(MouseEvent evt) { final int index = list.locationToIndex(evt.getPoint()); list.setSelectedIndex(index); final String selectedUser = getSelectedUser(); final String groupJID = (String)userMap.get(selectedUser); String groupJIDNickname = StringUtils.parseResource(groupJID); final String nickname = groupChatRoom.getNickname(); final Occupant occupant = userManager.getOccupant(groupChatRoom, selectedUser); final boolean admin = SparkManager.getUserManager().isOwnerOrAdmin(groupChatRoom, chat.getNickname()); final boolean moderator = SparkManager.getUserManager().isModerator(groupChatRoom, chat.getNickname()); final boolean userIsAdmin = userManager.isOwnerOrAdmin(occupant); final boolean userIsModerator = userManager.isModerator(occupant); boolean isMe = groupJIDNickname.equals(nickname); JPopupMenu popup = new JPopupMenu(); if (isMe) { Action changeNicknameAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String newNickname = JOptionPane.showInputDialog(groupChatRoom, Res.getString("label.new.nickname") + ":", Res.getString("title.change.nickname"), JOptionPane.QUESTION_MESSAGE); if (ModelUtil.hasLength(newNickname)) { while (true) { newNickname = newNickname.trim(); try { chat.changeNickname(newNickname); break; } catch (XMPPException e1) { newNickname = JOptionPane.showInputDialog(groupChatRoom, Res.getString("message.nickname.in.use") + ":", Res.getString("title.change.nickname"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(newNickname)) { break; } } } } } }; changeNicknameAction.putValue(Action.NAME, Res.getString("menuitem.change.nickname")); changeNicknameAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DESKTOP_IMAGE)); if (allowNicknameChange) { popup.add(changeNicknameAction); } } Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String selectedUser = getSelectedUser(); startChat(groupChatRoom, (String)userMap.get(selectedUser)); } }; chatAction.putValue(Action.NAME, Res.getString("menuitem.start.a.chat")); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); if (!isMe) { popup.add(chatAction); } Action blockAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } } }; blockAction.putValue(Action.NAME, Res.getString("menuitem.block.user")); blockAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE)); if (!isMe) { if (groupChatRoom.isBlocked(groupJID)) { blockAction.putValue(Action.NAME, Res.getString("menuitem.unblock.user")); } popup.add(blockAction); } Action kickAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { kickUser(selectedUser); } }; kickAction.putValue(Action.NAME, Res.getString("menuitem.kick.user")); kickAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_DELETE)); if (moderator && !userIsAdmin && !isMe) { popup.add(kickAction); } // Handle Voice Operations Action voiceAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { revokeVoice(selectedUser); } else { grantVoice(selectedUser); } } }; voiceAction.putValue(Action.NAME, Res.getString("menuitem.voice")); voiceAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.MEGAPHONE_16x16)); if (moderator && !userIsModerator && !isMe) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { voiceAction.putValue(Action.NAME, Res.getString("menuitem.revoke.voice")); } else { voiceAction.putValue(Action.NAME, Res.getString("menuitem.grant.voice")); } popup.add(voiceAction); } Action banAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { banUser(selectedUser); } }; banAction.putValue(Action.NAME, Res.getString("menuitem.ban.user")); banAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.RED_FLAG_16x16)); if (admin && !userIsModerator && !isMe) { popup.add(banAction); } Action moderatorAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { if (!userIsModerator) { grantModerator(selectedUser); } else { revokeModerator(selectedUser); } } }; moderatorAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.MODERATOR_IMAGE)); if (admin && !userIsModerator) { moderatorAction.putValue(Action.NAME, Res.getString("menuitem.grant.moderator")); popup.add(moderatorAction); } else if (admin && userIsModerator && !isMe) { moderatorAction.putValue(Action.NAME, Res.getString("menuitem.revoke.moderator")); popup.add(moderatorAction); } // Handle Unbanning of users. Action unbanAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String jid = ((JMenuItem)actionEvent.getSource()).getText(); unbanUser(jid); } }; if (admin) { JMenu unbanMenu = new JMenu(Res.getString("menuitem.unban")); Iterator bannedUsers = null; try { bannedUsers = chat.getOutcasts().iterator(); } catch (XMPPException e) { Log.error("Error loading all banned users", e); } while (bannedUsers != null && bannedUsers.hasNext()) { Affiliate bannedUser = (Affiliate)bannedUsers.next(); ImageIcon icon = SparkRes.getImageIcon(SparkRes.RED_BALL); JMenuItem bannedItem = new JMenuItem(bannedUser.getJid(), icon); unbanMenu.add(bannedItem); bannedItem.addActionListener(unbanAction); } if (unbanMenu.getMenuComponentCount() > 0) { popup.add(unbanMenu); } } Action inviteAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { ConferenceUtils.inviteUsersToRoom(groupChatRoom.getConferenceService(), groupChatRoom.getRoomname(), null); } }; inviteAction.putValue(Action.NAME, Res.getString("menuitem.invite.users")); inviteAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16)); popup.addSeparator(); popup.add(inviteAction); popup.show(list, evt.getX(), evt.getY()); }
|
private void checkPopup(MouseEvent evt) { final int index = list.locationToIndex(evt.getPoint()); list.setSelectedIndex(index); final String selectedUser = getSelectedUser(); final String groupJID = (String)userMap.get(selectedUser); String groupJIDNickname = StringUtils.parseResource(groupJID); final String nickname = groupChatRoom.getNickname(); final Occupant occupant = userManager.getOccupant(groupChatRoom, selectedUser); final boolean admin = SparkManager.getUserManager().isOwnerOrAdmin(groupChatRoom, chat.getNickname()); final boolean moderator = SparkManager.getUserManager().isModerator(groupChatRoom, chat.getNickname()); final boolean userIsAdmin = userManager.isOwnerOrAdmin(occupant); final boolean userIsModerator = userManager.isModerator(occupant); boolean isMe = nickname.equals(groupJIDNickname); JPopupMenu popup = new JPopupMenu(); if (isMe) { Action changeNicknameAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String newNickname = JOptionPane.showInputDialog(groupChatRoom, Res.getString("label.new.nickname") + ":", Res.getString("title.change.nickname"), JOptionPane.QUESTION_MESSAGE); if (ModelUtil.hasLength(newNickname)) { while (true) { newNickname = newNickname.trim(); try { chat.changeNickname(newNickname); break; } catch (XMPPException e1) { newNickname = JOptionPane.showInputDialog(groupChatRoom, Res.getString("message.nickname.in.use") + ":", Res.getString("title.change.nickname"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(newNickname)) { break; } } } } } }; changeNicknameAction.putValue(Action.NAME, Res.getString("menuitem.change.nickname")); changeNicknameAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DESKTOP_IMAGE)); if (allowNicknameChange) { popup.add(changeNicknameAction); } } Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String selectedUser = getSelectedUser(); startChat(groupChatRoom, (String)userMap.get(selectedUser)); } }; chatAction.putValue(Action.NAME, Res.getString("menuitem.start.a.chat")); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); if (!isMe) { popup.add(chatAction); } Action blockAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } } }; blockAction.putValue(Action.NAME, Res.getString("menuitem.block.user")); blockAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE)); if (!isMe) { if (groupChatRoom.isBlocked(groupJID)) { blockAction.putValue(Action.NAME, Res.getString("menuitem.unblock.user")); } popup.add(blockAction); } Action kickAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { kickUser(selectedUser); } }; kickAction.putValue(Action.NAME, Res.getString("menuitem.kick.user")); kickAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_DELETE)); if (moderator && !userIsAdmin && !isMe) { popup.add(kickAction); } // Handle Voice Operations Action voiceAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { revokeVoice(selectedUser); } else { grantVoice(selectedUser); } } }; voiceAction.putValue(Action.NAME, Res.getString("menuitem.voice")); voiceAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.MEGAPHONE_16x16)); if (moderator && !userIsModerator && !isMe) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { voiceAction.putValue(Action.NAME, Res.getString("menuitem.revoke.voice")); } else { voiceAction.putValue(Action.NAME, Res.getString("menuitem.grant.voice")); } popup.add(voiceAction); } Action banAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { banUser(selectedUser); } }; banAction.putValue(Action.NAME, Res.getString("menuitem.ban.user")); banAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.RED_FLAG_16x16)); if (admin && !userIsModerator && !isMe) { popup.add(banAction); } Action moderatorAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { if (!userIsModerator) { grantModerator(selectedUser); } else { revokeModerator(selectedUser); } } }; moderatorAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.MODERATOR_IMAGE)); if (admin && !userIsModerator) { moderatorAction.putValue(Action.NAME, Res.getString("menuitem.grant.moderator")); popup.add(moderatorAction); } else if (admin && userIsModerator && !isMe) { moderatorAction.putValue(Action.NAME, Res.getString("menuitem.revoke.moderator")); popup.add(moderatorAction); } // Handle Unbanning of users. Action unbanAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { String jid = ((JMenuItem)actionEvent.getSource()).getText(); unbanUser(jid); } }; if (admin) { JMenu unbanMenu = new JMenu(Res.getString("menuitem.unban")); Iterator bannedUsers = null; try { bannedUsers = chat.getOutcasts().iterator(); } catch (XMPPException e) { Log.error("Error loading all banned users", e); } while (bannedUsers != null && bannedUsers.hasNext()) { Affiliate bannedUser = (Affiliate)bannedUsers.next(); ImageIcon icon = SparkRes.getImageIcon(SparkRes.RED_BALL); JMenuItem bannedItem = new JMenuItem(bannedUser.getJid(), icon); unbanMenu.add(bannedItem); bannedItem.addActionListener(unbanAction); } if (unbanMenu.getMenuComponentCount() > 0) { popup.add(unbanMenu); } } Action inviteAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { ConferenceUtils.inviteUsersToRoom(groupChatRoom.getConferenceService(), groupChatRoom.getRoomname(), null); } }; inviteAction.putValue(Action.NAME, Res.getString("menuitem.invite.users")); inviteAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16)); popup.addSeparator(); popup.add(inviteAction); popup.show(list, evt.getX(), evt.getY()); }
| 3,232,940
|
public void actionPerformed(ActionEvent actionEvent) { banUser(selectedUser); }
|
public void actionPerformed(ActionEvent actionEvent) { banUser(selectedUser); }
| 3,232,942
|
public void actionPerformed(ActionEvent actionEvent) { if (!userIsModerator) { grantModerator(selectedUser); } else { revokeModerator(selectedUser); } }
|
public void actionPerformed(ActionEvent actionEvent) { if (!userIsModerator) { grantModerator(selectedUser); } else { revokeModerator(selectedUser); } }
| 3,232,943
|
public void actionPerformed(ActionEvent actionEvent) { String jid = ((JMenuItem)actionEvent.getSource()).getText(); unbanUser(jid); }
|
public void actionPerformed(ActionEvent actionEvent) { String jid = ((JMenuItem)actionEvent.getSource()).getText(); unbanUser(jid); }
| 3,232,944
|
public void actionPerformed(ActionEvent actionEvent) { ConferenceUtils.inviteUsersToRoom(groupChatRoom.getConferenceService(), groupChatRoom.getRoomname(), null); }
|
public void actionPerformed(ActionEvent actionEvent) { banUser(selectedUser); }
| 3,232,945
|
public void actionPerformed(ActionEvent actionEvent) { String selectedUser = getSelectedUser(); startChat(groupChatRoom, (String)userMap.get(selectedUser)); }
|
public void actionPerformed(ActionEvent actionEvent) { String selectedUser = getSelectedUser(); startChat(groupChatRoom, (String)userMap.get(selectedUser)); }
| 3,232,946
|
public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } }
|
public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } }
| 3,232,947
|
public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } }
|
public void actionPerformed(ActionEvent e) { ImageIcon icon = (ImageIcon)list.getSelectedValue(); String description = icon.getDescription(); if (groupChatRoom.isBlocked(groupJID)) { groupChatRoom.removeBlockedUser(groupJID); icon = getImageIcon(groupJID); model.setElementAt(icon, index); } else { groupChatRoom.addBlockedUser(groupJID); icon = SparkRes.getImageIcon(SparkRes.BRICKWALL_IMAGE); icon.setDescription(description); model.setElementAt(icon, index); } }
| 3,232,948
|
public void actionPerformed(ActionEvent actionEvent) { kickUser(selectedUser); }
|
public void actionPerformed(ActionEvent actionEvent) { kickUser(selectedUser); }
| 3,232,949
|
public void actionPerformed(ActionEvent actionEvent) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { revokeVoice(selectedUser); } else { grantVoice(selectedUser); } }
|
public void actionPerformed(ActionEvent actionEvent) { if (userManager.hasVoice(groupChatRoom, selectedUser)) { revokeVoice(selectedUser); } else { grantVoice(selectedUser); } }
| 3,232,950
|
protected Throwable getAndLogException(Throwable t){ if (null == t) { log.error("Exception thrown. (null)"); return new InternalException("Exception thrown with null message"); } else { String msg = " Wrapped Exception: (" + t.getClass().getName()+"):\n" + t.getMessage(); log.error("Exception thrown: "+msg); if ( RootException.class.isAssignableFrom( t.getClass() ) ) return t; // Wrap all non-RootExceptions in InternalException InternalException re = new InternalException(msg); re.setStackTrace(t.getStackTrace()); return re; } }
|
protected Throwable getAndLogException(Throwable t){ if (null == t) { log.error("Exception thrown. (null)"); return new InternalException("Exception thrown with null message"); } else { String msg = " Wrapped Exception: (" + t.getClass().getName()+"):\n" + t.getMessage(); log.error("Exception thrown: "+msg); if ( RootException.class.isAssignableFrom( t.getClass() ) ) return t; // Wrap all non-RootExceptions in InternalException InternalException re = new InternalException(msg); re.setStackTrace(t.getStackTrace()); return re; } }
| 3,232,953
|
protected Throwable getAndLogException(Throwable t){ if (null == t) { log.error("Exception thrown. (null)"); return new InternalException("Exception thrown with null message"); } else { String msg = " Wrapped Exception: (" + t.getClass().getName()+"):\n" + t.getMessage(); log.error("Exception thrown: "+msg); if ( RootException.class.isAssignableFrom( t.getClass() ) ) return t; // Wrap all non-RootExceptions in InternalException InternalException re = new InternalException(msg); re.setStackTrace(t.getStackTrace()); return re; } }
|
protected Throwable getAndLogException(Throwable t){ if (null == t) { log.error("Exception thrown. (null)"); return new InternalException("Exception thrown with null message"); } else { String msg = " Wrapped Exception: (" + t.getClass().getName()+"):\n" + t.getMessage(); log.error("Exception thrown: "+msg); if ( RootException.class.isAssignableFrom( t.getClass() ) ) return t; // Wrap all non-RootExceptions in InternalException InternalException re = new InternalException(msg); re.setStackTrace(t.getStackTrace()); return re; } }
| 3,232,954
|
public void perform(WikiSystem wiki, WebContext wc, WikiUser user, WikiPage page) throws PageAction.PageActionException { if (page != null && page.getIsModerated() && !user.getIsModerator()) throw new PageAction.PageActionException ("This page can only be edited by moderators"); wc.put ("PageName", wc.getForm ("edit")); }
|
public void perform(WikiSystem wiki, WebContext wc, WikiUser user, WikiPage page) throws PageAction.PageActionException { if (page != null && page.getIsModerated() && !user.getIsModerator()) throw new PageAction.PageActionException ("This page can only be edited by moderators"); String pageName = wc.getForm("edit"); pageName = WikiUtil.formatAsWikiTitle(pageName); wc.put ("PageName", pageName); }
| 3,232,955
|
public void close() throws IOException, BadDescriptorException { if (!isOpen()) { throw new BadDescriptorException(); } isOpen = false; if (modes.isReadable()) { input.close(); } if (modes.isWriteable()) { output.close(); } }
|
public void close() throws IOException, BadDescriptorException { if (!isOpen()) { throw new BadDescriptorException(); } isOpen = false; if (modes.isReadable() && input != System.in) { input.close(); } if (modes.isWriteable()) { output.close(); } }
| 3,232,956
|
public void close() throws IOException, BadDescriptorException { if (!isOpen()) { throw new BadDescriptorException(); } isOpen = false; if (modes.isReadable()) { input.close(); } if (modes.isWriteable()) { output.close(); } }
|
public void close() throws IOException, BadDescriptorException { if (!isOpen()) { throw new BadDescriptorException(); } isOpen = false; if (modes.isReadable()) { input.close(); } if (modes.isWriteable() && output != System.out && output != System.err) { output.close(); } }
| 3,232,957
|
protected String eval(String script) throws Exception { ByteArrayOutputStream result = new ByteArrayOutputStream(); out = new PrintStream(result); RubyIO lStream = new RubyIO(ruby, out); ruby.getGlobalVariables().set("$stdout", lStream); ruby.getGlobalVariables().set("$>", lStream); lStream = (RubyIO) ruby.getGlobalVariables().get("$stderr"); lStream.reopen(new RubyIO(ruby, out), null); ruby.loadScript("test", new StringReader(script), false); StringBuffer sb = new StringBuffer(new String(result.toByteArray())); for (int idx = sb.indexOf("\n"); idx != -1; idx = sb.indexOf("\n")) { sb.deleteCharAt(idx); } return sb.toString(); }
|
protected String eval(String script) throws Exception { ByteArrayOutputStream result = new ByteArrayOutputStream(); out = new PrintStream(result); RubyIO lStream = new RubyIO(ruby, out); ruby.getGlobalVariables().set("$stdout", lStream); ruby.getGlobalVariables().set("$>", lStream); lStream = (RubyIO) ruby.getGlobalVariables().get("$stderr"); lStream.reopen(new RubyIO(ruby, out), null); ruby.loadScript("test", new StringReader(script), false); StringBuffer sb = new StringBuffer(new String(result.toByteArray())); for (int idx = sb.indexOf("\n"); idx != -1; idx = sb.indexOf("\n")) { sb.deleteCharAt(idx); } return sb.toString(); }
| 3,232,958
|
protected String eval(String script) throws Exception { ByteArrayOutputStream result = new ByteArrayOutputStream(); out = new PrintStream(result); RubyIO lStream = new RubyIO(ruby, out); ruby.getGlobalVariables().set("$stdout", lStream); ruby.getGlobalVariables().set("$>", lStream); lStream = (RubyIO) ruby.getGlobalVariables().get("$stderr"); lStream.reopen(new RubyIO(ruby, out), null); ruby.loadScript("test", new StringReader(script), false); StringBuffer sb = new StringBuffer(new String(result.toByteArray())); for (int idx = sb.indexOf("\n"); idx != -1; idx = sb.indexOf("\n")) { sb.deleteCharAt(idx); } return sb.toString(); }
|
protectedStringeval(Stringscript)throwsException{ByteArrayOutputStreamresult=newByteArrayOutputStream();out=newPrintStream(result);RubyIOlStream=newRubyIO(ruby,out);ruby.getGlobalVariables().set("$stdout",lStream);ruby.getGlobalVariables().set("$>",lStream);lStream=(RubyIO)ruby.getGlobalVariables().get("$stderr");lStream.reopen(newRubyIO(ruby,out),null);ruby.loadScript("test",newStringReader(script),false);StringBuffersb=newStringBuffer(newString(result.toByteArray()));for(intidx=sb.indexOf("\n");idx!=-1;idx=sb.indexOf("\n")){sb.deleteCharAt(idx);}returnsb.toString();}
| 3,232,959
|
public static void createObjectClass(RubyModule objectClass) { objectClass.defineMethod("==", CallbackFactory.getMethod(RubyObject.class, "equal", IRubyObject.class)); objectClass.defineMethod("=~", CallbackFactory.getFalseMethod(1)); objectClass.defineMethod("clone", CallbackFactory.getMethod(RubyObject.class, "rbClone")); objectClass.defineMethod("dup", CallbackFactory.getMethod(RubyObject.class, "dup")); objectClass.defineMethod("eql?", CallbackFactory.getMethod(RubyObject.class, "equal", IRubyObject.class)); objectClass.defineMethod("respond_to?", CallbackFactory.getOptMethod(RubyObject.class, "respond_to")); objectClass.defineMethod("extend", CallbackFactory.getOptMethod(RubyObject.class, "extend")); objectClass.defineMethod("freeze", CallbackFactory.getMethod(RubyObject.class, "freeze")); objectClass.defineMethod("frozen?", CallbackFactory.getMethod(RubyObject.class, "frozen")); objectClass.defineMethod("id", CallbackFactory.getMethod(RubyObject.class, "id")); objectClass.defineMethod("hash", CallbackFactory.getMethod(RubyObject.class, "hash")); objectClass.defineMethod("__id__", CallbackFactory.getMethod(RubyObject.class, "id")); objectClass.defineMethod("inspect", CallbackFactory.getMethod(RubyObject.class, "inspect")); objectClass.defineMethod("instance_eval", CallbackFactory.getOptMethod(RubyObject.class, "instance_eval")); objectClass.defineMethod("instance_of?", CallbackFactory.getMethod(RubyObject.class, "instance_of", RubyModule.class)); objectClass.defineMethod("instance_variables", CallbackFactory.getMethod(RubyObject.class, "instance_variables")); objectClass.defineMethod("is_a?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); objectClass.defineMethod("kind_of?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); objectClass.defineMethod("method", CallbackFactory.getMethod(RubyObject.class, "method", IRubyObject.class)); objectClass.defineMethod("methods", CallbackFactory.getMethod(RubyObject.class, "methods")); objectClass.defineMethod("nil?", CallbackFactory.getFalseMethod(0)); objectClass.defineMethod("private_methods", CallbackFactory.getMethod(RubyObject.class, "private_methods")); objectClass.defineMethod("protected_methods", CallbackFactory.getMethod(RubyObject.class, "protected_methods")); objectClass.defineMethod("public_methods", CallbackFactory.getMethod(RubyObject.class, "methods")); objectClass.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", IRubyObject.class)); objectClass.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", IRubyObject.class)); objectClass.defineMethod("taint", CallbackFactory.getMethod(RubyObject.class, "taint")); objectClass.defineMethod("tainted?", CallbackFactory.getMethod(RubyObject.class, "tainted")); objectClass.defineMethod("to_a", CallbackFactory.getMethod(RubyObject.class, "to_a")); objectClass.defineMethod("to_s", CallbackFactory.getMethod(RubyObject.class, "to_s")); objectClass.defineMethod("type", CallbackFactory.getMethod(RubyObject.class, "type")); objectClass.defineMethod("untaint", CallbackFactory.getMethod(RubyObject.class, "untaint")); objectClass.defineMethod("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing", IRubyObject.class)); objectClass.defineAlias("===", "=="); objectClass.defineAlias("class", "type"); objectClass.defineAlias("equal?", "=="); }
|
public static void createObjectClass(RubyModule objectClass) { objectClass.defineMethod("==", CallbackFactory.getMethod(RubyObject.class, "equal", IRubyObject.class)); objectClass.defineMethod("=~", CallbackFactory.getFalseMethod(1)); objectClass.defineMethod("clone", CallbackFactory.getMethod(RubyObject.class, "rbClone")); objectClass.defineMethod("dup", CallbackFactory.getMethod(RubyObject.class, "dup")); objectClass.defineMethod("eql?", CallbackFactory.getMethod(RubyObject.class, "equal", IRubyObject.class)); objectClass.defineMethod("respond_to?", CallbackFactory.getOptMethod(RubyObject.class, "respond_to")); objectClass.defineMethod("extend", CallbackFactory.getOptMethod(RubyObject.class, "extend")); objectClass.defineMethod("freeze", CallbackFactory.getMethod(RubyObject.class, "freeze")); objectClass.defineMethod("frozen?", CallbackFactory.getMethod(RubyObject.class, "frozen")); objectClass.defineMethod("id", CallbackFactory.getMethod(RubyObject.class, "id")); objectClass.defineMethod("hash", CallbackFactory.getMethod(RubyObject.class, "hash")); objectClass.defineMethod("__id__", CallbackFactory.getMethod(RubyObject.class, "id")); objectClass.defineMethod("inspect", CallbackFactory.getMethod(RubyObject.class, "inspect")); objectClass.defineMethod("instance_eval", CallbackFactory.getOptMethod(RubyObject.class, "instance_eval")); objectClass.defineMethod("instance_of?", CallbackFactory.getMethod(RubyObject.class, "instance_of", RubyModule.class)); objectClass.defineMethod("instance_variables", CallbackFactory.getMethod(RubyObject.class, "instance_variables")); objectClass.defineMethod("is_a?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); objectClass.defineMethod("kind_of?", CallbackFactory.getMethod(RubyObject.class, "kind_of", RubyModule.class)); objectClass.defineMethod("method", CallbackFactory.getMethod(RubyObject.class, "method", IRubyObject.class)); objectClass.defineMethod("methods", CallbackFactory.getMethod(RubyObject.class, "methods")); objectClass.defineMethod("nil?", CallbackFactory.getFalseMethod(0)); objectClass.defineMethod("private_methods", CallbackFactory.getMethod(RubyObject.class, "private_methods")); objectClass.defineMethod("protected_methods", CallbackFactory.getMethod(RubyObject.class, "protected_methods")); objectClass.defineMethod("public_methods", CallbackFactory.getMethod(RubyObject.class, "methods")); objectClass.defineMethod("send", CallbackFactory.getOptMethod(RubyObject.class, "send", IRubyObject.class)); objectClass.defineMethod("__send__", CallbackFactory.getOptMethod(RubyObject.class, "send", IRubyObject.class)); objectClass.defineMethod("taint", CallbackFactory.getMethod(RubyObject.class, "taint")); objectClass.defineMethod("tainted?", CallbackFactory.getMethod(RubyObject.class, "tainted")); objectClass.defineMethod("to_a", CallbackFactory.getMethod(RubyObject.class, "to_a")); objectClass.defineMethod("to_s", CallbackFactory.getMethod(RubyObject.class, "to_s")); objectClass.defineMethod("type", CallbackFactory.getMethod(RubyObject.class, "type")); objectClass.defineMethod("untaint", CallbackFactory.getMethod(RubyObject.class, "untaint")); objectClass.defineMethod("method_missing", CallbackFactory.getOptMethod(RubyObject.class, "method_missing")); objectClass.defineAlias("===", "=="); objectClass.defineAlias("class", "type"); objectClass.defineAlias("equal?", "=="); }
| 3,232,960
|
public IRubyObject method_missing(IRubyObject symbol, IRubyObject[] args) { throw new NameError(getRuntime(), "Undefined local variable or method '" + symbol.toId() + "' for " + inspect().getValue()); }
|
public IRubyObject method_missing(IRubyObject symbol, IRubyObject[] args) { throw new NameError(getRuntime(), "Undefined local variable or method '" + symbol.toId() + "' for " + inspect().getValue()); }
| 3,232,961
|
protected void generatePropertiesFilePropertyAlias(PrintWriter out, String namespace, SchemaElement element, JProperty property) { JAnnotation annotation = property.getAnnotation("org.xbean.Alias"); if (annotation != null) { String text = getStringValue(annotation, "value"); if (text != null) { String name = decapitalise(property.getSimpleName()); out.println(element.getLocalName() + "." + text + " = " +name); } } }
|
protected void generatePropertiesFilePropertyAlias(PrintWriter out, String namespace, SchemaElement element, JProperty property) { JAnnotation annotation = property.getAnnotation(PROPERTY_ANNOTATION); if (annotation != null) { String text = getStringValue(annotation, "value"); if (text != null) { String name = decapitalise(property.getSimpleName()); out.println(element.getLocalName() + "." + text + " = " +name); } } }
| 3,232,962
|
protected void generatePropertiesFilePropertyAlias(PrintWriter out, String namespace, SchemaElement element, JProperty property) { JAnnotation annotation = property.getAnnotation("org.xbean.Alias"); if (annotation != null) { String text = getStringValue(annotation, "value"); if (text != null) { String name = decapitalise(property.getSimpleName()); out.println(element.getLocalName() + "." + text + " = " +name); } } }
|
protected void generatePropertiesFilePropertyAlias(PrintWriter out, String namespace, SchemaElement element, JProperty property) { JAnnotation annotation = property.getAnnotation("org.xbean.Alias"); if (annotation != null) { String text = getStringValue(annotation, "alias"); if (text != null) { String name = decapitalise(property.getSimpleName()); out.println(element.getLocalName() + "." + text + " = " +name); } } }
| 3,232,963
|
public String recv(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); if (((ReadableByteChannel) channel).read(buffer) < 0) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
|
public String recv(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); if (((ReadableByteChannel) channel).read(buffer) < 0) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
| 3,232,964
|
public String sysread(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); boolean eof = false; while (buffer.hasRemaining()) { int bytesRead = ((ReadableByteChannel) channel).read(buffer); if (bytesRead < 0) { eof = true; break; } if (bytesRead == 0) { // only should happen for nonblocking IO...break and allow the next call to try again break; } } if (buffer.position() == 0 && eof == true) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
|
public String sysread(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); boolean eof = false; while (buffer.hasRemaining()) { int bytesRead = ((ReadableByteChannel) channel).read(buffer); if (bytesRead < 0) { eof = true; break; } if (bytesRead == 0) { // only should happen for nonblocking IO...break and allow the next call to try again break; } } if (buffer.position() == 0 && eof == true) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
| 3,232,965
|
public String sysread(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); boolean eof = false; while (buffer.hasRemaining()) { int bytesRead = ((ReadableByteChannel) channel).read(buffer); if (bytesRead < 0) { eof = true; break; } if (bytesRead == 0) { // only should happen for nonblocking IO...break and allow the next call to try again break; } } if (buffer.position() == 0 && eof == true) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
|
public String sysread(int length) throws EOFException, BadDescriptorException, IOException { checkReadable(); checkBuffered(); ByteBuffer buffer = ByteBuffer.allocate(length); boolean eof = false; while (buffer.hasRemaining()) { int bytesRead = ((ReadableByteChannel) channel).read(buffer); if (bytesRead < 0) { eof = true; break; } if (bytesRead == 0) { // only should happen for nonblocking IO...break and allow the next call to try again break; } } if (buffer.position() == 0 && eof == true) { throw new EOFException(); } byte[] ret; if (buffer.hasRemaining()) { buffer.flip(); ret = new byte[buffer.remaining()]; buffer.get(ret); } else { ret = buffer.array(); } return RubyString.bytesToString(ret); }
| 3,232,966
|
Form (final HttpServletRequest r) { _request = r; }
|
Form(final HttpServletRequest r) { _request = r; }
| 3,232,967
|
final public Object get (String field) { try { return _request.getParameterValues(field)[0]; } catch (NullPointerException ne) { return null; } }
|
final public Object get(String field) { try { return _request.getParameterValues(field)[0]; } catch (NullPointerException ne) { return null; } }
| 3,232,968
|
final public Object get (String field) { try { return _request.getParameterValues(field)[0]; } catch (NullPointerException ne) { return null; } }
|
final public Object get (String field) { try { return values[0]; } catch (NullPointerException ne) { return null; } }
| 3,232,969
|
final public Object[] getList (String field) { try { return _request.getParameterValues(field); } catch (NullPointerException ne) { return null; } }
|
final public Object[] getList(String field) { try { return _request.getParameterValues(field); } catch (NullPointerException ne) { return null; } }
| 3,232,971
|
final public Object getPossibleForm (String strKey) { String strElement; Object obValue; Enumeration obEnumeration; //--- end of var's declaration ---// obValue = get(strKey); if (obValue == null) { obEnumeration = _request.getParameterNames(); while (obEnumeration.hasMoreElements()) { strElement = obEnumeration.nextElement().toString(); if (strElement.equalsIgnoreCase(strKey)) { obValue = get(strElement); break; } } } return obValue; }
|
final public Object getPossibleForm(String strKey) { String strElement; Object obValue; Enumeration obEnumeration; //--- end of var's declaration ---// obValue = get(strKey); if (obValue == null) { obEnumeration = _request.getParameterNames(); while (obEnumeration.hasMoreElements()) { strElement = obEnumeration.nextElement().toString(); if (strElement.equalsIgnoreCase(strKey)) { obValue = get(strElement); break; } } } return obValue; }
| 3,232,972
|
final public void put (String key, Object value) throws UnsettableException { throw new UnsettableException("Cannot set a form property"); }
|
final public void put(String key, Object value) throws UnsettableException { throw new UnsettableException("Cannot set a form property"); }
| 3,232,973
|
void reverse(boolean b) { double yStart, yEnd; double xStaticStart, xStart; reverseIntensity = b; yEnd = endPt.getY(); yStart = startPt.getY(); setCursorOutputStart((int) yStart); setCursorOutputEnd((int) yEnd); manager.setOutputRectangles((int) yStart, (int) yEnd); xStaticStart = staticStartPt.getX(); xStart = startPt.getX(); startPt.setLocation(endPt.getX(), yStart); endPt.setLocation(xStart, yEnd); if (reverseIntensity) { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yEnd); repaintCurve(); } else { staticStartPt.setLocation((double) lS, yStart); staticEndPt.setLocation((double) leftBorder, yEnd); setControlLocation(coefficient); } } else { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yStart); repaintCurve(); } else { staticStartPt.setLocation((double) leftBorder, yStart); staticEndPt.setLocation((double) lS, yEnd); setControlLocation(coefficient); } } }
|
void reverse(boolean b) { double yStart, yEnd; double xStaticStart, xStart; reverseIntensity = b; yEnd = endPt.getY(); yStart = startPt.getY(); setCursorOutputStart((int) yStart); setCursorOutputEnd((int) yEnd); manager.setOutputRectangles((int) yStart, (int) yEnd); xStaticStart = staticStartPt.getX(); xStart = startPt.getX(); startPt.setLocation(endPt.getX(), yStart); endPt.setLocation(xStart, yEnd); if (reverseIntensity) { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yEnd); repaintCurve(); } else { staticStartPt.setLocation((double) lS, yStart); staticEndPt.setLocation((double) leftBorder, yEnd); setControlLocation(coefficient); } } else { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yStart); repaintCurve(); } else { staticStartPt.setLocation((double) leftBorder, yStart); staticEndPt.setLocation((double) lS, yEnd); setControlLocation(coefficient); } } }
| 3,232,974
|
void setControlsPoints(int t) { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = lS2; binMin = (int) ((square-40)/(2*rangeMinExpo)); binMax = (int) ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = (double) lS2; xStaticEnd = (double) leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = (double) lS2; xStaticStart = (double) leftBorder; } } else { xControl = lS; range = lS; double a; binMin = (int) (square/rangeMin); binMax = (int) (square/rangeMax); if (reverseIntensity) { a = (double) square/(staticStartPt.getX()-leftBorder); xStaticStart = (double) lS; xStaticEnd = (double) leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = (double) square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = (double) lS; xStaticStart = (double) leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); //Set Cursor location if (reverseIntensity) { setCursorStart((int) xEnd); setCursorEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setCursorStart((int) xStart); setCursorEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } }
|
void setControlsPoints(int t) { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = lS2; binMin = (int) ((square-40)/(2*rangeMinExpo)); binMax = (int) ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = (double) lS2; xStaticEnd = (double) leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = (double) lS2; xStaticStart = (double) leftBorder; } } else { xControl = lS; range = lS; double a; binMin = (int) (square/rangeMin); binMax = (int) (square/rangeMax); if (reverseIntensity) { a = (double) square/(staticStartPt.getX()-leftBorder); xStaticStart = (double) lS; xStaticEnd = (double) leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = (double) square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = (double) lS; xStaticStart = (double) leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); //Set Cursor location if (reverseIntensity) { setCursorStart((int) xEnd); setCursorEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setCursorStart((int) xStart); setCursorEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } }
| 3,232,975
|
void setControlsPoints(int t) { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = lS2; binMin = (int) ((square-40)/(2*rangeMinExpo)); binMax = (int) ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = (double) lS2; xStaticEnd = (double) leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = (double) lS2; xStaticStart = (double) leftBorder; } } else { xControl = lS; range = lS; double a; binMin = (int) (square/rangeMin); binMax = (int) (square/rangeMax); if (reverseIntensity) { a = (double) square/(staticStartPt.getX()-leftBorder); xStaticStart = (double) lS; xStaticEnd = (double) leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = (double) square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = (double) lS; xStaticStart = (double) leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); //Set Cursor location if (reverseIntensity) { setCursorStart((int) xEnd); setCursorEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setCursorStart((int) xStart); setCursorEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } }
|
void setControlsPoints(int t) { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = lS2; binMin = (int) ((square-40)/(2*rangeMinExpo)); binMax = (int) ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = (double) lS2; xStaticEnd = (double) leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = (double) lS2; xStaticStart = (double) leftBorder; } } else { xControl = lS; range = lS; double a; binMin = (int) (square/rangeMin); binMax = (int) (square/rangeMax); if (reverseIntensity) { a = (double) square/(staticStartPt.getX()-leftBorder); xStaticStart = (double) lS; xStaticEnd = (double) leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = (double) square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = (double) lS; xStaticStart = (double) leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); //Set Cursor location if (reverseIntensity) { setCursorStart((int) xEnd); setCursorEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setCursorStart((int) xStart); setCursorEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } }
| 3,232,976
|
void updateInputEnd(int x, int xReal) { curEnd = "end: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) endPt.getX()-triangleW; else limit = (int) startPt.getX()+triangleW; if (x >= limit) { setCursorEnd(x); b = false; if (reverseIntensity) startPt.setLocation((double) x, startPt.getY()); else endPt.setLocation((double) x, endPt.getY()); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation((double) x, endPt.getY()); else controlPt.setLocation((double) x, startPt.getY()); repaintCurve(); } else { setControlLocation(coefficient); } } //if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); if (b) super.repaint(); }
|
void updateInputEnd(int x, int xReal) { curEnd = "end: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) endPt.getX()-triangleW; else limit = (int) startPt.getX()+triangleW; if (x >= limit) { setCursorEnd(x); b = false; if (reverseIntensity) startPt.setLocation((double) x, startPt.getY()); else endPt.setLocation((double) x, endPt.getY()); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation((double) x, endPt.getY()); else controlPt.setLocation((double) x, startPt.getY()); repaintCurve(); } else { setControlLocation(coefficient); } } //if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); if (b) super.repaint(); }
| 3,232,977
|
void updateInputStart(int x, int xReal) { curStart = "start: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) startPt.getX()-triangleW; else limit = (int) endPt.getX()-triangleW; if (x <= limit) { xStartMax = x; b = false; setCursorStart(x); if (reverseIntensity) endPt.setLocation((double) x, endPt.getY()); else startPt.setLocation((double) x, startPt.getY()); if (type == QuantumFactory.EXPONENTIAL) repaintCurve(); else setControlLocation(coefficient); } //if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); if (b) super.repaint(); }
|
void updateInputStart(int x, int xReal) { curStart = "start: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) startPt.getX()-triangleW; else limit = (int) endPt.getX()-triangleW; if (x <= limit) { xStartMax = x; b = false; setCursorStart(x); if (reverseIntensity) endPt.setLocation((double) x, endPt.getY()); else startPt.setLocation((double) x, startPt.getY()); if (type == QuantumFactory.EXPONENTIAL) repaintCurve(); else setControlLocation(coefficient); } //if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); if (b) super.repaint(); }
| 3,232,978
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); // if no block passed, do a simple call if (iterNode == null) { return receiver.callMethod(context, iVisited.getName(), args, callType); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return receiver.callMethod(context, iVisited.getName(), args, callType); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass rubyClass; if (receiver.isNil()) { rubyClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { rubyClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { rubyClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } rubyClass = receiver.getSingletonClass(); } if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); // if no block passed, do a simple call if (iterNode == null) { return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return iVisited.getFixnum(runtime); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(context, iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; // new-style handling of blocks, for nodes that support it // don't process the block until it's needed, to avoid nasty iter tricks if (iVisited.getIterNode() instanceof BlockAcceptingNode) { ((BlockAcceptingNode)iVisited.getIterNode()).setIterNode(iVisited); node = iVisited.getIterNode(); continue bigloop; } // otherwise do it the same as the old way context.preIterEval(Block.createBlock(context, iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } try { return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } catch(java.util.regex.PatternSyntaxException e) { throw runtime.newSyntaxError(e.getMessage()); } } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("Superclass method '" + name + "' disabled.", name); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("superclass method '" + name + "' disabled", name); } return context.callSuper(context.getFrameArgs(), true); } } } while (true); }
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); // if no block passed, do a simple call if (iterNode == null) { return receiver.callMethod(context, iVisited.getName(), args, callType); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return receiver.callMethod(context, iVisited.getName(), args, callType); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass rubyClass; if (receiver.isNil()) { rubyClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { rubyClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { rubyClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } rubyClass = receiver.getSingletonClass(); } if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; IterNode iterNode = iVisited.getIterNode(); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); // if no block passed, do a simple call if (iterNode == null) { return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } // if block passed, prepare the block and then do the call, handling breaks and retries correctly context.preIterEval(Block.createBlock(context, iterNode.getVarNode(), new DynamicScope(iterNode.getScope(), context.getCurrentScope()), iterNode.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return iVisited.getFixnum(runtime); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(context, iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; // new-style handling of blocks, for nodes that support it // don't process the block until it's needed, to avoid nasty iter tricks if (iVisited.getIterNode() instanceof BlockAcceptingNode) { ((BlockAcceptingNode)iVisited.getIterNode()).setIterNode(iVisited); node = iVisited.getIterNode(); continue bigloop; } // otherwise do it the same as the old way context.preIterEval(Block.createBlock(context, iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } try { return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } catch(java.util.regex.PatternSyntaxException e) { throw runtime.newSyntaxError(e.getMessage()); } } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried if (!anotherExceptionRaised) runtime.getGlobalVariables().set("$!", globalExceptionState); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("Superclass method '" + name + "' disabled.", name); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { String name = context.getFrameLastFunc(); throw runtime.newNameError("superclass method '" + name + "' disabled", name); } return context.callSuper(context.getFrameArgs(), true); } } } while (true); }
| 3,232,979
|
private void joinTaggedRooms(Collection autoJoins) { Iterator joins = autoJoins.iterator(); while (joins.hasNext()) { Element autoJoin = (Element)joins.next(); String conferenceJID = autoJoin.getText(); autoJoinRooms.add(conferenceJID); ConferenceUtils.autoJoinConferenceRoom(conferenceJID, conferenceJID, null); } }
|
private void joinTaggedRooms(Collection autoJoins) { Iterator joins = autoJoins.iterator(); while (joins.hasNext()) { Element autoJoin = (Element)joins.next(); String conferenceJID = autoJoin.getText(); autoJoinRooms.add(conferenceJID); Iterator iter = bookmarks.iterator(); while (iter.hasNext()) { Bookmark bookmark = (Bookmark)iter.next(); if (bookmark.getRoomJID().equals(conferenceJID)) { ConferenceUtils.autoJoinConferenceRoom(bookmark.getRoomName(), conferenceJID, null); } } } }
| 3,232,980
|
private void setComponentsEnabled(boolean b) { saveButton.setEnabled(b); deleteBox.setEnabled(b); annotationArea.setEditable(b); if (b) { annotationArea.requestFocus(); annotationArea.selectAll(); } }
|
void setComponentsEnabled(boolean b) { saveButton.setEnabled(b); deleteBox.setEnabled(b); annotationArea.setEditable(b); if (b) { annotationArea.requestFocus(); annotationArea.selectAll(); } }
| 3,232,981
|
public static RubyModule createKernelModule(Ruby ruby) { RubyModule kernelModule = ruby.defineModule("Kernel"); kernelModule.defineMethod("puts", new ReflectionCallbackMethod(RBKernel.class, "m_puts", RubyObject[].class, true, true)); kernelModule.defineMethod("print", new ReflectionCallbackMethod(RBKernel.class, "m_print", RubyObject[].class, true, true)); kernelModule.defineMethod("to_s", getMethodToS()); return kernelModule; }
|
public static RubyModule createKernelModule(Ruby ruby) { RubyModule kernelModule = ruby.defineModule("Kernel"); kernelModule.defineMethod("puts", new ReflectionCallbackMethod(RBKernel.class, "m_puts", RubyObject[].class, true, true)); kernelModule.defineMethod("print", new ReflectionCallbackMethod(RBKernel.class, "m_print", RubyObject[].class, true, true)); kernelModule.defineMethod("to_s", getMethodToS()); return kernelModule; }
| 3,232,983
|
public RubyObject execute(RubyObject recv, RubyObject args[], Ruby ruby) { return recv.m_to_s(); }
|
public RubyObject execute(RubyObject recv, RubyObject args[], Ruby ruby) { return recv.m_to_s(); }
| 3,232,984
|
public static RubyObject m_puts(Ruby ruby, RubyObject args[]) { if (args.length == 0) { System.out.println(); } for (int i = 0; i < args.length; i++) { if (args[i] != null) { System.out.println(((RubyString)args[i].funcall(ruby.intern("to_s"))).getString()); } } return ruby.getNil(); }
|
public static RubyObject m_puts(Ruby ruby, RubyObject args[]) { if (args.length == 0) { System.out.println(); } for (int i = 0; i < args.length; i++) { if (args[i] != null) { System.out.println(((RubyString)args[i].funcall(ruby.intern("to_s"))).getString()); } } return ruby.getNil(); }
| 3,232,985
|
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (cla.getValid().booleanValue()) { // TODO do this in query categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { // OPTIMAL TODO looping over get!! // ??? Integer cId = (Integer) c.next(); Category2 ca = new Category2();//containerDao.loadC(cId));// TODO hql if (null == ca.images) ca.images = new HashSet(); ca.images.add(img); Integer cgId = ca.getCategoryGroup(); // and HERE ?? // FIXME CategoryGroup2 cg = new CategoryGroup2();//containerDao.loadCG(cgId)); // not a // collection?? if (cg == null) { hierarchies.add(ca); } else { if (null == cg.categories) cg.categories = new HashSet(); cg.categories.add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
|
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (cla.getValid().booleanValue()) { // TODO do this in query categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { // OPTIMAL TODO looping over get!! // ??? Integer cId = (Integer) c.next(); Category2 ca = new Category2();//containerDao.loadC(cId));// TODO hql if (null == ca.images) ca.images = new HashSet(); ca.images.add(img); Integer cgId = ca.getCategoryGroup(); // and HERE ?? // FIXME CategoryGroup2 cg = new CategoryGroup2();//containerDao.loadCG(cgId)); // not a // collection?? if (cg == null) { hierarchies.add(ca); } else { if (null == cg.categories) cg.categories = new HashSet(); cg.categories.add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
| 3,232,986
|
public XMLReport(ProjectData projectData, File destinationDir, FileFinder finder, ComplexityCalculator complexity) throws IOException { this.complexity = complexity; this.finder = finder; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
|
public XMLReport(ProjectData projectData, File destinationDir, FileFinder finder, ComplexityCalculator complexity) throws IOException { this.complexity = complexity; this.finder = finder; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
| 3,232,987
|
public IRubyObject at(IRubyObject obj) { return entry(RubyNumeric.numericValue(obj).getLongValue()); }
|
public IRubyObject at(IRubyObject obj) { return entry(RubyNumeric.numericValue(obj).getLongValue()); }
| 3,232,988
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.