X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=unused%2Fcom%2Fstevesoft%2Fpat%2FEnd.java;fp=unused%2Fcom%2Fstevesoft%2Fpat%2FEnd.java;h=2d6a04dac089bc6cc1d961d0ecac255e3f94ef8a;hb=6319110ce33faa76ee6cf9832e78faa224510fed;hp=547f3d6dd07a17c1da6878c23204f26ebb0e78ed;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44;p=jalviewjs.git diff --git a/unused/com/stevesoft/pat/End.java b/unused/com/stevesoft/pat/End.java index 547f3d6..2d6a04d 100644 --- a/unused/com/stevesoft/pat/End.java +++ b/unused/com/stevesoft/pat/End.java @@ -1,71 +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); + } +};