X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FStart.java;h=650e7a73defff43957715d50f1eafe5635e69b14;hb=c87eef1308fd65818277b1857fa258ad25473d68;hp=97843580dc8a223f80e113393bb6ea115b76884d;hpb=c40cf903f740a72ab63dd1abc10fa33450ce660d;p=jalview.git diff --git a/src/com/stevesoft/pat/Start.java b/src/com/stevesoft/pat/Start.java index 9784358..650e7a7 100755 --- a/src/com/stevesoft/pat/Start.java +++ b/src/com/stevesoft/pat/Start.java @@ -1,31 +1,56 @@ -// -// 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.Hashtable; - -/** The '^' or the '\A' Pattern, matches the start of a string. */ -class Start extends Pattern { - boolean retIsStart; - Start(boolean b) { retIsStart = b; } - public int matchInternal(int pos,Pthings pt) { - if(retIsStart - && pt.mFlag - && pos > 0 && pt.src.charAt(pos-1)=='\n') - return nextMatch(pos,pt); - if(pos == 0) return nextMatch(pos,pt); - return -1; - } - public String toString() { - if(retIsStart) - return "^"+nextString(); - else - return "\\A"+nextString(); - } - public patInt maxChars() { return new patInt(0); } - Pattern clone1(Hashtable h) { return new Start(retIsStart); } -}; +// +// 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.*; + +/** The '^' or the '\A' Pattern, matches the start of a string. */ +class Start extends Pattern +{ + boolean retIsStart; + + Start(boolean b) + { + retIsStart = b; + } + + public int matchInternal(int pos, Pthings pt) + { + if (retIsStart && pt.mFlag && pos > 0 && pt.src.charAt(pos - 1) == '\n') + { + return nextMatch(pos, pt); + } + if (pos == 0) + { + return nextMatch(pos, pt); + } + return -1; + } + + public String toString() + { + if (retIsStart) + { + return "^" + nextString(); + } + else + { + return "\\A" + nextString(); + } + } + + public patInt maxChars() + { + return new patInt(0); + } + + Pattern clone1(Hashtable h) + { + return new Start(retIsStart); + } +};