X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FEnd.java;h=547f3d6dd07a17c1da6878c23204f26ebb0e78ed;hb=2253f31565d4e96edffce2fac596e2ef0578d596;hp=42894b312d9462d5ca9064fdd916db166af7eba1;hpb=d1f6cf53b29322601c621da9a6b3cb09dd28235e;p=jalview.git diff --git a/src/com/stevesoft/pat/End.java b/src/com/stevesoft/pat/End.java index 42894b3..547f3d6 100755 --- a/src/com/stevesoft/pat/End.java +++ b/src/com/stevesoft/pat/End.java @@ -1,70 +1,71 @@ -// -// 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! -// -package com.stevesoft.pat; - -import java.util.*; - -//class AddToEnd extends RegSyntax {}; - -/** Compiles the '$' or the '\Z' Pattern. It is - an error to have further Pattern elements after - '\Z'. It is the end of the String. */ -class End - extends Pattern -{ - boolean retIsEnd; - End(boolean b) - { - retIsEnd = b; - } - - public int matchInternal(int pos, Pthings pt) - { - if (retIsEnd && pt.mFlag && pos < pt.src.length()) - { - if (pt.src.charAt(pos) == '\n') - { - return nextMatch(pos, pt); - } - } - if (pt.src.length() == pos) - { - return nextMatch(pos, pt); - } - else if (pos < pt.src.length()) - { - // Access the next character... - // this is crucial to making - // RegexReader work. - pt.src.charAt(pos); - } - return -1; - } - - public String toString() - { - if (retIsEnd) - { - return "$"; - } - else - { - return "\\Z"; - } - } - - public patInt maxChars() - { - return new patInt(1); - } - - public Pattern clone1(Hashtable h) - { - return new End(retIsEnd); - } -}; +// +// 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! +// +package com.stevesoft.pat; + +import java.util.*; + +//class AddToEnd extends RegSyntax {}; + +/** + * Compiles the '$' or the '\Z' Pattern. It is an error to have further Pattern + * elements after '\Z'. It is the end of the String. + */ +class End extends Pattern +{ + boolean retIsEnd; + + End(boolean b) + { + retIsEnd = b; + } + + public int matchInternal(int pos, Pthings pt) + { + if (retIsEnd && pt.mFlag && pos < pt.src.length()) + { + if (pt.src.charAt(pos) == '\n') + { + return nextMatch(pos, pt); + } + } + if (pt.src.length() == pos) + { + return nextMatch(pos, pt); + } + else if (pos < pt.src.length()) + { + // Access the next character... + // this is crucial to making + // RegexReader work. + pt.src.charAt(pos); + } + return -1; + } + + public String toString() + { + if (retIsEnd) + { + return "$"; + } + else + { + return "\\Z"; + } + } + + public patInt maxChars() + { + return new patInt(1); + } + + public Pattern clone1(Hashtable h) + { + return new End(retIsEnd); + } +};