JAL-1807 test
[jalviewjs.git] / bin / com / stevesoft / pat / RegexWriter.js
index 817515b..f1be88e 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");\r
-Clazz.load (["java.io.Writer", "com.stevesoft.pat.PartialBuffer", "java.lang.StringBuffer"], "com.stevesoft.pat.RegexWriter", ["com.stevesoft.pat.StringBufferLike", "com.stevesoft.pat.wrap.WriterWrap"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.repr = null;\r
-this.w = null;\r
-this.ww = null;\r
-this.sb = null;\r
-this.wrap = null;\r
-this.pos = 0;\r
-this.epos = 0;\r
-this.interval = 128;\r
-this.bufferSize = 2048;\r
-this.EOLchar = '\n';\r
-this.max_lines = 2;\r
-Clazz.instantialize (this, arguments);\r
-}, com.stevesoft.pat, "RegexWriter", java.io.Writer);\r
-Clazz.prepareFields (c$, function () {\r
-this.sb =  new StringBuffer ();\r
-this.wrap =  new com.stevesoft.pat.PartialBuffer (this.sb);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (t, w) {\r
-Clazz.superConstructor (this, com.stevesoft.pat.RegexWriter, []);\r
-this.w = w;\r
-this.ww =  new com.stevesoft.pat.wrap.WriterWrap (w);\r
-this.repr = t.getReplacer ();\r
-this.repr.setBuffer ( new com.stevesoft.pat.StringBufferLike (this.ww));\r
-this.repr.setSource (this.wrap);\r
-}, "com.stevesoft.pat.Transformer,java.io.Writer");\r
-Clazz.makeConstructor (c$, \r
-function (r, w) {\r
-Clazz.superConstructor (this, com.stevesoft.pat.RegexWriter, []);\r
-this.w = w;\r
-this.ww =  new com.stevesoft.pat.wrap.WriterWrap (w);\r
-this.repr = r.getReplacer ();\r
-this.repr.setBuffer ( new com.stevesoft.pat.StringBufferLike (this.ww));\r
-this.repr.setSource (this.wrap);\r
-}, "com.stevesoft.pat.Regex,java.io.Writer");\r
-Clazz.defineMethod (c$, "getEOLchar", \r
-function () {\r
-return this.EOLchar;\r
-});\r
-Clazz.defineMethod (c$, "setEOLchar", \r
-function (c) {\r
-this.EOLchar = c;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getMaxLines", \r
-function () {\r
-return this.max_lines;\r
-});\r
-Clazz.defineMethod (c$, "setMaxLines", \r
-function (ml) {\r
-this.max_lines = ml;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "write", \r
-function () {\r
-var rex = this.repr.getRegex ();\r
-var eposOld = this.epos;\r
-if (rex.matchAtLike (this.wrap, this.epos) && !this.wrap.overRun) {\r
-while (this.pos < this.epos) {\r
-this.w.write (this.sb.charCodeAt (this.pos++));\r
-}\r
-var to = rex.matchedTo ();\r
-this.repr.setPos (to);\r
-this.repr.apply (rex, rex.getReplaceRule ());\r
-this.epos = this.pos = to;\r
-if (this.epos == eposOld && this.epos < this.sb.length ()) {\r
-this.epos++;\r
-}} else if (!this.wrap.overRun && this.epos < this.sb.length ()) {\r
-this.epos++;\r
-}while (this.pos < this.epos) {\r
-this.w.write (this.sb.charCodeAt (this.pos++));\r
-}\r
-if (this.epos == this.sb.length ()) {\r
-this.sb.setLength (1);\r
-this.pos = this.epos = 1;\r
-} else if (this.pos > this.bufferSize) {\r
-for (var i = this.bufferSize; i < this.sb.length (); i++) {\r
-this.sb.setCharAt (i - this.bufferSize, this.sb.charAt (i));\r
-}\r
-this.pos -= this.bufferSize;\r
-this.epos -= this.bufferSize;\r
-this.sb.setLength (this.sb.length () - this.bufferSize);\r
-}});\r
-Clazz.defineMethod (c$, "write", \r
-function (ca, b, n) {\r
-var m = b + n;\r
-for (var i = b; i < m; i++) {\r
-this.sb.append (ca[i]);\r
-if (this.sb.length () % this.interval == this.interval - 1) {\r
-this.wrap.overRun = false;\r
-while (this.epos + this.interval < this.sb.length () && !this.wrap.overRun) {\r
-this.write ();\r
-}\r
-}}\r
-}, "~A,~N,~N");\r
-Clazz.overrideMethod (c$, "flush", \r
-function () {\r
-});\r
-Clazz.defineMethod (c$, "close", \r
-function () {\r
-this.wrap.allowOverRun = false;\r
-this.wrap.overRun = false;\r
-while (this.epos < this.sb.length ()) {\r
-this.write ();\r
-}\r
-this.write ();\r
-this.w.close ();\r
-});\r
-Clazz.defineMethod (c$, "length", \r
-function () {\r
-return this.sb.length ();\r
-});\r
-Clazz.defineMethod (c$, "charAt", \r
-function (i) {\r
-return this.sb.charAt (i);\r
-}, "~N");\r
-Clazz.defineMethod (c$, "setInterval", \r
-function (i) {\r
-this.interval = i;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getInterval", \r
-function () {\r
-return this.interval;\r
-});\r
-Clazz.defineMethod (c$, "getBufferSize", \r
-function () {\r
-return this.bufferSize;\r
-});\r
-Clazz.defineMethod (c$, "setBufferSize", \r
-function (i) {\r
-this.bufferSize = i;\r
-}, "~N");\r
-});\r
+Clazz.declarePackage ("com.stevesoft.pat");
+Clazz.load (["java.io.Writer", "com.stevesoft.pat.PartialBuffer", "java.lang.StringBuffer"], "com.stevesoft.pat.RegexWriter", ["com.stevesoft.pat.StringBufferLike", "com.stevesoft.pat.wrap.WriterWrap"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.repr = null;
+this.w = null;
+this.ww = null;
+this.sb = null;
+this.wrap = null;
+this.pos = 0;
+this.epos = 0;
+this.interval = 128;
+this.bufferSize = 2048;
+this.EOLchar = '\n';
+this.max_lines = 2;
+Clazz.instantialize (this, arguments);
+}, com.stevesoft.pat, "RegexWriter", java.io.Writer);
+Clazz.prepareFields (c$, function () {
+this.sb =  new StringBuffer ();
+this.wrap =  new com.stevesoft.pat.PartialBuffer (this.sb);
+});
+Clazz.makeConstructor (c$, 
+function (t, w) {
+Clazz.superConstructor (this, com.stevesoft.pat.RegexWriter, []);
+this.w = w;
+this.ww =  new com.stevesoft.pat.wrap.WriterWrap (w);
+this.repr = t.getReplacer ();
+this.repr.setBuffer ( new com.stevesoft.pat.StringBufferLike (this.ww));
+this.repr.setSource (this.wrap);
+}, "com.stevesoft.pat.Transformer,java.io.Writer");
+Clazz.makeConstructor (c$, 
+function (r, w) {
+Clazz.superConstructor (this, com.stevesoft.pat.RegexWriter, []);
+this.w = w;
+this.ww =  new com.stevesoft.pat.wrap.WriterWrap (w);
+this.repr = r.getReplacer ();
+this.repr.setBuffer ( new com.stevesoft.pat.StringBufferLike (this.ww));
+this.repr.setSource (this.wrap);
+}, "com.stevesoft.pat.Regex,java.io.Writer");
+Clazz.defineMethod (c$, "getEOLchar", 
+function () {
+return this.EOLchar;
+});
+Clazz.defineMethod (c$, "setEOLchar", 
+function (c) {
+this.EOLchar = c;
+}, "~S");
+Clazz.defineMethod (c$, "getMaxLines", 
+function () {
+return this.max_lines;
+});
+Clazz.defineMethod (c$, "setMaxLines", 
+function (ml) {
+this.max_lines = ml;
+}, "~N");
+Clazz.defineMethod (c$, "write", 
+function () {
+var rex = this.repr.getRegex ();
+var eposOld = this.epos;
+if (rex.matchAtLike (this.wrap, this.epos) && !this.wrap.overRun) {
+while (this.pos < this.epos) {
+this.w.write (this.sb.charCodeAt (this.pos++));
+}
+var to = rex.matchedTo ();
+this.repr.setPos (to);
+this.repr.apply (rex, rex.getReplaceRule ());
+this.epos = this.pos = to;
+if (this.epos == eposOld && this.epos < this.sb.length ()) {
+this.epos++;
+}} else if (!this.wrap.overRun && this.epos < this.sb.length ()) {
+this.epos++;
+}while (this.pos < this.epos) {
+this.w.write (this.sb.charCodeAt (this.pos++));
+}
+if (this.epos == this.sb.length ()) {
+this.sb.setLength (1);
+this.pos = this.epos = 1;
+} else if (this.pos > this.bufferSize) {
+for (var i = this.bufferSize; i < this.sb.length (); i++) {
+this.sb.setCharAt (i - this.bufferSize, this.sb.charAt (i));
+}
+this.pos -= this.bufferSize;
+this.epos -= this.bufferSize;
+this.sb.setLength (this.sb.length () - this.bufferSize);
+}});
+Clazz.defineMethod (c$, "write", 
+function (ca, b, n) {
+var m = b + n;
+for (var i = b; i < m; i++) {
+this.sb.append (ca[i]);
+if (this.sb.length () % this.interval == this.interval - 1) {
+this.wrap.overRun = false;
+while (this.epos + this.interval < this.sb.length () && !this.wrap.overRun) {
+this.write ();
+}
+}}
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "flush", 
+function () {
+});
+Clazz.defineMethod (c$, "close", 
+function () {
+this.wrap.allowOverRun = false;
+this.wrap.overRun = false;
+while (this.epos < this.sb.length ()) {
+this.write ();
+}
+this.write ();
+this.w.close ();
+});
+Clazz.defineMethod (c$, "length", 
+function () {
+return this.sb.length ();
+});
+Clazz.defineMethod (c$, "charAt", 
+function (i) {
+return this.sb.charAt (i);
+}, "~N");
+Clazz.defineMethod (c$, "setInterval", 
+function (i) {
+this.interval = i;
+}, "~N");
+Clazz.defineMethod (c$, "getInterval", 
+function () {
+return this.interval;
+});
+Clazz.defineMethod (c$, "getBufferSize", 
+function () {
+return this.bufferSize;
+});
+Clazz.defineMethod (c$, "setBufferSize", 
+function (i) {
+this.bufferSize = i;
+}, "~N");
+});