Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / java / util / regex / Matcher.js
index 545f370..d46c4db 100644 (file)
-Clazz.declarePackage("java.util.regex");\r
-Clazz.load(["java.util.regex.MatchResult"],"java.util.regex.Matcher",["java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","$.NullPointerException","$.StringBuffer"],function(){\r
-c$=Clazz.decorateAsClass(function(){\r
-this.pat=null;\r
-this.string=null;\r
-this.leftBound=-1;\r
-this.rightBound=-1;\r
-this.appendPos=0;\r
-this.replacement=null;\r
-this.processedRepl=null;\r
-this.replacementParts=null;\r
-this.results=null;\r
-Clazz.instantialize(this,arguments);\r
-},java.util.regex,"Matcher",null,java.util.regex.MatchResult);\r
-Clazz.defineMethod(c$,"appendReplacement",\r
-function(sb,replacement){\r
-this.processedRepl=this.processReplacement(replacement);\r
-sb.append(this.string.subSequence(this.appendPos,this.start()));\r
-sb.append(this.processedRepl);\r
-this.appendPos=this.end();\r
-return this;\r
-},"StringBuffer,~S");\r
-Clazz.defineMethod(c$,"processReplacement",\r
-($fz=function(replacement){\r
-if(this.replacement!=null&&this.replacement.equals(replacement)){\r
-if(this.replacementParts==null){\r
-return this.processedRepl;\r
-}else{\r
-var sb=new StringBuffer();\r
-for(var i=0;i<this.replacementParts.length;i++){\r
-sb.append(this.replacementParts[i]);\r
-}\r
-return sb.toString();\r
-}}else{\r
-this.replacement=replacement;\r
-var repl=replacement.toCharArray();\r
-var res=new StringBuffer();\r
-this.replacementParts=null;\r
-var index=0;\r
-var replacementPos=0;\r
-var nextBackSlashed=false;\r
-while(index<repl.length){\r
-if((repl[index]).charCodeAt(0)==('\\').charCodeAt(0)&&!nextBackSlashed){\r
-nextBackSlashed=true;\r
-index++;\r
-}if(nextBackSlashed){\r
-res.append(repl[index]);\r
-nextBackSlashed=false;\r
-}else{\r
-if((repl[index]).charCodeAt(0)==('$').charCodeAt(0)){\r
-if(this.replacementParts==null){\r
-this.replacementParts=new Array(0);\r
-}try{\r
-var gr=Integer.parseInt(String.instantialize(repl,++index,1));\r
-if(replacementPos!=res.length()){\r
-this.replacementParts[this.replacementParts.length]=res.subSequence(replacementPos,res.length());\r
-replacementPos=res.length();\r
-}this.replacementParts[this.replacementParts.length]=((Clazz.isClassDefined("java.util.regex.Matcher$1")?0:java.util.regex.Matcher.$Matcher$1$()),Clazz.innerTypeInstance(java.util.regex.Matcher$1,this,null));\r
-var group=this.group(gr);\r
-replacementPos+=group.length;\r
-res.append(group);\r
-}catch(e$$){\r
-if(Clazz.instanceOf(e$$,IndexOutOfBoundsException)){\r
-var iob=e$$;\r
-{\r
-throw iob;\r
-}\r
-}else if(Clazz.instanceOf(e$$,Exception)){\r
-var e=e$$;\r
-{\r
-throw new IllegalArgumentException("Illegal regular expression format");\r
-}\r
-}else{\r
-throw e$$;\r
-}\r
-}\r
-}else{\r
-res.append(repl[index]);\r
-}}index++;\r
-}\r
-if(this.replacementParts!=null&&replacementPos!=res.length()){\r
-this.replacementParts[this.replacementParts.length]=res.subSequence(replacementPos,res.length());\r
-}return res.toString();\r
-}},$fz.isPrivate=true,$fz),"~S");\r
-Clazz.defineMethod(c$,"reset",\r
-function(newSequence){\r
-if(newSequence==null){\r
-throw new NullPointerException("Empty new sequence!");\r
-}this.string=newSequence;\r
-return this.reset();\r
-},"CharSequence");\r
-Clazz.defineMethod(c$,"reset",\r
-function(){\r
-this.leftBound=0;\r
-this.rightBound=this.string.length();\r
-this.appendPos=0;\r
-this.replacement=null;\r
-{\r
-var flags=""+(this.pat.regexp.ignoreCase?"i":"")\r
-+(this.pat.regexp.global?"g":"")\r
-+(this.pat.regexp.multiline?"m":"");\r
-this.pat.regexp=new RegExp(this.pat.regexp.source,flags);\r
-}return this;\r
-});\r
-Clazz.defineMethod(c$,"region",\r
-function(leftBound,rightBound){\r
-if(leftBound>rightBound||leftBound<0||rightBound<0||leftBound>this.string.length()||rightBound>this.string.length()){\r
-throw new IndexOutOfBoundsException(leftBound+" is out of bound of "+rightBound);\r
-}this.leftBound=leftBound;\r
-this.rightBound=rightBound;\r
-this.results=null;\r
-this.appendPos=0;\r
-this.replacement=null;\r
-return this;\r
-},"~N,~N");\r
-Clazz.defineMethod(c$,"appendTail",\r
-function(sb){\r
-return sb.append(this.string.subSequence(this.appendPos,this.string.length()));\r
-},"StringBuffer");\r
-Clazz.defineMethod(c$,"replaceFirst",\r
-function(replacement){\r
-this.reset();\r
-if(this.find()){\r
-var sb=new StringBuffer();\r
-this.appendReplacement(sb,replacement);\r
-return this.appendTail(sb).toString();\r
-}return this.string.toString();\r
-},"~S");\r
-Clazz.defineMethod(c$,"replaceAll",\r
-function(replacement){\r
-var sb=new StringBuffer();\r
-this.reset();\r
-while(this.find()){\r
-this.appendReplacement(sb,replacement);\r
-}\r
-return this.appendTail(sb).toString();\r
-},"~S");\r
-Clazz.defineMethod(c$,"pattern",\r
-function(){\r
-return this.pat;\r
-});\r
-Clazz.defineMethod(c$,"group",\r
-function(groupIndex){\r
-if(this.results==null||groupIndex<0||groupIndex>this.results.length){\r
-return null;\r
-}return this.results[groupIndex];\r
-},"~N");\r
-Clazz.defineMethod(c$,"group",\r
-function(){\r
-return this.group(0);\r
-});\r
-Clazz.defineMethod(c$,"find",\r
-function(startIndex){\r
-var stringLength=this.string.length();\r
-if(startIndex<0||startIndex>stringLength)throw new IndexOutOfBoundsException("Out of bound "+startIndex);\r
-startIndex=this.findAt(startIndex);\r
-return false;\r
-},"~N");\r
-Clazz.defineMethod(c$,"findAt",\r
-($fz=function(startIndex){\r
-return-1;\r
-},$fz.isPrivate=true,$fz),"~N");\r
-Clazz.defineMethod(c$,"find",\r
-function(){\r
-{\r
-this.results=this.pat.regexp.exec(this.string.subSequence(this.leftBound,this.rightBound));\r
-}return(this.results!=null);\r
-});\r
-Clazz.defineMethod(c$,"start",\r
-function(groupIndex){\r
-var beginningIndex=0;\r
-{\r
-beginningIndex=this.pat.regexp.lastIndex;\r
-}beginningIndex-=this.results[0].length;\r
-return beginningIndex;\r
-},"~N");\r
-Clazz.defineMethod(c$,"end",\r
-function(groupIndex){\r
-{\r
-return this.pat.regexp.lastIndex;\r
-}return-1;\r
-},"~N");\r
-Clazz.defineMethod(c$,"matches",\r
-function(){\r
-return this.find();\r
-});\r
-c$.quoteReplacement=Clazz.defineMethod(c$,"quoteReplacement",\r
-function(string){\r
-if(string.indexOf('\\') < 0 && string.indexOf ('$')<0)return string;\r
-var res=new StringBuffer(string.length*2);\r
-var ch;\r
-var len=string.length;\r
-for(var i=0;i<len;i++){\r
-switch(ch=string.charAt(i)){\r
-case'$':\r
-res.append('\\');\r
-res.append('$');\r
-break;\r
-case'\\':\r
-res.append('\\');\r
-res.append('\\');\r
-break;\r
-default:\r
-res.append(ch);\r
-}\r
-}\r
-return res.toString();\r
-},"~S");\r
-Clazz.defineMethod(c$,"lookingAt",\r
-function(){\r
-return false;\r
-});\r
-Clazz.defineMethod(c$,"start",\r
-function(){\r
-return this.start(0);\r
-});\r
-Clazz.overrideMethod(c$,"groupCount",\r
-function(){\r
-return this.results==null?0:this.results.length;\r
-});\r
-Clazz.defineMethod(c$,"end",\r
-function(){\r
-return this.end(0);\r
-});\r
-Clazz.defineMethod(c$,"toMatchResult",\r
-function(){\r
-return this;\r
-});\r
-Clazz.defineMethod(c$,"useAnchoringBounds",\r
-function(value){\r
-return this;\r
-},"~B");\r
-Clazz.defineMethod(c$,"hasAnchoringBounds",\r
-function(){\r
-return false;\r
-});\r
-Clazz.defineMethod(c$,"useTransparentBounds",\r
-function(value){\r
-return this;\r
-},"~B");\r
-Clazz.defineMethod(c$,"hasTransparentBounds",\r
-function(){\r
-return false;\r
-});\r
-Clazz.defineMethod(c$,"regionStart",\r
-function(){\r
-return this.leftBound;\r
-});\r
-Clazz.defineMethod(c$,"regionEnd",\r
-function(){\r
-return this.rightBound;\r
-});\r
-Clazz.defineMethod(c$,"requireEnd",\r
-function(){\r
-return false;\r
-});\r
-Clazz.defineMethod(c$,"hitEnd",\r
-function(){\r
-return false;\r
-});\r
-Clazz.defineMethod(c$,"usePattern",\r
-function(pat){\r
-if(pat==null){\r
-throw new IllegalArgumentException("Empty pattern!");\r
-}this.pat=pat;\r
-this.results=null;\r
-return this;\r
-},"java.util.regex.Pattern");\r
-Clazz.makeConstructor(c$,\r
-function(pat,cs){\r
-this.pat=pat;\r
-this.string=cs;\r
-this.leftBound=0;\r
-this.rightBound=this.string.toString().length;\r
-},"java.util.regex.Pattern,CharSequence");\r
-c$.$Matcher$1$=function(){\r
-Clazz.pu$h(self.c$);\r
-c$=Clazz.decorateAsClass(function(){\r
-Clazz.prepareCallback(this,arguments);\r
-this.grN=0;\r
-Clazz.instantialize(this,arguments);\r
-},java.util.regex,"Matcher$1");\r
-Clazz.prepareFields(c$,function(){\r
-this.grN=gr;\r
-});\r
-Clazz.overrideMethod(c$,"toString",\r
-function(){\r
-return this.b$["java.util.regex.Matcher"].group(this.grN);\r
-});\r
-c$=Clazz.p0p();\r
-};\r
-Clazz.defineStatics(c$,\r
-"MODE_FIND",1,\r
-"MODE_MATCH",2);\r
-});\r
+Clazz.declarePackage("java.util.regex");
+Clazz.load(["java.util.regex.MatchResult"],"java.util.regex.Matcher",["java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","$.NullPointerException","$.StringBuffer"],function(){
+c$=Clazz.decorateAsClass(function(){
+this.pat=null;
+this.string=null;
+this.leftBound=-1;
+this.rightBound=-1;
+this.appendPos=0;
+this.replacement=null;
+this.processedRepl=null;
+this.replacementParts=null;
+this.results=null;
+Clazz.instantialize(this,arguments);
+},java.util.regex,"Matcher",null,java.util.regex.MatchResult);
+Clazz.defineMethod(c$,"appendReplacement",
+function(sb,replacement){
+this.processedRepl=this.processReplacement(replacement);
+sb.append(this.string.subSequence(this.appendPos,this.start()));
+sb.append(this.processedRepl);
+this.appendPos=this.end();
+return this;
+},"StringBuffer,~S");
+Clazz.defineMethod(c$,"processReplacement",
+($fz=function(replacement){
+if(this.replacement!=null&&this.replacement.equals(replacement)){
+if(this.replacementParts==null){
+return this.processedRepl;
+}else{
+var sb=new StringBuffer();
+for(var i=0;i<this.replacementParts.length;i++){
+sb.append(this.replacementParts[i]);
+}
+return sb.toString();
+}}else{
+this.replacement=replacement;
+var repl=replacement.toCharArray();
+var res=new StringBuffer();
+this.replacementParts=null;
+var index=0;
+var replacementPos=0;
+var nextBackSlashed=false;
+while(index<repl.length){
+if((repl[index]).charCodeAt(0)==('\\').charCodeAt(0)&&!nextBackSlashed){
+nextBackSlashed=true;
+index++;
+}if(nextBackSlashed){
+res.append(repl[index]);
+nextBackSlashed=false;
+}else{
+if((repl[index]).charCodeAt(0)==('$').charCodeAt(0)){
+if(this.replacementParts==null){
+this.replacementParts=new Array(0);
+}try{
+var gr=Integer.parseInt(String.instantialize(repl,++index,1));
+if(replacementPos!=res.length()){
+this.replacementParts[this.replacementParts.length]=res.subSequence(replacementPos,res.length());
+replacementPos=res.length();
+}this.replacementParts[this.replacementParts.length]=((Clazz.isClassDefined("java.util.regex.Matcher$1")?0:java.util.regex.Matcher.$Matcher$1$()),Clazz.innerTypeInstance(java.util.regex.Matcher$1,this,null));
+var group=this.group(gr);
+replacementPos+=group.length;
+res.append(group);
+}catch(e$$){
+if(Clazz.instanceOf(e$$,IndexOutOfBoundsException)){
+var iob=e$$;
+{
+throw iob;
+}
+}else if(Clazz.instanceOf(e$$,Exception)){
+var e=e$$;
+{
+throw new IllegalArgumentException("Illegal regular expression format");
+}
+}else{
+throw e$$;
+}
+}
+}else{
+res.append(repl[index]);
+}}index++;
+}
+if(this.replacementParts!=null&&replacementPos!=res.length()){
+this.replacementParts[this.replacementParts.length]=res.subSequence(replacementPos,res.length());
+}return res.toString();
+}},$fz.isPrivate=true,$fz),"~S");
+Clazz.defineMethod(c$,"reset",
+function(newSequence){
+if(newSequence==null){
+throw new NullPointerException("Empty new sequence!");
+}this.string=newSequence;
+return this.reset();
+},"CharSequence");
+Clazz.defineMethod(c$,"reset",
+function(){
+this.leftBound=0;
+this.rightBound=this.string.length();
+this.appendPos=0;
+this.replacement=null;
+{
+var flags=""+(this.pat.regexp.ignoreCase?"i":"")
++(this.pat.regexp.global?"g":"")
++(this.pat.regexp.multiline?"m":"");
+this.pat.regexp=new RegExp(this.pat.regexp.source,flags);
+}return this;
+});
+Clazz.defineMethod(c$,"region",
+function(leftBound,rightBound){
+if(leftBound>rightBound||leftBound<0||rightBound<0||leftBound>this.string.length()||rightBound>this.string.length()){
+throw new IndexOutOfBoundsException(leftBound+" is out of bound of "+rightBound);
+}this.leftBound=leftBound;
+this.rightBound=rightBound;
+this.results=null;
+this.appendPos=0;
+this.replacement=null;
+return this;
+},"~N,~N");
+Clazz.defineMethod(c$,"appendTail",
+function(sb){
+return sb.append(this.string.subSequence(this.appendPos,this.string.length()));
+},"StringBuffer");
+Clazz.defineMethod(c$,"replaceFirst",
+function(replacement){
+this.reset();
+if(this.find()){
+var sb=new StringBuffer();
+this.appendReplacement(sb,replacement);
+return this.appendTail(sb).toString();
+}return this.string.toString();
+},"~S");
+Clazz.defineMethod(c$,"replaceAll",
+function(replacement){
+var sb=new StringBuffer();
+this.reset();
+while(this.find()){
+this.appendReplacement(sb,replacement);
+}
+return this.appendTail(sb).toString();
+},"~S");
+Clazz.defineMethod(c$,"pattern",
+function(){
+return this.pat;
+});
+Clazz.defineMethod(c$,"group",
+function(groupIndex){
+if(this.results==null||groupIndex<0||groupIndex>this.results.length){
+return null;
+}return this.results[groupIndex];
+},"~N");
+Clazz.defineMethod(c$,"group",
+function(){
+return this.group(0);
+});
+Clazz.defineMethod(c$,"find",
+function(startIndex){
+var stringLength=this.string.length();
+if(startIndex<0||startIndex>stringLength)throw new IndexOutOfBoundsException("Out of bound "+startIndex);
+startIndex=this.findAt(startIndex);
+return false;
+},"~N");
+Clazz.defineMethod(c$,"findAt",
+($fz=function(startIndex){
+return-1;
+},$fz.isPrivate=true,$fz),"~N");
+Clazz.defineMethod(c$,"find",
+function(){
+{
+this.results=this.pat.regexp.exec(this.string.subSequence(this.leftBound,this.rightBound));
+}return(this.results!=null);
+});
+Clazz.defineMethod(c$,"start",
+function(groupIndex){
+var beginningIndex=0;
+{
+beginningIndex=this.pat.regexp.lastIndex;
+}beginningIndex-=this.results[0].length;
+return beginningIndex;
+},"~N");
+Clazz.defineMethod(c$,"end",
+function(groupIndex){
+{
+return this.pat.regexp.lastIndex;
+}return-1;
+},"~N");
+Clazz.defineMethod(c$,"matches",
+function(){
+return this.find();
+});
+c$.quoteReplacement=Clazz.defineMethod(c$,"quoteReplacement",
+function(string){
+if(string.indexOf('\\') < 0 && string.indexOf ('$')<0)return string;
+var res=new StringBuffer(string.length*2);
+var ch;
+var len=string.length;
+for(var i=0;i<len;i++){
+switch(ch=string.charAt(i)){
+case'$':
+res.append('\\');
+res.append('$');
+break;
+case'\\':
+res.append('\\');
+res.append('\\');
+break;
+default:
+res.append(ch);
+}
+}
+return res.toString();
+},"~S");
+Clazz.defineMethod(c$,"lookingAt",
+function(){
+return false;
+});
+Clazz.defineMethod(c$,"start",
+function(){
+return this.start(0);
+});
+Clazz.overrideMethod(c$,"groupCount",
+function(){
+return this.results==null?0:this.results.length;
+});
+Clazz.defineMethod(c$,"end",
+function(){
+return this.end(0);
+});
+Clazz.defineMethod(c$,"toMatchResult",
+function(){
+return this;
+});
+Clazz.defineMethod(c$,"useAnchoringBounds",
+function(value){
+return this;
+},"~B");
+Clazz.defineMethod(c$,"hasAnchoringBounds",
+function(){
+return false;
+});
+Clazz.defineMethod(c$,"useTransparentBounds",
+function(value){
+return this;
+},"~B");
+Clazz.defineMethod(c$,"hasTransparentBounds",
+function(){
+return false;
+});
+Clazz.defineMethod(c$,"regionStart",
+function(){
+return this.leftBound;
+});
+Clazz.defineMethod(c$,"regionEnd",
+function(){
+return this.rightBound;
+});
+Clazz.defineMethod(c$,"requireEnd",
+function(){
+return false;
+});
+Clazz.defineMethod(c$,"hitEnd",
+function(){
+return false;
+});
+Clazz.defineMethod(c$,"usePattern",
+function(pat){
+if(pat==null){
+throw new IllegalArgumentException("Empty pattern!");
+}this.pat=pat;
+this.results=null;
+return this;
+},"java.util.regex.Pattern");
+Clazz.makeConstructor(c$,
+function(pat,cs){
+this.pat=pat;
+this.string=cs;
+this.leftBound=0;
+this.rightBound=this.string.toString().length;
+},"java.util.regex.Pattern,CharSequence");
+c$.$Matcher$1$=function(){
+Clazz.pu$h(self.c$);
+c$=Clazz.decorateAsClass(function(){
+Clazz.prepareCallback(this,arguments);
+this.grN=0;
+Clazz.instantialize(this,arguments);
+},java.util.regex,"Matcher$1");
+Clazz.prepareFields(c$,function(){
+this.grN=gr;
+});
+Clazz.overrideMethod(c$,"toString",
+function(){
+return this.b$["java.util.regex.Matcher"].group(this.grN);
+});
+c$=Clazz.p0p();
+};
+Clazz.defineStatics(c$,
+"MODE_FIND",1,
+"MODE_MATCH",2);
+});