X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FStringBufferLike.java;h=96d21789a2614df08872cd62a15e2df04ba05bc1;hb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;hp=18fa994dc9f9e1817c2428c0bd26bc53d0aa1282;hpb=dd74fc4938723fe5ec48d4e5fdcfbe58ac42a48d;p=jalview.git diff --git a/src/com/stevesoft/pat/StringBufferLike.java b/src/com/stevesoft/pat/StringBufferLike.java index 18fa994..96d2178 100755 --- a/src/com/stevesoft/pat/StringBufferLike.java +++ b/src/com/stevesoft/pat/StringBufferLike.java @@ -1,64 +1,90 @@ -package// +package // // This software is now distributed according to // the Lesser Gnu Public License. Please see // http://www.gnu.org/copyleft/lesser.txt for // the details. // -- Happy Computing! // -com.stevesoft.pat; - + com.stevesoft.pat; /** A tool that is used to make the \E, \U, \L, and \Q elements of a substitution. */ -public class StringBufferLike implements BasicStringBufferLike { +public class StringBufferLike + implements BasicStringBufferLike +{ BasicStringBufferLike sbl; - public StringBufferLike(BasicStringBufferLike sbl) { + public StringBufferLike(BasicStringBufferLike sbl) + { this.sbl = sbl; } + char mode = 'E', altMode = ' '; - public StringLike toStringLike() { + public StringLike toStringLike() + { return sbl.toStringLike(); } - public String toString() { + + public String toString() + { return sbl.toString(); } - public void append(char c) { - - switch(mode) { - case 'u': - mode = altMode; - altMode = ' '; - case 'U': - sbl.append(CaseMgr.toUpperCase(c)); - break; - case 'l': - mode = altMode; - altMode = ' '; - case 'L': - sbl.append(CaseMgr.toLowerCase(c)); - break; - case 'Q': - if((c >= 'a' && c <= 'z') - || (c >= 'A' && c <= 'Z') - || (c >= '0' && c <= '9')) - ; - else - sbl.append('\\'); - default: - sbl.append(c); - break; + + public void append(char c) + { + + switch (mode) + { + case 'u': + mode = altMode; + altMode = ' '; + case 'U': + sbl.append(CaseMgr.toUpperCase(c)); + break; + case 'l': + mode = altMode; + altMode = ' '; + case 'L': + sbl.append(CaseMgr.toLowerCase(c)); + break; + case 'Q': + if ( (c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9')) + { + ; + } + else + { + sbl.append('\\'); + } + default: + sbl.append(c); + break; } } - public void append(String s) { - for(int i=0;i