Skip to content

Commit 20b6561

Browse files
committed
SwingJS support
1 parent 7f1267c commit 20b6561

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed
-3.74 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200501154159
1+
20200504090455
-3.74 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200501154159
1+
20200504090455
-3.74 KB
Binary file not shown.

sources/net.sf.j2s.java.core/srcjs/swingjs2.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15123,6 +15123,11 @@ var addProfileNew = function(c, t) {
1512315123
s += "[]";
1512415124
t = 0;
1512515125
}
15126+
if (J2S._traceOutput && (s.indexOf(J2S._traceOutput) >= 0 || '"' + s + '"' == J2S._traceOutput)) {
15127+
alert(s + "\n\n" + Clazz._getStackTrace());
15128+
doDebugger();
15129+
}
15130+
1512615131
var p = _profileNew[s];
1512715132
p || (p = _profileNew[s] = [0,0]);
1512815133
p[0]++;
@@ -18549,25 +18554,36 @@ CharSequence.$defaults$(String);
1854918554
sp.compareToIgnoreCase$S = function(str) { return String.CASE_INSENSITIVE_ORDER.compare$S$S(this, str);}
1855018555

1855118556
sp.replace$ = function(c1,c2){
18552-
if (c1 == c2 || this.indexOf (c1) < 0) return "" + this;
18557+
if (c1 == c2 || this.indexOf(c1) < 0) return "" + this;
1855318558
if (c1.length == 1) {
1855418559
if ("\\$.*+|?^{}()[]".indexOf(c1) >= 0)
1855518560
c1 = "\\" + c1;
1855618561
} else {
18557-
c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){
18558-
return "\\"+$1;
18559-
});
18562+
c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return "\\"+$1;});
1856018563
}
1856118564
return this.replace(new RegExp(c1,"gm"),c2);
1856218565
};
1856318566

18564-
sp.replaceAll$S$S=sp.replaceAll$CharSequence$CharSequence=function(exp,str){
18565-
var regExp=new RegExp(exp,"gm");
18566-
return this.replace(regExp,str);
18567+
// experimental -- only marginally faster:
18568+
var reCache = new Map();
18569+
sp.replace2$ = function(c1,c2){
18570+
if (c1 == c2 || this.indexOf(c1) < 0) return "" + this;
18571+
var re;
18572+
if (c1.length == 1) {
18573+
re = reCache.get(c1);
18574+
re || reCache.set(c1, re = new RegExp("\\$.*+|?^{}()[]".indexOf(c1) == 0 ? "\\" + c1 : c1, 'gm'));
18575+
} else {
18576+
re = new RegExp(c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return "\\"+$1;}), 'gm');
18577+
}
18578+
return this.replace(re,c2);
18579+
};
18580+
18581+
// fastest:
18582+
sp.replaceAll$=sp.replaceAll$S$S=sp.replaceAll$CharSequence$CharSequence=function(exp,str){
18583+
return this.replace(new RegExp(exp,"gm"),str);
1856718584
};
1856818585
sp.replaceFirst$S$S=function(exp,str){
18569-
var regExp=new RegExp(exp,"m");
18570-
return this.replace(regExp,str);
18586+
return this.replace(new RegExp(exp,"m"),str);
1857118587
};
1857218588
sp.matches$S=function(exp){
1857318589
if(exp!=null){

0 commit comments

Comments
 (0)